Skip to content

Commit 1a18c7d

Browse files
committed
crate: annotate unstable *MAX constants
There were troublesome symbols. Upstrem releases can change them. The frequency of change is inconvenient. This makes SemVer inconvenient. Users may need advice. This patch does that.
1 parent 00183a7 commit 1a18c7d

28 files changed

Lines changed: 569 additions & 102 deletions

File tree

src/fuchsia/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,6 +1592,8 @@ pub const LOCK_UN: c_int = 8;
15921592
pub const SS_ONSTACK: c_int = 1;
15931593
pub const SS_DISABLE: c_int = 2;
15941594

1595+
/// This symbol is prone to change across releases upstream.
1596+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
15951597
pub const PATH_MAX: c_int = 4096;
15961598

15971599
pub const FD_SETSIZE: c_int = 1024;

src/new/linux_uapi/linux/can/j1939.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,6 @@ s! {
5757
}
5858
}
5959

60+
/// This symbol is prone to change across releases upstream.
61+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
6062
pub const J1939_FILTER_MAX: c_int = 512;

src/new/linux_uapi/linux/can/raw.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
pub use crate::linux::can::*;
44

55
pub const SOL_CAN_RAW: c_int = SOL_CAN_BASE + CAN_RAW;
6+
7+
/// This symbol is prone to change across releases upstream.
8+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
69
pub const CAN_RAW_FILTER_MAX: c_int = 512;
710

811
// FIXME(cleanup): use `c_enum!`, which needs to be adapted to allow omitting a type.

src/new/qurt/limits.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,22 @@ pub const USHRT_MAX: c_ushort = 65535;
2727
// POSIX Limits
2828
pub const ARG_MAX: c_int = 4096;
2929
pub const CHILD_MAX: c_int = 25;
30+
31+
/// This symbol is prone to change across releases upstream.
32+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
3033
pub const LINK_MAX: c_int = 8;
34+
35+
/// This symbol is prone to change across releases upstream.
36+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
37+
pub const NAME_MAX: c_int = 255;
38+
39+
/// This symbol is prone to change across releases upstream.
40+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
41+
pub const PATH_MAX: c_int = 260;
42+
3143
pub const MAX_CANON: c_int = 255;
3244
pub const MAX_INPUT: c_int = 255;
33-
pub const NAME_MAX: c_int = 255;
3445
pub const OPEN_MAX: c_int = 20;
35-
pub const PATH_MAX: c_int = 260;
3646
pub const PIPE_BUF: c_int = 512;
3747
pub const STREAM_MAX: c_int = 20;
3848
pub const TZNAME_MAX: c_int = 50;

src/new/qurt/signal.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ pub const SIG_SETMASK: c_int = 3;
5151
pub const POSIX_MSG: c_int = 7;
5252
pub const POSIX_NOTIF: c_int = 8;
5353
pub const SIGRTMIN: c_int = 10;
54+
55+
/// This symbol is prone to change across releases upstream.
56+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
5457
pub const SIGRTMAX: c_int = 32;
5558

5659
// Notification types (from QuRT signal.h)

src/unix/aix/mod.rs

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,11 @@ pub const RTAX_IFP: c_int = 4;
932932
pub const RTAX_IFA: c_int = 5;
933933
pub const RTAX_AUTHOR: c_int = 6;
934934
pub const RTAX_BRD: c_int = 7;
935+
936+
/// This symbol is prone to change across releases upstream.
937+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
935938
pub const RTAX_MAX: c_int = 8;
939+
936940
pub const RTF_UP: c_int = 0x1;
937941
pub const RTF_GATEWAY: c_int = 0x2;
938942
pub const RTF_HOST: c_int = 0x4;
@@ -1445,7 +1449,39 @@ pub const L_GETPROCINFO: c_int = 7;
14451449
pub const L_GETXINFO: c_int = 8;
14461450

