Skip to content

Commit d8d00e9

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 f08bfce commit d8d00e9

28 files changed

Lines changed: 556 additions & 56 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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,24 @@ 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+
3135
pub const MAX_CANON: c_int = 255;
3236
pub const MAX_INPUT: c_int = 255;
37+
38+
/// This symbol is prone to change across releases upstream.
39+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
3340
pub const NAME_MAX: c_int = 255;
41+
3442
pub const OPEN_MAX: c_int = 20;
43+
44+
/// This symbol is prone to change across releases upstream.
45+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
3546
pub const PATH_MAX: c_int = 260;
47+
3648
pub const PIPE_BUF: c_int = 512;
3749
pub const STREAM_MAX: c_int = 20;
3850
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: 47 additions & 0 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,11 @@ 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+
14491457
pub const PAGESIZE: c_int = 4096;
14501458
pub const IOV_MAX: c_int = 16;
14511459
pub const AIO_LISTIO_MAX: c_int = 4096;
@@ -1454,14 +1462,37 @@ pub const OPEN_MAX: c_int = 65534;
14541462
pub const MAX_INPUT: c_int = 512;
14551463
pub const MAX_CANON: c_int = 256;
14561464
pub const ARG_MAX: c_int = 1048576;
1465+
1466+
/// This symbol is prone to change across releases upstream.
1467+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
14571468
pub const BC_BASE_MAX: c_int = 99;
1469+
1470+
/// This symbol is prone to change across releases upstream.
1471+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
14581472
pub const BC_DIM_MAX: c_int = 0x800;
1473+
1474+
/// This symbol is prone to change across releases upstream.
1475+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
14591476
pub const BC_SCALE_MAX: c_int = 99;
1477+
1478+
/// This symbol is prone to change across releases upstream.
1479+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
14601480
pub const BC_STRING_MAX: c_int = 0x800;
1481+
1482+
/// This symbol is prone to change across releases upstream.
1483+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
14611484
pub const CHARCLASS_NAME_MAX: c_int = 14;
1485+
14621486
pub const CHILD_MAX: c_int = 128;
1487+
1488+
/// This symbol is prone to change across releases upstream.
1489+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
14631490
pub const COLL_WEIGHTS_MAX: c_int = 4;
1491+
1492+
/// This symbol is prone to change across releases upstream.
1493+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
14641494
pub const EXPR_NEST_MAX: c_int = 32;
1495+
14651496
pub const NZERO: c_int = 20;
14661497

14671498
// sys/lockf.h
@@ -1541,7 +1572,11 @@ pub const MAXPATHLEN: c_int = PATH_MAX + 1;
15411572
pub const MAXSYMLINKS: c_int = 20;
15421573
pub const MAXHOSTNAMELEN: c_int = 256;
15431574
pub const MAXUPRC: c_int = 128;
1575+
1576+
/// This symbol is prone to change across releases upstream.
1577+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
15441578
pub const NGROUPS_MAX: c_ulong = 2048;
1579+
15451580
pub const NGROUPS: c_ulong = NGROUPS_MAX;
15461581
pub const NOFILE: c_int = OPEN_MAX;
15471582

@@ -1739,7 +1774,11 @@ pub const SIGXCPU: c_int = 24;
17391774
pub const SIGXFSZ: c_int = 25;
17401775
pub const SIGTRAP: c_int = 5;
17411776
pub const SIGCLD: c_int = 20;
1777+
1778+
/// This symbol is prone to change across releases upstream.
1779+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
17421780
pub const SIGRTMAX: c_int = 57;
1781+
17431782
pub const SIGRTMIN: c_int = 50;
17441783
pub const SI_USER: c_int = 0;
17451784
pub const SI_UNDEFINED: c_int = 8;
@@ -1817,7 +1856,11 @@ pub const AF_INET6: c_int = 24;
18171856
pub const AF_INTF: c_int = 20;
18181857
pub const AF_RIF: c_int = 21;
18191858
pub const AF_NDD: c_int = 23;
1859+
1860+
/// This symbol is prone to change across releases upstream.
1861+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
18201862
pub const AF_MAX: c_int = 30;
1863+
18211864
pub const PF_UNSPEC: c_int = AF_UNSPEC;
18221865
pub const PF_UNIX: c_int = AF_UNIX;
18231866
pub const PF_INET: c_int = AF_INET;
@@ -1843,7 +1886,11 @@ pub const PF_RIF: c_int = AF_RIF;
18431886
pub const PF_INTF: c_int = AF_INTF;
18441887
pub const PF_NDD: c_int = AF_NDD;
18451888
pub const PF_INET6: c_int = AF_INET6;
1889+
1890+
/// This symbol is prone to change across releases upstream.
1891+
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
18461892
pub const PF_MAX: c_int = AF_MAX;
1893+
18471894
pub const SF_CLOSE: c_int = 1;
18481895
pub const SF_REUSE: c_int = 2;
18491896
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)