Skip to content

Commit 0d87e07

Browse files
committed
uclibc: add symbols defined in 1.0.34
1 parent 4490988 commit 0d87e07

File tree

5 files changed

+196
-34
lines changed

5 files changed

+196
-34
lines changed

libc-test/build.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2847,19 +2847,33 @@ fn test_linux(target: &str) {
28472847
if mips || ppc64 || riscv64 || sparc64 => true,
28482848

28492849
// kernel constants not available in uclibc 1.0.34
2850+
| "ADDR_COMPAT_LAYOUT"
2851+
| "ADDR_LIMIT_3GB"
2852+
| "ADDR_NO_RANDOMIZE"
2853+
| "CLONE_NEWCGROUP"
2854+
| "EXTPROC"
2855+
| "FAN_MARK_FILESYSTEM"
2856+
| "FAN_MARK_INODE"
28502857
| "IPPROTO_BEETPH"
28512858
| "IPPROTO_MPLS"
2852-
| "PTRACE_O_SUSPEND_SECCOMP"
28532859
| "IPV6_HDRINCL"
2860+
| "IPV6_MULTICAST_ALL"
28542861
| "IPV6_PMTUDISC_INTERFACE"
28552862
| "IPV6_PMTUDISC_OMIT"
2856-
| "CLONE_NEWCGROUP"
2857-
| "ADDR_NO_RANDOMIZE"
2858-
| "ADDR_COMPAT_LAYOUT"
2859-
| "READ_IMPLIES_EXEC"
2860-
| "ADDR_LIMIT_3GB"
2863+
| "IPV6_ROUTER_ALERT_ISOLATE"
2864+
| "O_TMPFILE"
2865+
| "PACKET_MR_UNICAST"
2866+
| "PTRACE_EVENT_STOP"
28612867
| "PTRACE_O_EXITKILL"
2862-
| "PTRACE_O_SUSPEND_SECCOM" if uclibc => true,
2868+
| "PTRACE_O_SUSPEND_SECCOM"
2869+
| "PTRACE_O_SUSPEND_SECCOMP"
2870+
| "PTRACE_PEEKSIGINFO"
2871+
| "READ_IMPLIES_EXEC"
2872+
| "RUSAGE_THREAD"
2873+
| "SHM_EXEC"
2874+
| "UDP_GRO"
2875+
| "UDP_SEGMENT"
2876+
if uclibc => true,
28632877

28642878
_ => false,
28652879
}

src/unix/linux_like/linux/uclibc/arm/mod.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ s! {
6161
pub st_mtime_nsec: ::c_long,
6262
pub st_ctime: ::time_t,
6363
pub st_ctime_nsec: ::c_long,
64-
pub __uclibc_unused4: ::c_ulong,
65-
pub __uclibc_unused5: ::c_ulong,
64+
pub __unused4: ::c_ulong,
65+
pub __unused5: ::c_ulong,
6666
}
6767

6868
pub struct stat64
@@ -205,41 +205,41 @@ s! {
205205
pub __pad1: ::c_ushort,
206206
pub __seq: ::c_ushort,
207207
pub __pad2: ::c_ushort,
208-
pub __uclibc_unused1: ::c_ulong,
209-
pub __uclibc_unused2: ::c_ulong,
208+
pub __unused1: ::c_ulong,
209+
pub __unused2: ::c_ulong,
210210
}
211211

212212
pub struct msqid_ds {
213213
pub msg_perm: ::ipc_perm,
214214
pub msg_stime: ::time_t,
215-
pub __uclibc_unused1: ::c_ulong,
215+
pub __unused1: ::c_ulong,
216216
pub msg_rtime: ::time_t,
217-
pub __uclibc_unused2: ::c_ulong,
217+
pub __unused2: ::c_ulong,
218218
pub msg_ctime: ::time_t,
219-
pub __uclibc_unused3: ::c_ulong,
219+
pub __unused3: ::c_ulong,
220220
pub __msg_cbytes: ::c_ulong,
221221
pub msg_qnum: ::msgqnum_t,
222222
pub msg_qbytes: ::msglen_t,
223223
pub msg_lspid: ::pid_t,
224224
pub msg_lrpid: ::pid_t,
225-
pub __uclibc_unused4: ::c_ulong,
226-
pub __uclibc_unused5: ::c_ulong,
225+
pub __unused4: ::c_ulong,
226+
pub __unused5: ::c_ulong,
227227
}
228228

