Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 4efb45e

Browse files
committed
core.sys.posix.spawn: Add NetBSD bindings
1 parent 7a6cc00 commit 4efb45e

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/core/sys/posix/spawn.d

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ https://opensource.apple.com/source/xnu/xnu-4570.71.2/bsd/sys/spawn.h.auto.html
2626
https://github.com/opensource-apple/xnu (GitHub mirror)
2727
2828
FreeBSD: https://github.com/freebsd/freebsd/blob/master/include/spawn.h
29+
30+
NetBSD: https://github.com/NetBSD/src/blob/trunk/sys/sys/spawn.h
2931
*/
3032

3133
version (OSX) // macOS and iOS only as this API is prohibited on WatchOS and TVOS
@@ -250,5 +252,35 @@ else version (FreeBSD)
250252
alias posix_spawnattr_t = void*;
251253
alias posix_spawn_file_actions_t = void*;
252254
}
255+
else version (NetBSD)
256+
{
257+
// Source: https://github.com/NetBSD/src/blob/trunk/sys/sys/spawn.h
258+
enum
259+
{
260+
POSIX_SPAWN_RESETIDS = 0x01,
261+
POSIX_SPAWN_SETPGROUP = 0x02,
262+
POSIX_SPAWN_SETSCHEDPARAM = 0x04,
263+
POSIX_SPAWN_SETSCHEDULER = 0x08,
264+
POSIX_SPAWN_SETSIGDEF = 0x10,
265+
POSIX_SPAWN_SETSIGMASK = 0x20,
266+
POSIX_SPAWN_RETURNERROR = 0x40 // NetBSD specific
267+
}
268+
struct posix_spawnattr
269+
{
270+
short sa_flags;
271+
pid_t sa_pgroup;
272+
sched_param sa_schedparam;
273+
int sa_schedpolicy;
274+
sigset_t sa_sigdefault;
275+
sigset_t sa_sigmask;
276+
}
277+
struct posix_spawn_file_actions_entry_t;
278+
struct posix_spawn_file_actions
279+
{
280+
uint size;
281+
uint len;
282+
posix_spawn_file_actions_entry_t* fae;
283+
}
284+
}
253285
else
254286
static assert(0, "Unsupported OS");

0 commit comments

Comments
 (0)