Skip to content

Commit 888c473

Browse files
committed
Auto merge of #2839 - nielx:haiku-posix_spawn, r=JohnTitor
Haiku: add the posix_spawn functions and constants Tested with libc-test.
2 parents a2f7dac + 8b55add commit 888c473

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

src/unix/haiku/mod.rs

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ pub type Elf64_Xword = u64;
5252
pub type ENTRY = entry;
5353
pub type ACTION = ::c_int;
5454

55+
pub type posix_spawnattr_t = *mut ::c_void;
56+
pub type posix_spawn_file_actions_t = *mut ::c_void;
57+
5558
#[cfg_attr(feature = "extra_traits", derive(Debug))]
5659
pub enum timezone {}
5760
impl ::Copy for timezone {}
@@ -1438,6 +1441,13 @@ pub const LOG_SERIAL: ::c_int = 16 << 12;
14381441
pub const LOG_PERROR: ::c_int = 32 << 12;
14391442
pub const LOG_NOWAIT: ::c_int = 64 << 12;
14401443

1444+
// spawn.h
1445+
pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
1446+
pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
1447+
pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x10;
1448+
pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20;
1449+
pub const POSIX_SPAWN_SETSID: ::c_int = 0x40;
1450+
14411451
const_fn! {
14421452
{const} fn CMSG_ALIGN(len: usize) -> usize {
14431453
len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
@@ -1888,6 +1898,74 @@ extern "C" {
18881898

18891899
pub fn brk(addr: *mut ::c_void) -> ::c_int;
18901900
pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
1901+
1902+
pub fn posix_spawn(
1903+
pid: *mut ::pid_t,
1904+
path: *const ::c_char,
1905+
file_actions: *const ::posix_spawn_file_actions_t,
1906+
attrp: *const ::posix_spawnattr_t,
1907+
argv: *const *mut ::c_char,
1908+
envp: *const *mut ::c_char,
1909+
) -> ::c_int;
1910+
pub fn posix_spawnp(
1911+
pid: *mut ::pid_t,
1912+
file: *const ::c_char,
1913+
file_actions: *const ::posix_spawn_file_actions_t,
1914+
attrp: *const ::posix_spawnattr_t,
1915+
argv: *const *mut ::c_char,
1916+
envp: *const *mut ::c_char,
1917+
) -> ::c_int;
1918+
1919+
pub fn posix_spawn_file_actions_init(file_actions: *mut posix_spawn_file_actions_t) -> ::c_int;
1920+
pub fn posix_spawn_file_actions_destroy(
1921+
file_actions: *mut posix_spawn_file_actions_t,
1922+
) -> ::c_int;
1923+
pub fn posix_spawn_file_actions_addopen(
1924+
file_actions: *mut posix_spawn_file_actions_t,
1925+
fildes: ::c_int,
1926+
path: *const ::c_char,
1927+
oflag: ::c_int,
1928+
mode: ::mode_t,
1929+
) -> ::c_int;
1930+
pub fn posix_spawn_file_actions_addclose(
1931+
file_actions: *mut posix_spawn_file_actions_t,
1932+
fildes: ::c_int,
1933+
) -> ::c_int;
1934+
pub fn posix_spawn_file_actions_adddup2(
1935+
file_actions: *mut posix_spawn_file_actions_t,
1936+
fildes: ::c_int,
1937+
newfildes: ::c_int,
1938+
) -> ::c_int;
1939+
1940+
pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int;
1941+
pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int;
1942+
pub fn posix_spawnattr_getflags(
1943+
attr: *const posix_spawnattr_t,
1944+
_flags: *mut ::c_short,
1945+
) -> ::c_int;
1946+
pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int;
1947+
pub fn posix_spawnattr_getpgroup(
1948+
attr: *const posix_spawnattr_t,
1949+
_pgroup: *mut ::pid_t,
1950+
) -> ::c_int;
1951+
pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, pgroup: ::pid_t) -> ::c_int;
1952+
pub fn posix_spawnattr_getsigdefault(
1953+
attr: *const posix_spawnattr_t,
1954+
sigdefault: *mut ::sigset_t,
1955+
) -> ::c_int;
1956+
pub fn posix_spawnattr_setsigdefault(
1957+
attr: *mut posix_spawnattr_t,
1958+
sigdefault: *const ::sigset_t,
1959+
) -> ::c_int;
1960+
pub fn posix_spawnattr_getsigmask(
1961+
attr: *const posix_spawnattr_t,
1962+
_sigmask: *mut ::sigset_t,
1963+
) -> ::c_int;
1964+
pub fn posix_spawnattr_setsigmask(
1965+
attr: *mut posix_spawnattr_t,
1966+
sigmask: *const ::sigset_t,
1967+
) -> ::c_int;
1968+
18911969
}
18921970

18931971
#[link(name = "bsd")]

0 commit comments

Comments
 (0)