Skip to content

Commit 07fba21

Browse files
committed
unix: annotate unstable *COUNT constants
These caused SemVer issues. They can change in upstream releases. This patch aleviates that. It links to usage advice.
1 parent 00183a7 commit 07fba21

4 files changed

Lines changed: 57 additions & 0 deletions

File tree

src/unix/bsd/apple/mod.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3736,7 +3736,11 @@ pub const MNT_NOWAIT: c_int = 2;
37363736

37373737
// <mach/thread_policy.h>
37383738
pub const THREAD_STANDARD_POLICY: c_int = 1;
3739+
3740+
/// This symbol is prone to change across releases upstream.
3741+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
37393742
pub const THREAD_STANDARD_POLICY_COUNT: c_int = 0;
3743+
37403744
pub const THREAD_EXTENDED_POLICY: c_int = 1;
37413745
pub const THREAD_TIME_CONSTRAINT_POLICY: c_int = 2;
37423746
pub const THREAD_PRECEDENCE_POLICY: c_int = 3;
@@ -3798,7 +3802,11 @@ pub const VM_PAGE_QUERY_PAGE_CS_NX: i32 = 0x400;
37983802

37993803
// mach/task_info.h
38003804
pub const TASK_THREAD_TIMES_INFO: u32 = 3;
3805+
3806+
/// This symbol is prone to change across releases upstream.
3807+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
38013808
pub const HOST_CPU_LOAD_INFO_COUNT: u32 = 4;
3809+
38023810
pub const MACH_TASK_BASIC_INFO: u32 = 20;
38033811

38043812
pub const MACH_PORT_NULL: i32 = 0;
@@ -3861,7 +3869,10 @@ pub const COPYFILE_STATE_DST_BSIZE: c_int = 12;
38613869
pub const COPYFILE_STATE_BSIZE: c_int = 13;
38623870

38633871
// <sys/attr.h>
3872+
/// This symbol is prone to change across releases upstream.
3873+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
38643874
pub const ATTR_BIT_MAP_COUNT: c_ushort = 5;
3875+
38653876
pub const FSOPT_NOFOLLOW: u32 = 0x1;
38663877
pub const FSOPT_NOFOLLOW_ANY: u32 = 0x800;
38673878
pub const FSOPT_REPORT_FULLSIZE: u32 = 0x4;
@@ -4032,36 +4043,73 @@ const fn __DARWIN_ALIGN32(p: usize) -> usize {
40324043
(p + __DARWIN_ALIGNBYTES32) & !__DARWIN_ALIGNBYTES32
40334044
}
40344045