14471451
// sys/limits.h
1452+
1453+
/// This symbol is prone to change across releases upstream.
1454+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
14481455
pub const PATH_MAX: c_int = 1023;
1456+
1457+
/// This symbol is prone to change across releases upstream.
1458+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
1459+
pub const BC_BASE_MAX: c_int = 99;
1460+
1461+
/// This symbol is prone to change across releases upstream.
1462+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
1463+
pub const BC_DIM_MAX: c_int = 0x800;
1464+
1465+
/// This symbol is prone to change across releases upstream.
1466+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
1467+
pub const BC_SCALE_MAX: c_int = 99;
1468+
1469+
/// This symbol is prone to change across releases upstream.
1470+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
1471+
pub const BC_STRING_MAX: c_int = 0x800;
1472+
1473+
/// This symbol is prone to change across releases upstream.
1474+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
1475+
pub const CHARCLASS_NAME_MAX: c_int = 14;
1476+
1477+
/// This symbol is prone to change across releases upstream.
1478+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
1479+
pub const COLL_WEIGHTS_MAX: c_int = 4;
1480+
1481+
/// This symbol is prone to change across releases upstream.
1482+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
1483+
pub const EXPR_NEST_MAX: c_int = 32;
1484+
14491485
pub const PAGESIZE: c_int = 4096;
14501486
pub const IOV_MAX: c_int = 16;
14511487
pub const AIO_LISTIO_MAX: c_int = 4096;
@@ -1454,14 +1490,7 @@ pub const OPEN_MAX: c_int = 65534;
14541490
pub const MAX_INPUT: c_int = 512;
14551491
pub const MAX_CANON: c_int = 256;
14561492
pub const ARG_MAX: c_int = 1048576;
1457-
pub const BC_BASE_MAX: c_int = 99;
1458-
pub const BC_DIM_MAX: c_int = 0x800;
1459-
pub const BC_SCALE_MAX: c_int = 99;
1460-
pub const BC_STRING_MAX: c_int = 0x800;
1461-
pub const CHARCLASS_NAME_MAX: c_int = 14;
14621493
pub const CHILD_MAX: c_int = 128;
1463-
pub const COLL_WEIGHTS_MAX: c_int = 4;
1464-
pub const EXPR_NEST_MAX: c_int = 32;
14651494
pub const NZERO: c_int = 20;
14661495

14671496
// sys/lockf.h
@@ -1541,7 +1570,11 @@ pub const MAXPATHLEN: c_int = PATH_MAX + 1;
15411570
pub const MAXSYMLINKS: c_int = 20;
15421571
pub const MAXHOSTNAMELEN: c_int = 256;
15431572
pub const MAXUPRC: c_int = 128;
1573+
1574+
/// This symbol is prone to change across releases upstream.
1575+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
15441576
pub const NGROUPS_MAX: c_ulong = 2048;
1577+
15451578
pub const NGROUPS: c_ulong = NGROUPS_MAX;
15461579
pub const NOFILE: c_int = OPEN_MAX;
15471580

@@ -1739,7 +1772,11 @@ pub const SIGXCPU: c_int = 24;
17391772
pub const SIGXFSZ: c_int = 25;
17401773
pub const SIGTRAP: c_int = 5;
17411774
pub const SIGCLD: c_int = 20;
1775+
1776+
/// This symbol is prone to change across releases upstream.
1777+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
17421778
pub const SIGRTMAX: c_int = 57;
1779+
17431780
pub const SIGRTMIN: c_int = 50;
17441781
pub const SI_USER: c_int = 0;
17451782
pub const SI_UNDEFINED: c_int = 8;
@@ -1817,7 +1854,11 @@ pub const AF_INET6: c_int = 24;
18171854
pub const AF_INTF: c_int = 20;
18181855
pub const AF_RIF: c_int = 21;
18191856
pub const AF_NDD: c_int = 23;
1857+
1858+
/// This symbol is prone to change across releases upstream.
1859+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
18201860
pub const AF_MAX: c_int = 30;
1861+
18211862
pub const PF_UNSPEC: c_int = AF_UNSPEC;
18221863
pub const PF_UNIX: c_int = AF_UNIX;
18231864
pub const PF_INET: c_int = AF_INET;
@@ -1843,7 +1884,11 @@ pub const PF_RIF: c_int = AF_RIF;
18431884
pub const PF_INTF: c_int = AF_INTF;
18441885
pub const PF_NDD: c_int = AF_NDD;
18451886
pub const PF_INET6: c_int = AF_INET6;
1887+
1888+
/// This symbol is prone to change across releases upstream.
1889+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
18461890
pub const PF_MAX: c_int = AF_MAX;
1891+
18471892
pub const SF_CLOSE: c_int = 1;
18481893
pub const SF_REUSE: c_int = 2;
18491894
pub const SF_DONT_CACHE: c_int = 4;

src/unix/bsd/apple/mod.rs

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,6 +2014,9 @@ pub const CPU_STATE_USER: c_int = 0;
20142014
pub const CPU_STATE_SYSTEM: c_int = 1;
20152015
pub const CPU_STATE_IDLE: c_int = 2;
20162016
pub const CPU_STATE_NICE: c_int = 3;
2017+
2018+
/// This symbol is prone to change across releases upstream.
2019+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
20172020
pub const CPU_STATE_MAX: c_int = 4;
20182021

