Skip to content

Commit 48fae9e

Browse files
committed
pidfile util api for freebsd addition.
1 parent 106b57a commit 48fae9e

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,6 +2290,7 @@ fn test_freebsd(target: &str) {
22902290
// Those are private types
22912291
"memory_type" => true,
22922292
"memory_type_list" => true,
2293+
"pidfh" => true,
22932294

22942295
_ => false,
22952296
}

libc-test/semver/freebsd.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,12 @@ pause
17491749
pdfork
17501750
pdgetpid
17511751
pdkill
1752+
pidfh
1753+
pidfile_close
1754+
pidfile_fileno
1755+
pidfile_open
1756+
pidfile_remove
1757+
pidfile_write
17521758
pipe2
17531759
popen
17541760
posix_fadvise

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,11 @@ s! {
10141014
pub struct memory_type_list {
10151015
__priv: [::uintptr_t; 2],
10161016
}
1017+
1018+
pub struct pidfh {
1019+
__priva: [[::uintptr_t; 32]; 8],
1020+
__privb: [::uintptr_t; 2],
1021+
}
10171022
}
10181023

10191024
s_no_extra_traits! {
@@ -4496,6 +4501,17 @@ extern "C" {
44964501
pub fn flopenat(fd: ::c_int, path: *const ::c_char, flags: ::c_int, ...) -> ::c_int;
44974502

44984503
pub fn getlocalbase() -> *const ::c_char;
4504+
4505+
pub fn pidfile_open(
4506+
path: *const ::c_char,
4507+
mode: ::mode_t,
4508+
pidptr: *mut ::pid_t,
4509+
) -> *mut ::pidfh;
4510+
pub fn pidfile_write(path: *mut ::pidfh) -> ::c_int;
4511+
pub fn pidfile_close(path: *mut ::pidfh) -> ::c_int;
4512+
pub fn pidfile_remove(path: *mut ::pidfh) -> ::c_int;
4513+
pub fn pidfile_fileno(path: *const ::pidfh) -> ::c_int;
4514+
// FIXME: pidfile_signal in due time (both manpage present and updated image snapshot)
44994515
}
45004516

45014517
#[link(name = "procstat")]

0 commit comments

Comments
 (0)