Skip to content

Commit 3d11291

Browse files
committed
procctl api addition for freebsd/dragonflybsd
1 parent 3c0a38c commit 3d11291

File tree

7 files changed

+53
-0
lines changed

7 files changed

+53
-0
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,7 @@ fn test_freebsd(target: &str) {
17831783
"sys/mman.h",
17841784
"sys/mount.h",
17851785
"sys/msg.h",
1786+
"sys/procctl.h",
17861787
"sys/procdesc.h",
17871788
"sys/ptrace.h",
17881789
"sys/random.h",

libc-test/semver/dragonfly.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,11 @@ POSIX_MADV_RANDOM
725725
POSIX_MADV_SEQUENTIAL
726726
POSIX_MADV_WILLNEED
727727
PPPDISC
728+
PROC_PDEATHSIG_CTL
729+
PROC_PDEATHSIG_STATUS
730+
PROC_REAP_ACQUIRE
731+
PROC_REAP_RELEASE
732+
PROC_REAP_STATUS
728733
PTHREAD_CREATE_DETACHED
729734
PTHREAD_CREATE_JOINABLE
730735
PTHREAD_MUTEX_DEFAULT
@@ -1307,6 +1312,7 @@ popen
13071312
posix_madvise
13081313
ppoll
13091314
preadv
1315+
procctl
13101316
pseudo_AF_HDRCMPLT
13111317
pseudo_AF_KEY
13121318
pseudo_AF_PIP

libc-test/semver/freebsd.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,19 @@ POSIX_SPAWN_SETSCHEDULER
832832
POSIX_SPAWN_SETSIGDEF
833833
POSIX_SPAWN_SETSIGMASK
834834
PPPDISC
835+
PROC_PDEATHSIG_CTL
836+
PROC_PDEATHSIG_STATUS
837+
PROC_REAP_ACQUIRE
838+
PROC_REAP_GETPIDS
839+
PROC_REAP_RELEASE
840+
PROC_REAP_STATUS
841+
PROC_SPROTECT
842+
PROC_STACKGAP_CTL
843+
PROC_STACKGAP_STATUS
844+
PROC_TRACE_CTL
845+
PROC_TRACE_STATUS
846+
PROC_TRAPCAP_CTL
847+
PROC_TRAPCAP_STATUS
835848
PTHREAD_CREATE_DETACHED
836849
PTHREAD_CREATE_JOINABLE
837850
PTHREAD_MUTEX_ADAPTIVE_NP
@@ -1561,6 +1574,7 @@ posix_spawnattr_t
15611574
posix_spawnp
15621575
ppoll
15631576
preadv
1577+
procctl
15641578
pseudo_AF_HDRCMPLT
15651579
pseudo_AF_KEY
15661580
pseudo_AF_PIP

src/unix/bsd/freebsdlike/dragonfly/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,12 @@ pub const SO_CPUHINT: ::c_int = 0x1030;
820820

821821
pub const PT_FIRSTMACH: ::c_int = 32;
822822

823+
pub const PROC_REAP_ACQUIRE: ::c_int = 0x0001;
824+
pub const PROC_REAP_RELEASE: ::c_int = 0x0002;
825+
pub const PROC_REAP_STATUS: ::c_int = 0x0003;
826+
pub const PROC_PDEATHSIG_CTL: ::c_int = 0x0004;
827+
pub const PROC_PDEATHSIG_STATUS: ::c_int = 0x0005;
828+
823829
// https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/net/if.h#L101
824830
pub const IFF_UP: ::c_int = 0x1; // interface is up
825831
pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid
@@ -1301,6 +1307,7 @@ extern "C" {
13011307
pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void;
13021308
pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
13031309
pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
1310+
pub fn procctl(idtype: ::idtype_t, id: ::id_t, cmd: ::c_int, data: *mut ::c_void) -> ::c_int;
13041311
}
13051312

13061313
#[link(name = "rt")]

src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ pub const GRND_RANDOM: ::c_uint = 0x2;
202202

203203
pub const RAND_MAX: ::c_int = 0x7fff_fffd;
204204

205+
pub const PROC_ASLR_CTL: ::c_int = 13;
206+
pub const PROC_ASLR_STATUS: ::c_int = 14;
207+
205208
pub const SO_DOMAIN: ::c_int = 0x1019;
206209

207210
pub const EINTEGRITY: ::c_int = 97;

src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ pub const EINTEGRITY: ::c_int = 97;
219219
pub const ELAST: ::c_int = 97;
220220
pub const GRND_INSECURE: ::c_uint = 0x4;
221221

222+
pub const PROC_ASLR_CTL: ::c_int = 13;
223+
pub const PROC_ASLR_STATUS: ::c_int = 14;
224+
pub const PROC_PROTMAX_CTL: ::c_int = 15;
225+
pub const PROC_PROTMAX_STATUS: ::c_int = 16;
226+
222227
pub const LOCAL_CREDS_PERSISTENT: ::c_int = 3;
223228
pub const SCM_CREDS2: ::c_int = 0x08;
224229

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,21 @@ pub const PTRACE_LWP: ::c_int = 0x0010;
840840
pub const PTRACE_VFORK: ::c_int = 0x0020;
841841
pub const PTRACE_DEFAULT: ::c_int = PTRACE_EXEC;
842842

843+
pub const PROC_SPROTECT: ::c_int = 1;
844+
pub const PROC_REAP_ACQUIRE: ::c_int = 2;
845+
pub const PROC_REAP_RELEASE: ::c_int = 3;
846+
pub const PROC_REAP_STATUS: ::c_int = 4;
847+
pub const PROC_REAP_GETPIDS: ::c_int = 5;
848+
pub const PROC_REAP_KILL: ::c_int = 6;
849+
pub const PROC_TRACE_CTL: ::c_int = 7;
850+
pub const PROC_TRACE_STATUS: ::c_int = 8;
851+
pub const PROC_TRAPCAP_CTL: ::c_int = 9;
852+
pub const PROC_TRAPCAP_STATUS: ::c_int = 10;
853+
pub const PROC_PDEATHSIG_CTL: ::c_int = 11;
854+
pub const PROC_PDEATHSIG_STATUS: ::c_int = 12;
855+
pub const PROC_STACKGAP_CTL: ::c_int = 17;
856+
pub const PROC_STACKGAP_STATUS: ::c_int = 18;
857+
843858
pub const AF_SLOW: ::c_int = 33;
844859
pub const AF_SCLUSTER: ::c_int = 34;
845860
pub const AF_ARP: ::c_int = 35;
@@ -1761,6 +1776,8 @@ extern "C" {
17611776
pub fn dallocx(ptr: *mut ::c_void, flags: ::c_int);
17621777
pub fn sdallocx(ptr: *mut ::c_void, size: ::size_t, flags: ::c_int);
17631778
pub fn nallocx(size: ::size_t, flags: ::c_int) -> ::size_t;
1779+
1780+
pub fn procctl(idtype: ::idtype_t, id: ::id_t, cmd: ::c_int, data: *mut ::c_void) -> ::c_int;
17641781
}
17651782

17661783
#[link(name = "util")]

0 commit comments

Comments
 (0)