Skip to content

Define mkostemp(s) and <spawn.h> bindings on DragonFly #4291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions libc-test/semver/dragonfly.txt
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,12 @@ POSIX_MADV_NORMAL
POSIX_MADV_RANDOM
POSIX_MADV_SEQUENTIAL
POSIX_MADV_WILLNEED
POSIX_SPAWN_RESETIDS
POSIX_SPAWN_SETPGROUP
POSIX_SPAWN_SETSCHEDPARAM
POSIX_SPAWN_SETSCHEDULER
POSIX_SPAWN_SETSIGDEF
POSIX_SPAWN_SETSIGMASK
PPPDISC
PROC_PDEATHSIG_CTL
PROC_PDEATHSIG_STATUS
Expand Down Expand Up @@ -1433,6 +1439,8 @@ mincore
mkdirat
mkfifoat
mknodat
mkostemp
mkostemps
mkstemps
mq_attr
mq_close
Expand Down Expand Up @@ -1467,6 +1475,29 @@ popen
posix_fadvise
posix_fallocate
posix_madvise
posix_spawn
posix_spawn_file_actions_addclose
posix_spawn_file_actions_adddup2
posix_spawn_file_actions_addopen
posix_spawn_file_actions_destroy
posix_spawn_file_actions_init
posix_spawn_file_actions_t
posix_spawnattr_destroy
posix_spawnattr_getflags
posix_spawnattr_getpgroup
posix_spawnattr_getschedparam
posix_spawnattr_getschedpolicy
posix_spawnattr_getsigdefault
posix_spawnattr_getsigmask
posix_spawnattr_init
posix_spawnattr_setflags
posix_spawnattr_setpgroup
posix_spawnattr_setschedparam
posix_spawnattr_setschedpolicy
posix_spawnattr_setsigdefault
posix_spawnattr_setsigmask
posix_spawnattr_t
posix_spawnp
ppoll
preadv
procctl
Expand Down
87 changes: 87 additions & 0 deletions src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ pub type vm_map_entry_t = *mut vm_map_entry;

pub type pmap = __c_anonymous_pmap;

pub type posix_spawnattr_t = *mut c_void;
pub type posix_spawn_file_actions_t = *mut c_void;

#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum sem {}
impl Copy for sem {}
Expand Down Expand Up @@ -1537,6 +1540,13 @@ pub const RTAX_MPLS2: c_int = 9;
pub const RTAX_MPLS3: c_int = 10;
pub const RTAX_MAX: c_int = 11;

pub const POSIX_SPAWN_RESETIDS: c_short = 0x01;
pub const POSIX_SPAWN_SETPGROUP: c_short = 0x02;
pub const POSIX_SPAWN_SETSCHEDPARAM: c_short = 0x04;
pub const POSIX_SPAWN_SETSCHEDULER: c_short = 0x08;
pub const POSIX_SPAWN_SETSIGDEF: c_short = 0x10;
pub const POSIX_SPAWN_SETSIGMASK: c_short = 0x20;

const_fn! {
{const} fn _CMSG_ALIGN(n: usize) -> usize {
(n + (mem::size_of::<c_long>() - 1)) & !(mem::size_of::<c_long>() - 1)
Expand Down Expand Up @@ -1702,6 +1712,83 @@ extern "C" {
mntvbufp: *mut *mut crate::statvfs,
flags: c_int,
) -> c_int;

pub fn mkostemp(template: *mut c_char, flags: c_int) -> c_int;
pub fn mkostemps(template: *mut c_char, suffixlen: c_int, flags: c_int) -> c_int;

pub fn posix_spawn(
pid: *mut crate::pid_t,
path: *const c_char,
file_actions: *const crate::posix_spawn_file_actions_t,
attrp: *const crate::posix_spawnattr_t,
argv: *const *mut c_char,
envp: *const *mut c_char,
) -> c_int;
pub fn posix_spawnp(
pid: *mut crate::pid_t,
file: *const c_char,
file_actions: *const crate::posix_spawn_file_actions_t,
attrp: *const crate::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 crate::sigset_t,
) -> c_int;
pub fn posix_spawnattr_setsigdefault(
attr: *mut posix_spawnattr_t,
default: *const crate::sigset_t,
) -> c_int;
pub fn posix_spawnattr_getsigmask(
attr: *const posix_spawnattr_t,
default: *mut crate::sigset_t,
) -> c_int;
pub fn posix_spawnattr_setsigmask(
attr: *mut posix_spawnattr_t,
default: *const crate::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 crate::pid_t,
) -> c_int;
pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: crate::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 crate::sched_param,
) -> c_int;
pub fn posix_spawnattr_setschedparam(
attr: *mut posix_spawnattr_t,
param: *const crate::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: crate::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;
}

#[link(name = "rt")]
Expand Down
Loading