229229
pub struct shmid_ds {
230230
pub shm_perm: ::ipc_perm,
231231
pub shm_segsz: ::size_t,
232232
pub shm_atime: ::time_t,
233-
pub __uclibc_unused1: ::c_ulong,
233+
pub __unused1: ::c_ulong,
234234
pub shm_dtime: ::time_t,
235-
pub __uclibc_unused2: ::c_ulong,
235+
pub __unused2: ::c_ulong,
236236
pub shm_ctime: ::time_t,
237-
pub __uclibc_unused3: ::c_ulong,
237+
pub __unused3: ::c_ulong,
238238
pub shm_cpid: ::pid_t,
239239
pub shm_lpid: ::pid_t,
240240
pub shm_nattch: ::shmatt_t,
241-
pub __uclibc_unused4: ::c_ulong,
242-
pub __uclibc_unused5: ::c_ulong,
241+
pub __unused4: ::c_ulong,
242+
pub __unused5: ::c_ulong,
243243
}
244244
}
245245

@@ -469,6 +469,7 @@ pub const PENDIN: ::tcflag_t = 0x4000;
469469
pub const POLLWRBAND: ::c_short = 0x200;
470470
pub const POLLWRNORM: ::c_short = 0x100;
471471
pub const PTHREAD_STACK_MIN: ::size_t = 16384;
472+
pub const RTLD_GLOBAL: ::c_int = 0x00100;
472473

473474
// These are typed unsigned to match sigaction
474475
pub const SA_NOCLDSTOP: ::c_ulong = 0x1;
@@ -516,6 +517,8 @@ pub const TABDLY: ::c_int = 0x1800;
516517
pub const TCSADRAIN: ::c_int = 0x1;
517518
pub const TCSAFLUSH: ::c_int = 0x2;
518519
pub const TCSANOW: ::c_int = 0;
520+
pub const TIOCGWINSZ: ::c_int = 0x5413;
521+
pub const TIOCSWINSZ: ::c_int = 0x5414;
519522
pub const TOSTOP: ::tcflag_t = 0x100;
520523
pub const VDISCARD: usize = 0xd;
521524
pub const VEOF: usize = 0x4;
@@ -886,6 +889,9 @@ pub const SYS_pwritev2: ::c_long = 393;
886889
pub const SYS_pkey_mprotect: ::c_long = 394;
887890
pub const SYS_pkey_alloc: ::c_long = 395;
888891
pub const SYS_pkey_free: ::c_long = 396;
892+
pub const SYS_statx: ::c_int = 397;
893+
pub const SYS_pidfd_open: ::c_long = 434;
894+
pub const SYS_clone3: ::c_long = 435;
889895

