Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
felixmoebius
libc
Commits
11cabded
Commit
11cabded
authored
7 years ago
by
bors
Browse files
Options
Downloads
Plain Diff
Auto merge of #909 - alexcrichton:posix-spawn, r=alexcrichton
Add posix_spawn bindings
parents
56444a45
4621a348
No related branches found
Branches containing commit
No related tags found
Loading
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libc-test/build.rs
+6
-0
6 additions, 0 deletions
libc-test/build.rs
src/unix/bsd/apple/mod.rs
+61
-0
61 additions, 0 deletions
src/unix/bsd/apple/mod.rs
src/unix/notbsd/linux/mod.rs
+93
-0
93 additions, 0 deletions
src/unix/notbsd/linux/mod.rs
with
160 additions
and
0 deletions
libc-test/build.rs
+
6
−
0
View file @
11cabded
...
...
@@ -162,6 +162,7 @@ fn main() {
}
if
apple
{
cfg
.header
(
"spawn.h"
);
cfg
.header
(
"mach-o/dyld.h"
);
cfg
.header
(
"mach/mach_time.h"
);
cfg
.header
(
"malloc/malloc.h"
);
...
...
@@ -276,6 +277,7 @@ fn main() {
cfg
.header
(
"elf.h"
);
cfg
.header
(
"link.h"
);
cfg
.header
(
"linux/if_tun.h"
);
cfg
.header
(
"spawn.h"
);
}
if
freebsd
{
...
...
@@ -445,6 +447,10 @@ fn main() {
// mqd_t is a pointer on FreeBSD and DragonFly
"mqd_t"
if
freebsd
||
dragonfly
=>
true
,
// Just some typedefs on osx, no need to check their sign
"posix_spawnattr_t"
|
"posix_spawn_file_actions_t"
=>
true
,
// windows-isms
n
if
n
.starts_with
(
"P"
)
=>
true
,
n
if
n
.starts_with
(
"H"
)
=>
true
,
...
...
This diff is collapsed.
Click to expand it.
src/unix/bsd/apple/mod.rs
+
61
−
0
View file @
11cabded
...
...
@@ -28,6 +28,8 @@ pub type integer_t = ::c_int;
pub
type
cpu_type_t
=
integer_t
;
pub
type
cpu_subtype_t
=
integer_t
;
pub
type
vm_prot_t
=
::
c_int
;
pub
type
posix_spawnattr_t
=
*
mut
::
c_void
;
pub
type
posix_spawn_file_actions_t
=
*
mut
::
c_void
;
pub
enum
timezone
{}
...
...
@@ -2196,6 +2198,11 @@ pub const DLT_LOOP: ::c_uint = 108;
// sizeof(int32_t)
pub
const
BPF_ALIGNMENT
:
::
c_int
=
4
;
pub
const
POSIX_SPAWN_RESETIDS
:
::
c_int
=
0x01
;
pub
const
POSIX_SPAWN_SETPGROUP
:
::
c_int
=
0x02
;
pub
const
POSIX_SPAWN_SETSIGDEF
:
::
c_int
=
0x04
;
pub
const
POSIX_SPAWN_SETSIGMASK
:
::
c_int
=
0x08
;
f!
{
pub
fn
WSTOPSIG
(
status
:
::
c_int
)
->
::
c_int
{
status
>>
8
...
...
@@ -2392,6 +2399,60 @@ extern {
pub
fn
_dyld_get_image_header
(
image_index
:
u32
)
->
*
const
mach_header
;
pub
fn
_dyld_get_image_vmaddr_slide
(
image_index
:
u32
)
->
::
intptr_t
;
pub
fn
_dyld_get_image_name
(
image_index
:
u32
)
->
*
const
::
c_char
;
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_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!
{
...
...
This diff is collapsed.
Click to expand it.
src/unix/notbsd/linux/mod.rs
+
93
−
0
View file @
11cabded
...
...
@@ -463,6 +463,26 @@ s! {
pub
mnt_freq
:
::
c_int
,
pub
mnt_passno
:
::
c_int
,
}
pub
struct
posix_spawn_file_actions_t
{
__allocated
:
::
c_int
,
__used
:
::
c_int
,
__actions
:
*
mut
::
c_int
,
__pad
:
[::
c_int
;
16
],
}
pub
struct
posix_spawnattr_t
{
__flags
:
::
c_short
,
__pgrp
:
::
pid_t
,
__sd
:
::
sigset_t
,
__ss
:
::
sigset_t
,
#[cfg(target_env
=
"musl"
)]
__prio
:
::
c_int
,
#[cfg(not(target_env
=
"musl"
))]
__sp
:
::
sched_param
,
__policy
:
::
c_int
,
__pad
:
[::
c_int
;
16
],
}
}
pub
const
ABDAY_1
:
::
nl_item
=
0x20000
;
...
...
@@ -1238,6 +1258,13 @@ pub const ETH_P_PHONET: ::c_int = 0x00F5;
pub
const
ETH_P_IEEE802154
:
::
c_int
=
0x00F6
;
pub
const
ETH_P_CAIF
:
::
c_int
=
0x00F7
;
pub
const
POSIX_SPAWN_RESETIDS
:
::
c_int
=
0x01
;
pub
const
POSIX_SPAWN_SETPGROUP
:
::
c_int
=
0x02
;
pub
const
POSIX_SPAWN_SETSIGDEF
:
::
c_int
=
0x04
;
pub
const
POSIX_SPAWN_SETSIGMASK
:
::
c_int
=
0x08
;
pub
const
POSIX_SPAWN_SETSCHEDPARAM
:
::
c_int
=
0x10
;
pub
const
POSIX_SPAWN_SETSCHEDULER
:
::
c_int
=
0x20
;
f!
{
pub
fn
CPU_ZERO
(
cpuset
:
&
mut
cpu_set_t
)
->
()
{
for
slot
in
cpuset
.bits
.iter_mut
()
{
...
...
@@ -1711,6 +1738,72 @@ extern {
pub
fn
endmntent
(
streamp
:
*
mut
::
FILE
)
->
::
c_int
;
pub
fn
hasmntopt
(
mnt
:
*
const
::
mntent
,
opt
:
*
const
::
c_char
)
->
*
mut
::
c_char
;
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!
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment