Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pidfile util api for freebsd addition. #3099

Merged
merged 1 commit into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2290,6 +2290,7 @@ fn test_freebsd(target: &str) {
// Those are private types
"memory_type" => true,
"memory_type_list" => true,
"pidfh" => true,

_ => false,
}
Expand Down
6 changes: 6 additions & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,12 @@ pause
pdfork
pdgetpid
pdkill
pidfh
pidfile_close
pidfile_fileno
pidfile_open
pidfile_remove
pidfile_write
pipe2
popen
posix_fadvise
Expand Down
16 changes: 16 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down Expand Up @@ -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")]
Expand Down