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

Commit 62fe98e

Browse files
committed
core.sys.posix.spawn: Add Musl libc bindings
1 parent 5e30f2b commit 62fe98e

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
@@ -16,6 +16,8 @@ Glibc: https://sourceware.org/git/?p=glibc.git;a=blob;f=posix/spawn.h;hb=HEAD
1616
1717
Bionic libc: https://android.googlesource.com/platform/bionic.git/+/master/libc/include/spawn.h
1818
19+
Musl libc: https://git.musl-libc.org/cgit/musl/tree/include/spawn.h
20+
1921
Darwin XNU:
2022
https://opensource.apple.com/source/xnu/xnu-4570.71.2/libsyscall/wrappers/spawn/spawn.h.auto.html
2123
https://opensource.apple.com/source/xnu/xnu-4570.71.2/bsd/sys/spawn.h.auto.html
@@ -139,6 +141,36 @@ version (linux)
139141
struct __posix_spawnattr;
140142
struct __posix_spawn_file_actions;
141143
}
144+
else version (CRuntime_Musl)
145+
{
146+
// Source: https://git.musl-libc.org/cgit/musl/tree/include/spawn.h
147+
enum
148+
{
149+
POSIX_SPAWN_RESETIDS = 1,
150+
POSIX_SPAWN_SETPGROUP = 2,
151+
POSIX_SPAWN_SETSIGDEF = 4,
152+
POSIX_SPAWN_SETSIGMASK = 8,
153+
POSIX_SPAWN_SETSCHEDPARAM = 16,
154+
POSIX_SPAWN_SETSCHEDULER = 32,
155+
POSIX_SPAWN_USEVFORK = 64,
156+
POSIX_SPAWN_SETSID = 128
157+
}
158+
struct posix_spawnattr_t
159+
{
160+
int __flags;
161+
pid_t __pgrp;
162+
sigset_t __def, __mask;
163+
int __prio, __pol;
164+
void* __fn;
165+
char[64 - (void*).sizeof] __pad;
166+
}
167+
struct posix_spawn_file_actions_t
168+
{
169+
int[2] __pad0;
170+
void* __actions;
171+
int[16] __pad;
172+
}
173+
}
142174
else
143175
static assert(0, "Unsupported Linux libc");
144176
}

0 commit comments

Comments
 (0)