Skip to content

procctl for freebsd 15 upgrade. #4657

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
11 changes: 11 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2741,6 +2741,17 @@ fn test_freebsd(target: &str) {
// Added in FreeBSD 14.2
"SO_SPLICE" if Some(14) > freebsd_ver => true,

// Added in FreeBSD 15
"PROC_LOGSIGEXIT_CTL"
| "PROC_LOGSIGEXIT_STATUS"
| "PROC_LOGSIGEXIT_CTL_NOFORCE"
| "PROC_LOGSIGEXIT_CTL_FORCE_ENABLE"
| "PROC_LOGSIGEXIT_FORCE_DISABLE"
if Some(15) > freebsd_ver =>
{
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 @@ -1046,6 +1046,12 @@ POSIX_SPAWN_SETSCHEDPARAM
POSIX_SPAWN_SETSCHEDULER
POSIX_SPAWN_SETSIGDEF
POSIX_SPAWN_SETSIGMASK
PPROC_CLEAR
PPROC_DESCEND
PPROC_FLAGS
PPROC_INHERIT
PPROC_OP
PPROC_SET
PPPDISC
PROC_NO_NEW_PRIVS_CTL
PROC_NO_NEW_PRIVS_DISABLE
Expand Down
13 changes: 13 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3012,6 +3012,11 @@ pub const PROC_NO_NEW_PRIVS_STATUS: c_int = 20;
pub const PROC_WXMAP_CTL: c_int = 21;
pub const PROC_WXMAP_STATUS: c_int = 22;
pub const PROC_PROCCTL_MD_MIN: c_int = 0x10000000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's best to keep PROC_PROCCTL_MD_MIN at the end, it doesn't really have a place between PROC_WXMAP_STATUS and PROC_LOGSIGEXIT_CTL in the original headers

pub const PROC_LOGSIGEXIT_CTL: c_int = 23;
pub const PROC_LOGSIGEXIT_STATUS: c_int = 24;
pub const PROC_LOGSIGEXIT_CTL_NOFORCE: c_int = 1;
pub const PROC_LOGSIGEXIT_CTL_FORCE_ENABLE: c_int = 2;
pub const PROC_LOGSIGEXIT_CTL_FORCE_DISABLE: c_int = 3;

pub const PPROT_SET: c_int = 1;
pub const PPROT_CLEAR: c_int = 2;
Expand Down Expand Up @@ -4788,6 +4793,14 @@ safe_f! {
pub {const} fn PR_SCTP_VALID_POLICY(x: c_int) -> bool {
PR_SCTP_POLICY(x) <= SCTP_PR_SCTP_MAX
}

pub {const} fn PPROT_OP(o: c_int) -> c_int {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally would prefer the PPROT changes in a separate commit (same PR is ok), so they can get a more focused commit message (perhaps with a reference link as well)

o & 0xf
}

pub {const} fn PPROT_FLAGS(o: c_int) -> c_int {
o & !0xf
}
}

cfg_if! {
Expand Down
Loading