summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2023-02-02 19:41:19 +0000
committerDavid Carlier <devnexen@gmail.com>2023-02-02 19:41:19 +0000
commit48fae9e9cc1192e8d130339c9f7ebb36a3367fd8 (patch)
tree104807cd18ed20155ab3888d25748244d6e89109
parent106b57a796145c42f9a385a2a8cf764abbc66624 (diff)
downloadrust-libc-48fae9e9cc1192e8d130339c9f7ebb36a3367fd8.tar.gz
pidfile util api for freebsd addition.
-rw-r--r--libc-test/build.rs1
-rw-r--r--libc-test/semver/freebsd.txt6
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs16
3 files changed, 23 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 3ae740faf3..3bfb69ccbf 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -2290,6 +2290,7 @@ fn test_freebsd(target: &str) {
// Those are private types
"memory_type" => true,
"memory_type_list" => true,
+ "pidfh" => true,
_ => false,
}
diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt
index a09f45136d..f51215d694 100644
--- a/libc-test/semver/freebsd.txt
+++ b/libc-test/semver/freebsd.txt
@@ -1749,6 +1749,12 @@ pause
pdfork
pdgetpid
pdkill
+pidfh
+pidfile_close
+pidfile_fileno
+pidfile_open
+pidfile_remove
+pidfile_write
pipe2
popen
posix_fadvise
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index 27caa93608..493ab30f49 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -1014,6 +1014,11 @@ s! {
pub struct memory_type_list {
__priv: [::uintptr_t; 2],
}
+
+ pub struct pidfh {
+ __priva: [[::uintptr_t; 32]; 8],
+ __privb: [::uintptr_t; 2],
+ }
}
s_no_extra_traits! {
@@ -4496,6 +4501,17 @@ extern "C" {
pub fn flopenat(fd: ::c_int, path: *const ::c_char, flags: ::c_int, ...) -> ::c_int;
pub fn getlocalbase() -> *const ::c_char;
+
+ pub fn pidfile_open(
+ path: *const ::c_char,
+ mode: ::mode_t,
+ pidptr: *mut ::pid_t,
+ ) -> *mut ::pidfh;
+ pub fn pidfile_write(path: *mut ::pidfh) -> ::c_int;
+ pub fn pidfile_close(path: *mut ::pidfh) -> ::c_int;
+ pub fn pidfile_remove(path: *mut ::pidfh) -> ::c_int;
+ pub fn pidfile_fileno(path: *const ::pidfh) -> ::c_int;
+ // FIXME: pidfile_signal in due time (both manpage present and updated image snapshot)
}
#[link(name = "procstat")]