Add posix_spawn bindings for FreeBSD

This commit is contained in:
Bryan Drewery 2018-02-26 16:36:13 -08:00
parent 88c33d4580
commit 92d50c9c79
2 changed files with 77 additions and 0 deletions

View File

@ -294,6 +294,7 @@ fn main() {
cfg.header("sys/shm.h");
cfg.header("sys/procdesc.h");
cfg.header("sys/rtprio.h");
cfg.header("spawn.h");
}
if netbsd {

View File

@ -15,6 +15,9 @@ pub type key_t = ::c_long;
pub type msglen_t = ::c_ulong;
pub type msgqnum_t = ::c_ulong;
pub type posix_spawnattr_t = *mut ::c_void;
pub type posix_spawn_file_actions_t = *mut ::c_void;
s! {
pub struct utmpx {
pub ut_type: ::c_short,
@ -851,6 +854,13 @@ pub const RTP_PRIO_REALTIME: ::c_ushort = 2;
pub const RTP_PRIO_NORMAL: ::c_ushort = 3;
pub const RTP_PRIO_IDLE: ::c_ushort = 4;
pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x04;
pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x08;
pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x10;
pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20;
extern {
pub fn __error() -> *mut ::c_int;
@ -913,6 +923,72 @@ extern {
pub fn rtprio_thread(function: ::c_int, lwpid: ::lwpid_t,
rtp: *mut super::rtprio) -> ::c_int;
pub fn posix_spawn(pid: *mut ::pid_t,
path: *const ::c_char,
file_actions: *const ::posix_spawn_file_actions_t,
attrp: *const ::posix_spawnattr_t,
argv: *const *mut ::c_char,
envp: *const *mut ::c_char) -> ::c_int;
pub fn posix_spawnp(pid: *mut ::pid_t,
file: *const ::c_char,
file_actions: *const ::posix_spawn_file_actions_t,
attrp: *const ::posix_spawnattr_t,
argv: *const *mut ::c_char,
envp: *const *mut ::c_char) -> ::c_int;
pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int;
pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int;
pub fn posix_spawnattr_getsigdefault(attr: *const posix_spawnattr_t,
default: *mut ::sigset_t) -> ::c_int;
pub fn posix_spawnattr_setsigdefault(attr: *mut posix_spawnattr_t,
default: *const ::sigset_t) -> ::c_int;
pub fn posix_spawnattr_getsigmask(attr: *const posix_spawnattr_t,
default: *mut ::sigset_t) -> ::c_int;
pub fn posix_spawnattr_setsigmask(attr: *mut posix_spawnattr_t,
default: *const ::sigset_t) -> ::c_int;
pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t,
flags: *mut ::c_short) -> ::c_int;
pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t,
flags: ::c_short) -> ::c_int;
pub fn posix_spawnattr_getpgroup(attr: *const posix_spawnattr_t,
flags: *mut ::pid_t) -> ::c_int;
pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t,
flags: ::pid_t) -> ::c_int;
pub fn posix_spawnattr_getschedpolicy(attr: *const posix_spawnattr_t,
flags: *mut ::c_int) -> ::c_int;
pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t,
flags: ::c_int) -> ::c_int;
pub fn posix_spawnattr_getschedparam(
attr: *const posix_spawnattr_t,
param: *mut ::sched_param,
) -> ::c_int;
pub fn posix_spawnattr_setschedparam(
attr: *mut posix_spawnattr_t,
param: *const ::sched_param,
) -> ::c_int;
pub fn posix_spawn_file_actions_init(
actions: *mut posix_spawn_file_actions_t,
) -> ::c_int;
pub fn posix_spawn_file_actions_destroy(
actions: *mut posix_spawn_file_actions_t,
) -> ::c_int;
pub fn posix_spawn_file_actions_addopen(
actions: *mut posix_spawn_file_actions_t,
fd: ::c_int,
path: *const ::c_char,
oflag: ::c_int,
mode: ::mode_t,
) -> ::c_int;
pub fn posix_spawn_file_actions_addclose(
actions: *mut posix_spawn_file_actions_t,
fd: ::c_int,
) -> ::c_int;
pub fn posix_spawn_file_actions_adddup2(
actions: *mut posix_spawn_file_actions_t,
fd: ::c_int,
newfd: ::c_int,
) -> ::c_int;
}
cfg_if! {