Skip to content

Commit a3337c5

Browse files
committed
procctl api addition for freebsd/dragonflybsd
1 parent e1eb972 commit a3337c5

File tree

7 files changed

+54
-0
lines changed

7 files changed

+54
-0
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,6 +1782,7 @@ fn test_freebsd(target: &str) {
17821782
"sys/mman.h",
17831783
"sys/mount.h",
17841784
"sys/msg.h",
1785+
"sys/procctl.h",
17851786
"sys/procdesc.h",
17861787
"sys/ptrace.h",
17871788
"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
@@ -1306,6 +1311,7 @@ popen
13061311
posix_madvise
13071312
ppoll
13081313
preadv
1314+
procctl
13091315
pseudo_AF_HDRCMPLT
13101316
pseudo_AF_KEY
13111317
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
@@ -1560,6 +1573,7 @@ posix_spawnattr_t
15601573
posix_spawnp
15611574
ppoll
15621575
preadv
1576+
procctl
15631577
pseudo_AF_HDRCMPLT
15641578
pseudo_AF_KEY
15651579
pseudo_AF_PIP

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

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

808808
pub const PT_FIRSTMACH: ::c_int = 32;
809809

810+
pub const PROC_REAP_ACQUIRE: ::c_int = 0x0001;
811+
pub const PROC_REAP_RELEASE: ::c_int = 0x0002;
812+
pub const PROC_REAP_STATUS: ::c_int = 0x0003;
813+
pub const PROC_PDEATHSIG_CTL: ::c_int = 0x0004;
814+
pub const PROC_PDEATHSIG_STATUS: ::c_int = 0x0005;
815+
810816
// https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/net/if.h#L101
811817
pub const IFF_UP: ::c_int = 0x1; // interface is up
812818
pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid
@@ -1283,6 +1289,8 @@ extern "C" {
12831289
pub fn sched_setaffinity(pid: ::pid_t, cpusetsize: ::size_t, mask: *const cpu_set_t)
12841290
-> ::c_int;
12851291
pub fn setproctitle(fmt: *const ::c_char, ...);
1292+
1293+
pub fn procctl(idtype: ::idtype_t, id: ::id_t, cmd: ::c_int, data: *mut ::c_void) -> ::c_int;
12861294
}
12871295

12881296
#[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
@@ -850,6 +850,21 @@ pub const PTRACE_LWP: ::c_int = 0x0010;
850850
pub const PTRACE_VFORK: ::c_int = 0x0020;
851851
pub const PTRACE_DEFAULT: ::c_int = PTRACE_EXEC;
852852

853+
pub const PROC_SPROTECT: ::c_int = 1;
854+
pub const PROC_REAP_ACQUIRE: ::c_int = 2;
855+
pub const PROC_REAP_RELEASE: ::c_int = 3;
856+
pub const PROC_REAP_STATUS: ::c_int = 4;
857+
pub const PROC_REAP_GETPIDS: ::c_int = 5;
858+
pub const PROC_REAP_KILL: ::c_int = 6;
859+
pub const PROC_TRACE_CTL: ::c_int = 7;
860+
pub const PROC_TRACE_STATUS: ::c_int = 8;
861+
pub const PROC_TRAPCAP_CTL: ::c_int = 9;
862+
pub const PROC_TRAPCAP_STATUS: ::c_int = 10;
863+
pub const PROC_PDEATHSIG_CTL: ::c_int = 11;
864+
pub const PROC_PDEATHSIG_STATUS: ::c_int = 12;
865+
pub const PROC_STACKGAP_CTL: ::c_int = 17;
866+
pub const PROC_STACKGAP_STATUS: ::c_int = 18;
867+
853868
pub const AF_SLOW: ::c_int = 33;
854869
pub const AF_SCLUSTER: ::c_int = 34;
855870
pub const AF_ARP: ::c_int = 35;
@@ -1771,6 +1786,8 @@ extern "C" {
17711786
pub fn dallocx(ptr: *mut ::c_void, flags: ::c_int);
17721787
pub fn sdallocx(ptr: *mut ::c_void, size: ::size_t, flags: ::c_int);
17731788
pub fn nallocx(size: ::size_t, flags: ::c_int) -> ::size_t;
1789+
1790+
pub fn procctl(idtype: ::idtype_t, id: ::id_t, cmd: ::c_int, data: *mut ::c_void) -> ::c_int;
17741791
}
17751792

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

0 commit comments

Comments
 (0)