4046+
/// This symbol is prone to change across releases upstream.
4047+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
40354048
pub const THREAD_EXTENDED_POLICY_COUNT: mach_msg_type_number_t =
40364049
(size_of::<thread_extended_policy_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
4050+
4051+
/// This symbol is prone to change across releases upstream.
4052+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
40374053
pub const THREAD_TIME_CONSTRAINT_POLICY_COUNT: mach_msg_type_number_t =
40384054
(size_of::<thread_time_constraint_policy_data_t>() / size_of::<integer_t>())
40394055
as mach_msg_type_number_t;
4056+
4057+
/// This symbol is prone to change across releases upstream.
4058+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
40404059
pub const THREAD_PRECEDENCE_POLICY_COUNT: mach_msg_type_number_t =
40414060
(size_of::<thread_precedence_policy_data_t>() / size_of::<integer_t>())
40424061
as mach_msg_type_number_t;
4062+
4063+
/// This symbol is prone to change across releases upstream.
4064+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
40434065
pub const THREAD_AFFINITY_POLICY_COUNT: mach_msg_type_number_t =
40444066
(size_of::<thread_affinity_policy_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
4067+
4068+
/// This symbol is prone to change across releases upstream.
4069+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
40454070
pub const THREAD_BACKGROUND_POLICY_COUNT: mach_msg_type_number_t =
40464071
(size_of::<thread_background_policy_data_t>() / size_of::<integer_t>())
40474072
as mach_msg_type_number_t;
4073+
4074+
/// This symbol is prone to change across releases upstream.
4075+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
40484076
pub const THREAD_LATENCY_QOS_POLICY_COUNT: mach_msg_type_number_t =
40494077
(size_of::<thread_latency_qos_policy_data_t>() / size_of::<integer_t>())
40504078
as mach_msg_type_number_t;
4079+
4080+
/// This symbol is prone to change across releases upstream.
4081+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
40514082
pub const THREAD_THROUGHPUT_QOS_POLICY_COUNT: mach_msg_type_number_t =
40524083
(size_of::<thread_throughput_qos_policy_data_t>() / size_of::<integer_t>())
40534084
as mach_msg_type_number_t;
4085+
4086+
/// This symbol is prone to change across releases upstream.
4087+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
40544088
pub const THREAD_BASIC_INFO_COUNT: mach_msg_type_number_t =
40554089
(size_of::<thread_basic_info_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
4090+
4091+
/// This symbol is prone to change across releases upstream.
4092+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
40564093
pub const THREAD_IDENTIFIER_INFO_COUNT: mach_msg_type_number_t =
40574094
(size_of::<thread_identifier_info_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
4095+
4096+
/// This symbol is prone to change across releases upstream.
4097+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
40584098
pub const THREAD_EXTENDED_INFO_COUNT: mach_msg_type_number_t =
40594099
(size_of::<thread_extended_info_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
40604100

4101+
/// This symbol is prone to change across releases upstream.
4102+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
40614103
pub const TASK_THREAD_TIMES_INFO_COUNT: u32 =
40624104
(size_of::<task_thread_times_info_data_t>() / size_of::<natural_t>()) as u32;
4105+
4106+
/// This symbol is prone to change across releases upstream.
4107+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
40634108
pub const MACH_TASK_BASIC_INFO_COUNT: u32 =
40644109
(size_of::<mach_task_basic_info_data_t>() / size_of::<natural_t>()) as u32;
4110+
4111+
/// This symbol is prone to change across releases upstream.
4112+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
40654113
pub const HOST_VM_INFO64_COUNT: mach_msg_type_number_t =
40664114
(size_of::<vm_statistics64_data_t>() / size_of::<integer_t>()) as mach_msg_type_number_t;
40674115

src/unix/linux_like/android/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,6 +1569,9 @@ pub const NFNL_SUBSYS_CTNETLINK_TIMEOUT: c_int = 8;
15691569
pub const NFNL_SUBSYS_CTHELPER: c_int = 9;
15701570
pub const NFNL_SUBSYS_NFTABLES: c_int = 10;
15711571
pub const NFNL_SUBSYS_NFT_COMPAT: c_int = 11;
1572+
1573+
/// This symbol is prone to change across releases upstream.
1574+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
15721575
pub const NFNL_SUBSYS_COUNT: c_int = 12;
15731576

15741577
pub const NFNL_MSG_BATCH_BEGIN: c_int = NLMSG_MIN_TYPE;

src/unix/linux_like/linux/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,9 @@ pub const NFNL_SUBSYS_CTHELPER: c_int = 9;
16781678
pub const NFNL_SUBSYS_NFTABLES: c_int = 10;
16791679
pub const NFNL_SUBSYS_NFT_COMPAT: c_int = 11;
16801680
pub const NFNL_SUBSYS_HOOK: c_int = 12;
1681+
1682+
/// This symbol is prone to change across releases upstream.
1683+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
16811684
pub const NFNL_SUBSYS_COUNT: c_int = 13;
16821685

16831686
pub const NFNL_MSG_BATCH_BEGIN: c_int = crate::NLMSG_MIN_TYPE;

src/unix/solarish/illumos.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ pub const PRIV_USER: c_uint = PRIV_DEBUG
186186
| PRIV_AWARE_RESET
187187
| PRIV_PFEXEC;
188188

189+
/// This symbol is prone to change across releases upstream.
190+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
189191
pub const LGRP_RSRC_COUNT: crate::lgrp_rsrc_t = 2;
192+
190193
pub const LGRP_RSRC_CPU: crate::lgrp_rsrc_t = 0;
191194
pub const LGRP_RSRC_MEM: crate::lgrp_rsrc_t = 1;
192195

0 commit comments

Comments
 (0)