890896
extern "C" {
891897
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;

src/unix/linux_like/linux/uclibc/mips/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ pub const O_ACCMODE: ::c_int = 3;
4141
pub const O_DIRECT: ::c_int = 0x8000;
4242
pub const O_DIRECTORY: ::c_int = 0x10000;
4343
pub const O_NOFOLLOW: ::c_int = 0x20000;
44-
pub const NI_MAXHOST: ::socklen_t = 1025;
4544

4645
pub const RLIMIT_NOFILE: ::c_int = 5;
4746
pub const RLIMIT_AS: ::c_int = 6;

src/unix/linux_like/linux/uclibc/mod.rs

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ pub type shmatt_t = ::c_ulong;
22
pub type msgqnum_t = ::c_ulong;
33
pub type msglen_t = ::c_ulong;
44
pub type regoff_t = ::c_int;
5+
pub type __rlimit_resource_t = ::c_uint;
6+
pub type __priority_which_t = ::c_uint;
57

68
s! {
79
pub struct statvfs { // Different than GNU!
@@ -34,6 +36,32 @@ s! {
3436
__re_nsub: ::size_t,
3537
__bitfield: u8,
3638
}
39+
40+
pub struct rtentry {
41+
pub rt_pad1: ::c_ulong,
42+
pub rt_dst: ::sockaddr,
43+
pub rt_gateway: ::sockaddr,
44+
pub rt_genmask: ::sockaddr,
45+
pub rt_flags: ::c_ushort,
46+
pub rt_pad2: ::c_short,
47+
pub rt_pad3: ::c_ulong,
48+
pub rt_tos: ::c_uchar,
49+
pub rt_class: ::c_uchar,
50+
#[cfg(target_pointer_width = "64")]
51+
pub rt_pad4: [::c_short; 3usize],
52+
#[cfg(not(target_pointer_width = "64"))]
53+
pub rt_pad4: ::c_short,
54+
pub rt_metric: ::c_short,
55+
pub rt_dev: *mut ::c_char,
56+
pub rt_mtu: ::c_ulong,
57+
pub rt_window: ::c_ulong,
58+
pub rt_irtt: ::c_ushort,
59+
}
60+
61+
pub struct __exit_status {
62+
pub e_termination: ::c_short,
63+
pub e_exit: ::c_short,
64+
}
3765
}
3866

3967
pub const MCL_CURRENT: ::c_int = 0x0001;
@@ -223,6 +251,108 @@ pub const PRIO_USER: ::c_int = 2;
223251

224252
pub const ST_RELATIME: ::c_ulong = 4096;
225253

254+
pub const AF_NFC: ::c_int = PF_NFC;
255+
pub const BUFSIZ: ::c_int = 4096;
256+
pub const EDEADLOCK: ::c_int = EDEADLK;
257+
pub const EXTA: ::c_uint = B19200;
258+
pub const EXTB: ::c_uint = B38400;
259+
pub const EXTPROC: ::c_int = 0200000;
260+
pub const FAN_MARK_FILESYSTEM: ::c_int = 0x00000100;
261+
pub const FAN_MARK_INODE: ::c_int = 0x00000000;
262+
pub const FAN_MARK_MOUNT: ::c_int = 0x10;
263+
pub const FIONREAD: ::c_int = 0x541B;
264+
pub const FOPEN_MAX: ::c_int = 16;
265+
pub const F_GETOWN: ::c_int = 9;
266+
pub const F_OFD_GETLK: ::c_int = 36;
267+
pub const F_OFD_SETLK: ::c_int = 37;
268+
pub const F_OFD_SETLKW: ::c_int = 38;
269+
pub const F_RDLCK: ::c_int = 0;
270+
pub const F_SETOWN: ::c_int = 8;
271+
pub const F_UNLCK: ::c_int = 2;
272+
pub const F_WRLCK: ::c_int = 1;
273+
pub const IPV6_MULTICAST_ALL: ::c_int = 29;
274+
pub const IPV6_ROUTER_ALERT_ISOLATE: ::c_int = 30;
275+
pub const MAP_HUGE_SHIFT: ::c_int = 26;
276+
pub const MAP_HUGE_MASK: ::c_int = 0x3f;
277+
pub const MAP_HUGE_64KB: ::c_int = 16 << MAP_HUGE_SHIFT;
278+
pub const MAP_HUGE_512KB: ::c_int = 19 << MAP_HUGE_SHIFT;
279+
pub const MAP_HUGE_1MB: ::c_int = 20 << MAP_HUGE_SHIFT;
280+
pub const MAP_HUGE_2MB: ::c_int = 21 << MAP_HUGE_SHIFT;
281+
pub const MAP_HUGE_8MB: ::c_int = 23 << MAP_HUGE_SHIFT;
282+
pub const MAP_HUGE_16MB: ::c_int = 24 << MAP_HUGE_SHIFT;
283+
pub const MAP_HUGE_32MB: ::c_int = 25 << MAP_HUGE_SHIFT;
284+
pub const MAP_HUGE_256MB: ::c_int = 28 << MAP_HUGE_SHIFT;
285+
pub const MAP_HUGE_512MB: ::c_int = 29 << MAP_HUGE_SHIFT;
286+
pub const MAP_HUGE_1GB: ::c_int = 30 << MAP_HUGE_SHIFT;
287+
pub const MAP_HUGE_2GB: ::c_int = 31 << MAP_HUGE_SHIFT;
288+
pub const MAP_HUGE_16GB: ::c_int = 34 << MAP_HUGE_SHIFT;
289+
pub const MINSIGSTKSZ: ::c_int = 2048;
290+
pub const MSG_COPY: ::c_int = 040000;
291+
pub const NI_MAXHOST: ::socklen_t = 1025;
292+
pub const O_TMPFILE: ::c_int = 020000000 | O_DIRECTORY;
293+
pub const PACKET_MR_UNICAST: ::c_int = 3;
294+
pub const PF_NFC: ::c_int = 39;
295+
pub const PF_VSOCK: ::c_int = 40;
296+
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
297+
pub const PTRACE_EVENT_STOP: ::c_int = 128;
298+
pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
299+
pub const RLIMIT_AS: ::c_int = 9;
300+
pub const RLIMIT_MEMLOCK: ::c_int = 8;
301+
pub const RLIMIT_NLIMITS: ::c_int = 15;
302+
pub const RLIMIT_NOFILE: ::c_int = 7;
303+
pub const RLIMIT_NPROC: ::c_int = 6;
304+
pub const RLIMIT_RSS: ::c_int = 5;
305+
pub const RLIMIT_RTTIME: ::c_int = 15;
306+
pub const RTLD_NOLOAD: ::c_int = 0x00004;
307+
pub const RUSAGE_THREAD: ::c_int = 1;
308+
pub const SHM_EXEC: ::c_int = 0100000;
309+
pub const SIGPOLL: ::c_int = SIGIO;
310+
pub const SOCK_DCCP: ::c_int = 6;
311+
pub const SOCK_PACKET: ::c_int = 10;
312+
pub const TCFLSH: ::c_int = 0x540B;
313+
pub const TCGETA: ::c_int = 0x5405;
314+
pub const TCGETS: ::c_int = 0x5401;
315+
pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15;
316+
pub const TCSBRK: ::c_int = 0x5409;
317+
pub const TCSETA: ::c_int = 0x5406;
318+
pub const TCSETAF: ::c_int = 0x5408;
319+
pub const TCSETAW: ::c_int = 0x5407;
320+
pub const TCSETS: ::c_int = 0x5402;
321+
pub const TCSETSF: ::c_int = 0x5404;
322+
pub const TCSETSW: ::c_int = 0x5403;
323+
pub const TCXONC: ::c_int = 0x540A;
324+
pub const TIOCCONS: ::c_int = 0x541D;
325+
pub const TIOCEXCL: ::c_int = 0x540C;
326+
pub const TIOCGPGRP: ::c_int = 0x540F;
327+
pub const TIOCGSERIAL: ::c_int = 0x541E;
328+
pub const TIOCGSOFTCAR: ::c_int = 0x5419;
329+
pub const TIOCINQ: ::c_int = FIONREAD;
330+
pub const TIOCLINUX: ::c_int = 0x541C;
331+
pub const TIOCMBIC: ::c_int = 0x5417;
332+
pub const TIOCMGET: ::c_int = 0x5415;
333+
pub const TIOCMBIS: ::c_int = 0x5416;
334+
pub const TIOCMSET: ::c_int = 0x5418;
335+
pub const TIOCM_CAR: ::c_int = 0x040;
336+
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
337+
pub const TIOCM_CTS: ::c_int = 0x020;
338+
pub const TIOCM_DSR: ::c_int = 0x100;
339+
pub const TIOCM_DTR: ::c_int = 0x002;
340+
pub const TIOCM_LE: ::c_int = 0x001;
341+
pub const TIOCM_RI: ::c_int = TIOCM_RNG;
342+
pub const TIOCM_RNG: ::c_int = 0x080;
343+
pub const TIOCM_RTS: ::c_int = 0x004;
344+
pub const TIOCM_SR: ::c_int = 0x010;
345+
pub const TIOCM_ST: ::c_int = 0x008;
346+
pub const TIOCNXCL: ::c_int = 0x540D;
347+
pub const TIOCOUTQ: ::c_int = 0x5411;
348+
pub const TIOCSCTTY: ::c_int = 0x540E;
349+
pub const TIOCSPGRP: ::c_int = 0x5410;
350+
pub const TIOCSSOFTCAR: ::c_int = 0x541A;
351+
pub const TIOCSTI: ::c_int = 0x5412;
352+
pub const UDP_GRO: ::c_int = 104;
353+
pub const UDP_SEGMENT: ::c_int = 103;
354+
pub const YESEXPR: ::c_int = ((5) << 8) | (0);
355+
226356
extern "C" {
227357
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
228358

@@ -289,6 +419,19 @@ extern "C" {
289419
) -> ::ssize_t;
290420

291421
pub fn sethostid(hostid: ::c_long) -> ::c_int;
422+
pub fn fanotify_mark(
423+
fd: ::c_int,
424+
flags: ::c_uint,
425+
mask: u64,
426+
dirfd: ::c_int,
427+
path: *const ::c_char,
428+
) -> ::c_int;
429+
pub fn getrlimit64(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit64) -> ::c_int;
430+
pub fn setrlimit64(resource: ::__rlimit_resource_t, rlim: *const ::rlimit64) -> ::c_int;
431+
pub fn getrlimit(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit) -> ::c_int;
432+
pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int;
433+
pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int;
434+
pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int;
292435
}
293436

294437
cfg_if! {

src/unix/linux_like/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,8 @@ pub const IPPROTO_MH: ::c_int = 135;
877877
pub const IPPROTO_UDPLITE: ::c_int = 136;
878878
/// raw IP packet
879879
pub const IPPROTO_RAW: ::c_int = 255;
880+
pub const IPPROTO_BEETPH: ::c_int = 94;
881+
pub const IPPROTO_MPLS: ::c_int = 137;
880882

881883
pub const MCAST_EXCLUDE: ::c_int = 0;
882884
pub const MCAST_INCLUDE: ::c_int = 1;
@@ -913,6 +915,7 @@ pub const IPV6_JOIN_ANYCAST: ::c_int = 27;
913915
pub const IPV6_LEAVE_ANYCAST: ::c_int = 28;
914916
pub const IPV6_IPSEC_POLICY: ::c_int = 34;
915917
pub const IPV6_XFRM_POLICY: ::c_int = 35;
918+
pub const IPV6_HDRINCL: ::c_int = 36;
916919
pub const IPV6_RECVPKTINFO: ::c_int = 49;
917920
pub const IPV6_PKTINFO: ::c_int = 50;
918921
pub const IPV6_RECVHOPLIMIT: ::c_int = 51;
@@ -948,6 +951,8 @@ pub const IPV6_PMTUDISC_DONT: ::c_int = 0;
948951
pub const IPV6_PMTUDISC_WANT: ::c_int = 1;
949952
pub const IPV6_PMTUDISC_DO: ::c_int = 2;
950953
pub const IPV6_PMTUDISC_PROBE: ::c_int = 3;
954+
pub const IPV6_PMTUDISC_INTERFACE: ::c_int = 4;
955+
pub const IPV6_PMTUDISC_OMIT: ::c_int = 5;
951956

952957
pub const TCP_NODELAY: ::c_int = 1;
953958
pub const TCP_MAXSEG: ::c_int = 2;
@@ -1117,6 +1122,7 @@ pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000;
11171122
pub const CLONE_DETACHED: ::c_int = 0x400000;
11181123
pub const CLONE_UNTRACED: ::c_int = 0x800000;
11191124
pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
1125+
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
11201126
pub const CLONE_NEWUTS: ::c_int = 0x04000000;
11211127
pub const CLONE_NEWIPC: ::c_int = 0x08000000;
11221128
pub const CLONE_NEWUSER: ::c_int = 0x10000000;
@@ -1132,11 +1138,15 @@ pub const WCONTINUED: ::c_int = 0x00000008;
11321138
pub const WNOWAIT: ::c_int = 0x01000000;
11331139

11341140
// Options for personality(2).
1141+
pub const ADDR_NO_RANDOMIZE: ::c_int = 0x0040000;
11351142
pub const MMAP_PAGE_ZERO: ::c_int = 0x0100000;
1143+
pub const ADDR_COMPAT_LAYOUT: ::c_int = 0x0200000;
1144+
pub const READ_IMPLIES_EXEC: ::c_int = 0x0400000;
11361145
pub const ADDR_LIMIT_32BIT: ::c_int = 0x0800000;
11371146
pub const SHORT_INODE: ::c_int = 0x1000000;
11381147
pub const WHOLE_SECONDS: ::c_int = 0x2000000;
11391148
pub const STICKY_TIMEOUTS: ::c_int = 0x4000000;
1149+
pub const ADDR_LIMIT_3GB: ::c_int = 0x8000000;
11401150

11411151
// Options set using PTRACE_SETOPTIONS.
11421152
pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001;
@@ -1147,6 +1157,8 @@ pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010;
11471157
pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020;
11481158
pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040;
11491159
pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080;
1160+
pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000;
1161+
pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000;
11501162

11511163
// Wait extended result codes for the above trace options.
11521164
pub const PTRACE_EVENT_FORK: ::c_int = 1;
@@ -1346,18 +1358,6 @@ pub const ARPHRD_NONE: u16 = 0xFFFE;
13461358

13471359
cfg_if! {
13481360
if #[cfg(not(target_env = "uclibc"))] {
1349-
pub const IPPROTO_BEETPH: ::c_int = 94;
1350-
pub const IPPROTO_MPLS: ::c_int = 137;
1351-
pub const IPV6_HDRINCL: ::c_int = 36;
1352-
pub const IPV6_PMTUDISC_INTERFACE: ::c_int = 4;
1353-
pub const IPV6_PMTUDISC_OMIT: ::c_int = 5;
1354-
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
1355-
pub const ADDR_NO_RANDOMIZE: ::c_int = 0x0040000;
1356-
pub const ADDR_COMPAT_LAYOUT: ::c_int = 0x0200000;
1357-
pub const READ_IMPLIES_EXEC: ::c_int = 0x0400000;
1358-
pub const ADDR_LIMIT_3GB: ::c_int = 0x8000000;
1359-
pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000;
1360-
pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000;
13611361
pub const PTRACE_O_MASK: ::c_int = 0x003000ff;
13621362
}
13631363
}

0 commit comments

Comments
 (0)