20192022
pub const PROCESSOR_BASIC_INFO: c_int = 1;
@@ -3399,14 +3402,39 @@ pub const HW_TARGET: c_int = 26;
33993402
pub const HW_PRODUCT: c_int = 27;
34003403
pub const HW_MAXID: c_int = 28;
34013404
pub const USER_CS_PATH: c_int = 1;
3405+
3406+
/// This symbol is prone to change across releases upstream.
3407+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
34023408
pub const USER_BC_BASE_MAX: c_int = 2;
3409+
3410+
/// This symbol is prone to change across releases upstream.
3411+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
34033412
pub const USER_BC_DIM_MAX: c_int = 3;
3413+
3414+
/// This symbol is prone to change across releases upstream.
3415+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
34043416
pub const USER_BC_SCALE_MAX: c_int = 4;
3417+
3418+
/// This symbol is prone to change across releases upstream.
3419+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
34053420
pub const USER_BC_STRING_MAX: c_int = 5;
3421+
3422+
/// This symbol is prone to change across releases upstream.
3423+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
34063424
pub const USER_COLL_WEIGHTS_MAX: c_int = 6;
3425+
3426+
/// This symbol is prone to change across releases upstream.
3427+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
34073428
pub const USER_EXPR_NEST_MAX: c_int = 7;
3429+
3430+
/// This symbol is prone to change across releases upstream.
3431+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
34083432
pub const USER_LINE_MAX: c_int = 8;
3433+
3434+
/// This symbol is prone to change across releases upstream.
3435+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
34093436
pub const USER_RE_DUP_MAX: c_int = 9;
3437+
34103438
pub const USER_POSIX2_VERSION: c_int = 10;
34113439
pub const USER_POSIX2_C_BIND: c_int = 11;
34123440
pub const USER_POSIX2_C_DEV: c_int = 12;
@@ -3450,10 +3478,6 @@ pub const SIGEV_THREAD: c_int = 3;
34503478
pub const AIO_CANCELED: c_int = 2;
34513479
pub const AIO_NOTCANCELED: c_int = 4;
34523480
pub const AIO_ALLDONE: c_int = 1;
3453-
#[deprecated(
3454-
since = "0.2.64",
3455-
note = "Can vary at runtime. Use sysconf(3) instead"
3456-
)]
34573481
pub const AIO_LISTIO_MAX: c_int = 16;
34583482
pub const LIO_NOP: c_int = 0;
34593483
pub const LIO_WRITE: c_int = 2;
@@ -3529,6 +3553,8 @@ pub const RTV_SSTHRESH: c_int = 0x20;
35293553
pub const RTV_RTT: c_int = 0x40;
35303554
pub const RTV_RTTVAR: c_int = 0x80;
35313555

3556+
/// This symbol is prone to change across releases upstream.
3557+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
35323558
pub const RTAX_MAX: c_int = 8;
35333559

35343560
pub const KERN_PROCARGS2: c_int = 49;

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,14 +645,39 @@ pub const HW_MACHINE_PLATFORM: c_int = 12;
645645
pub const HW_SENSORS: c_int = 13;
646646
pub const HW_MAXID: c_int = 14;
647647
pub const USER_CS_PATH: c_int = 1;
648+
649+
/// This symbol is prone to change across releases upstream.
650+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
648651
pub const USER_BC_BASE_MAX: c_int = 2;
652+
653+
/// This symbol is prone to change across releases upstream.
654+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
649655
pub const USER_BC_DIM_MAX: c_int = 3;
656+
657+
/// This symbol is prone to change across releases upstream.
658+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
650659
pub const USER_BC_SCALE_MAX: c_int = 4;
660+
661+
/// This symbol is prone to change across releases upstream.
662+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
651663
pub const USER_BC_STRING_MAX: c_int = 5;
664+
665+
/// This symbol is prone to change across releases upstream.
666+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
652667
pub const USER_COLL_WEIGHTS_MAX: c_int = 6;
668+
669+
/// This symbol is prone to change across releases upstream.
670+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
653671
pub const USER_EXPR_NEST_MAX: c_int = 7;
672+
673+
/// This symbol is prone to change across releases upstream.
674+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
654675
pub const USER_LINE_MAX: c_int = 8;
676+
677+
/// This symbol is prone to change across releases upstream.
678+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
655679
pub const USER_RE_DUP_MAX: c_int = 9;
680+
656681
pub const USER_POSIX2_VERSION: c_int = 10;
657682
pub const USER_POSIX2_C_BIND: c_int = 11;
658683
pub const USER_POSIX2_C_DEV: c_int = 12;
@@ -1172,6 +1197,9 @@ pub const RTM_VERSION: c_int = 7;
11721197
pub const RTAX_MPLS1: c_int = 8;
11731198
pub const RTAX_MPLS2: c_int = 9;
11741199
pub const RTAX_MPLS3: c_int = 10;
1200+
1201+
/// This symbol is prone to change across releases upstream.
1202+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
11751203
pub const RTAX_MAX: c_int = 11;
11761204

11771205
const fn _CMSG_ALIGN(n: usize) -> usize {

0 commit comments

Comments
 (0)