Skip to content

Commit

Permalink
Auto merge of #2337 - devnexen:fbsd_procctl, r=Amanieu
Browse files Browse the repository at this point in the history
procctl api addition for freebsd/dragonflybsd
  • Loading branch information
bors committed Aug 16, 2021
2 parents 3c0a38c + 3d11291 commit 74adc7f
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1783,6 +1783,7 @@ fn test_freebsd(target: &str) {
"sys/mman.h",
"sys/mount.h",
"sys/msg.h",
"sys/procctl.h",
"sys/procdesc.h",
"sys/ptrace.h",
"sys/random.h",
Expand Down
6 changes: 6 additions & 0 deletions libc-test/semver/dragonfly.txt
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,11 @@ POSIX_MADV_RANDOM
POSIX_MADV_SEQUENTIAL
POSIX_MADV_WILLNEED
PPPDISC
PROC_PDEATHSIG_CTL
PROC_PDEATHSIG_STATUS
PROC_REAP_ACQUIRE
PROC_REAP_RELEASE
PROC_REAP_STATUS
PTHREAD_CREATE_DETACHED
PTHREAD_CREATE_JOINABLE
PTHREAD_MUTEX_DEFAULT
Expand Down Expand Up @@ -1307,6 +1312,7 @@ popen
posix_madvise
ppoll
preadv
procctl
pseudo_AF_HDRCMPLT
pseudo_AF_KEY
pseudo_AF_PIP
Expand Down
14 changes: 14 additions & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,19 @@ POSIX_SPAWN_SETSCHEDULER
POSIX_SPAWN_SETSIGDEF
POSIX_SPAWN_SETSIGMASK
PPPDISC
PROC_PDEATHSIG_CTL
PROC_PDEATHSIG_STATUS
PROC_REAP_ACQUIRE
PROC_REAP_GETPIDS
PROC_REAP_RELEASE
PROC_REAP_STATUS
PROC_SPROTECT
PROC_STACKGAP_CTL
PROC_STACKGAP_STATUS
PROC_TRACE_CTL
PROC_TRACE_STATUS
PROC_TRAPCAP_CTL
PROC_TRAPCAP_STATUS
PTHREAD_CREATE_DETACHED
PTHREAD_CREATE_JOINABLE
PTHREAD_MUTEX_ADAPTIVE_NP
Expand Down Expand Up @@ -1561,6 +1574,7 @@ posix_spawnattr_t
posix_spawnp
ppoll
preadv
procctl
pseudo_AF_HDRCMPLT
pseudo_AF_KEY
pseudo_AF_PIP
Expand Down
7 changes: 7 additions & 0 deletions src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,12 @@ pub const SO_CPUHINT: ::c_int = 0x1030;

pub const PT_FIRSTMACH: ::c_int = 32;

pub const PROC_REAP_ACQUIRE: ::c_int = 0x0001;
pub const PROC_REAP_RELEASE: ::c_int = 0x0002;
pub const PROC_REAP_STATUS: ::c_int = 0x0003;
pub const PROC_PDEATHSIG_CTL: ::c_int = 0x0004;
pub const PROC_PDEATHSIG_STATUS: ::c_int = 0x0005;

// https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/net/if.h#L101
pub const IFF_UP: ::c_int = 0x1; // interface is up
pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid
Expand Down Expand Up @@ -1301,6 +1307,7 @@ extern "C" {
pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void;
pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
pub fn procctl(idtype: ::idtype_t, id: ::id_t, cmd: ::c_int, data: *mut ::c_void) -> ::c_int;
}

#[link(name = "rt")]
Expand Down
3 changes: 3 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ pub const GRND_RANDOM: ::c_uint = 0x2;

pub const RAND_MAX: ::c_int = 0x7fff_fffd;

pub const PROC_ASLR_CTL: ::c_int = 13;
pub const PROC_ASLR_STATUS: ::c_int = 14;

pub const SO_DOMAIN: ::c_int = 0x1019;

pub const EINTEGRITY: ::c_int = 97;
Expand Down
5 changes: 5 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ pub const EINTEGRITY: ::c_int = 97;
pub const ELAST: ::c_int = 97;
pub const GRND_INSECURE: ::c_uint = 0x4;

pub const PROC_ASLR_CTL: ::c_int = 13;
pub const PROC_ASLR_STATUS: ::c_int = 14;
pub const PROC_PROTMAX_CTL: ::c_int = 15;
pub const PROC_PROTMAX_STATUS: ::c_int = 16;

pub const LOCAL_CREDS_PERSISTENT: ::c_int = 3;
pub const SCM_CREDS2: ::c_int = 0x08;

Expand Down
17 changes: 17 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,21 @@ pub const PTRACE_LWP: ::c_int = 0x0010;
pub const PTRACE_VFORK: ::c_int = 0x0020;
pub const PTRACE_DEFAULT: ::c_int = PTRACE_EXEC;

pub const PROC_SPROTECT: ::c_int = 1;
pub const PROC_REAP_ACQUIRE: ::c_int = 2;
pub const PROC_REAP_RELEASE: ::c_int = 3;
pub const PROC_REAP_STATUS: ::c_int = 4;
pub const PROC_REAP_GETPIDS: ::c_int = 5;
pub const PROC_REAP_KILL: ::c_int = 6;
pub const PROC_TRACE_CTL: ::c_int = 7;
pub const PROC_TRACE_STATUS: ::c_int = 8;
pub const PROC_TRAPCAP_CTL: ::c_int = 9;
pub const PROC_TRAPCAP_STATUS: ::c_int = 10;
pub const PROC_PDEATHSIG_CTL: ::c_int = 11;
pub const PROC_PDEATHSIG_STATUS: ::c_int = 12;
pub const PROC_STACKGAP_CTL: ::c_int = 17;
pub const PROC_STACKGAP_STATUS: ::c_int = 18;

pub const AF_SLOW: ::c_int = 33;
pub const AF_SCLUSTER: ::c_int = 34;
pub const AF_ARP: ::c_int = 35;
Expand Down Expand Up @@ -1761,6 +1776,8 @@ extern "C" {
pub fn dallocx(ptr: *mut ::c_void, flags: ::c_int);
pub fn sdallocx(ptr: *mut ::c_void, size: ::size_t, flags: ::c_int);
pub fn nallocx(size: ::size_t, flags: ::c_int) -> ::size_t;

pub fn procctl(idtype: ::idtype_t, id: ::id_t, cmd: ::c_int, data: *mut ::c_void) -> ::c_int;
}

#[link(name = "util")]
Expand Down

0 comments on commit 74adc7f

Please sign in to comment.