Skip to content

Commit

Permalink
Deprecate FreeBSD's CAP_UNUSED* and CAP_ALL* constants
Browse files Browse the repository at this point in the history
They aren't stable across OS versions, and they don't have any
legitimate use in applications.
  • Loading branch information
asomers authored and tgross35 committed Dec 9, 2024
1 parent cec6aa9 commit e9b1ee4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2649,6 +2649,11 @@ fn test_freebsd(target: &str) {
// Added in FreeBSD 14.0
"TCP_FUNCTION_ALIAS" if Some(14) > freebsd_ver => true,

// These constants may change or disappear in future OS releases, and they probably
// have no legitimate use in applications anyway.
"CAP_UNUSED0_44" | "CAP_UNUSED0_57" | "CAP_UNUSED1_22" | "CAP_UNUSED1_57" |
"CAP_ALL0" | "CAP_ALL1" => true,

_ => false,
}
});
Expand Down
6 changes: 6 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2711,8 +2711,11 @@ pub const CAP_SOCK_SERVER: u64 = CAP_ACCEPT
| CAP_SEND
| CAP_SETSOCKOPT
| CAP_SHUTDOWN;
#[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
pub const CAP_ALL0: u64 = cap_right!(0, 0x000007FFFFFFFFFFu64);
#[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
pub const CAP_UNUSED0_44: u64 = cap_right!(0, 0x0000080000000000u64);
#[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
pub const CAP_UNUSED0_57: u64 = cap_right!(0, 0x0100000000000000u64);
pub const CAP_MAC_GET: u64 = cap_right!(1, 0x0000000000000001u64);
pub const CAP_MAC_SET: u64 = cap_right!(1, 0x0000000000000002u64);
Expand All @@ -2736,8 +2739,11 @@ pub const CAP_ACL_GET: u64 = cap_right!(1, 0x0000000000040000u64);
pub const CAP_ACL_SET: u64 = cap_right!(1, 0x0000000000080000u64);
pub const CAP_KQUEUE_CHANGE: u64 = cap_right!(1, 0x0000000000100000u64);
pub const CAP_KQUEUE: u64 = CAP_KQUEUE_EVENT | CAP_KQUEUE_CHANGE;
#[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
pub const CAP_ALL1: u64 = cap_right!(1, 0x00000000001FFFFFu64);
#[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
pub const CAP_UNUSED1_22: u64 = cap_right!(1, 0x0000000000200000u64);
#[deprecated(since = "0.2.165", note = "Not stable across OS versions")]
pub const CAP_UNUSED1_57: u64 = cap_right!(1, 0x0100000000000000u64);
pub const CAP_FCNTL_GETFL: u32 = 1 << 3;
pub const CAP_FCNTL_SETFL: u32 = 1 << 4;
Expand Down

0 comments on commit e9b1ee4

Please sign in to comment.