Skip to content

Commit 0ac1028

Browse files
committed
uclibc: style fixes
1 parent 7775ce2 commit 0ac1028

File tree

8 files changed

+174
-184
lines changed

8 files changed

+174
-184
lines changed

libc-test/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2654,7 +2654,7 @@ fn test_linux(target: &str) {
26542654
| "CAN_J1939"
26552655
| "CAN_RAW_FILTER_MAX"
26562656
| "CAN_NPROTO" => true,
2657-
2657+
26582658
"MS_RMT_MASK" if uclibc => true, // updated in glibc 2.22 and musl 1.1.13
26592659

26602660
// FIXME: Requires recent kernel headers (5.8):

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

+13
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,19 @@ s! {
287287
__re_nsub: ::size_t,
288288
__bitfield: u8,
289289
}
290+
291+
pub struct Elf64_Chdr {
292+
pub ch_type: ::Elf64_Word,
293+
pub ch_reserved: ::Elf64_Word,
294+
pub ch_size: ::Elf64_Xword,
295+
pub ch_addralign: ::Elf64_Xword,
296+
}
297+
298+
pub struct Elf32_Chdr {
299+
pub ch_type: ::Elf32_Word,
300+
pub ch_size: ::Elf32_Word,
301+
pub ch_addralign: ::Elf32_Word,
302+
}
290303
}
291304

292305
impl siginfo_t {

src/unix/linux_like/linux/mod.rs

+77-114
Original file line numberDiff line numberDiff line change
@@ -525,25 +525,6 @@ s! {
525525
}
526526
}
527527

528-
cfg_if! {
529-
if #[cfg(not(target_env = "uclibc"))] {
530-
s! {
531-
pub struct Elf64_Chdr {
532-
pub ch_type: Elf64_Word,
533-
pub ch_reserved: Elf64_Word,
534-
pub ch_size: Elf64_Xword,
535-
pub ch_addralign: Elf64_Xword,
536-
}
537-
538-
pub struct Elf32_Chdr {
539-
pub ch_type: Elf32_Word,
540-
pub ch_size: Elf32_Word,
541-
pub ch_addralign: Elf32_Word,
542-
}
543-
}
544-
}
545-
}
546-
547528
s_no_extra_traits! {
548529
pub struct sockaddr_nl {
549530
pub nl_family: ::sa_family_t,
@@ -983,13 +964,7 @@ cfg_if! {
983964
}
984965
}
985966

986-
cfg_if! {
987-
if #[cfg(not(target_env = "uclibc"))] {
988-
pub const RUSAGE_THREAD: ::c_int = 1;
989-
}
990-
}
991967
pub const RUSAGE_CHILDREN: ::c_int = -1;
992-
993968
pub const L_tmpnam: ::c_uint = 20;
994969
pub const _PC_LINK_MAX: ::c_int = 0;
995970
pub const _PC_MAX_CANON: ::c_int = 1;
@@ -1323,8 +1298,6 @@ pub const RTLD_NOW: ::c_int = 0x2;
13231298
pub const AT_EACCESS: ::c_int = 0x200;
13241299

13251300
pub const TCP_MD5SIG: ::c_int = 14;
1326-
#[cfg(not(target_env = "uclibc"))]
1327-
pub const TCP_ULP: ::c_int = 31;
13281301

13291302
align_const! {
13301303
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
@@ -1386,17 +1359,13 @@ pub const MSG_INFO: ::c_int = 12;
13861359

13871360
pub const MSG_NOERROR: ::c_int = 0o10000;
13881361
pub const MSG_EXCEPT: ::c_int = 0o20000;
1389-
#[cfg(not(target_env = "uclibc"))]
1390-
pub const MSG_COPY: ::c_int = 0o40000;
13911362

13921363
pub const SHM_R: ::c_int = 0o400;
13931364
pub const SHM_W: ::c_int = 0o200;
13941365

13951366
pub const SHM_RDONLY: ::c_int = 0o10000;
13961367
pub const SHM_RND: ::c_int = 0o20000;
13971368
pub const SHM_REMAP: ::c_int = 0o40000;
1398-
#[cfg(not(target_env = "uclibc"))]
1399-
pub const SHM_EXEC: ::c_int = 0o100000;
14001369

14011370
pub const SHM_LOCK: ::c_int = 11;
14021371
pub const SHM_UNLOCK: ::c_int = 12;
@@ -1406,8 +1375,6 @@ pub const SHM_HUGETLB: ::c_int = 0o4000;
14061375
pub const SHM_NORESERVE: ::c_int = 0o10000;
14071376

14081377
pub const EPOLLRDHUP: ::c_int = 0x2000;
1409-
#[cfg(not(target_env = "uclibc"))]
1410-
pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
14111378
pub const EPOLLONESHOT: ::c_int = 0x40000000;
14121379

14131380
pub const QFMT_VFS_OLD: ::c_int = 1;
@@ -1469,6 +1436,16 @@ cfg_if! {
14691436
pub const LIO_NOP: ::c_int = 2;
14701437
pub const LIO_WAIT: ::c_int = 0;
14711438
pub const LIO_NOWAIT: ::c_int = 1;
1439+
pub const RUSAGE_THREAD: ::c_int = 1;
1440+
pub const TCP_ULP: ::c_int = 31;
1441+
pub const MSG_COPY: ::c_int = 0o40000;
1442+
pub const SHM_EXEC: ::c_int = 0o100000;
1443+
pub const IPV6_MULTICAST_ALL: ::c_int = 29;
1444+
pub const IPV6_ROUTER_ALERT_ISOLATE: ::c_int = 30;
1445+
pub const PACKET_MR_UNICAST: ::c_int = 3;
1446+
pub const PTRACE_EVENT_STOP: ::c_int = 128;
1447+
pub const UDP_SEGMENT: ::c_int = 103;
1448+
pub const UDP_GRO: ::c_int = 104;
14721449
}
14731450
}
14741451

@@ -1633,10 +1610,6 @@ pub const SO_ORIGINAL_DST: ::c_int = 80;
16331610
pub const IP_RECVFRAGSIZE: ::c_int = 25;
16341611

16351612
pub const IPV6_FLOWINFO: ::c_int = 11;
1636-
#[cfg(not(target_env = "uclibc"))]
1637-
pub const IPV6_MULTICAST_ALL: ::c_int = 29;
1638-
#[cfg(not(target_env = "uclibc"))]
1639-
pub const IPV6_ROUTER_ALERT_ISOLATE: ::c_int = 30;
16401613
pub const IPV6_FLOWLABEL_MGR: ::c_int = 32;
16411614
pub const IPV6_FLOWINFO_SEND: ::c_int = 33;
16421615
pub const IPV6_RECVFRAGSIZE: ::c_int = 77;
@@ -1967,8 +1940,6 @@ pub const PACKET_DROP_MEMBERSHIP: ::c_int = 2;
19671940
pub const PACKET_MR_MULTICAST: ::c_int = 0;
19681941
pub const PACKET_MR_PROMISC: ::c_int = 1;
19691942
pub const PACKET_MR_ALLMULTI: ::c_int = 2;
1970-
#[cfg(not(target_env = "uclibc"))]
1971-
pub const PACKET_MR_UNICAST: ::c_int = 3;
19721943

19731944
// linux/netfilter.h
19741945
pub const NF_DROP: ::c_int = 0;
@@ -2089,9 +2060,6 @@ pub const SIOCSRARP: ::c_ulong = 0x00008962;
20892060
pub const SIOCGIFMAP: ::c_ulong = 0x00008970;
20902061
pub const SIOCSIFMAP: ::c_ulong = 0x00008971;
20912062

2092-
#[cfg(not(target_env = "uclibc"))]
2093-
pub const PTRACE_EVENT_STOP: ::c_int = 128;
2094-
20952063
pub const IPTOS_TOS_MASK: u8 = 0x1E;
20962064
pub const IPTOS_PREC_MASK: u8 = 0xE0;
20972065

@@ -2394,10 +2362,6 @@ pub const UDP_CORK: ::c_int = 1;
23942362
pub const UDP_ENCAP: ::c_int = 100;
23952363
pub const UDP_NO_CHECK6_TX: ::c_int = 101;
23962364
pub const UDP_NO_CHECK6_RX: ::c_int = 102;
2397-
#[cfg(not(target_env = "uclibc"))]
2398-
pub const UDP_SEGMENT: ::c_int = 103;
2399-
#[cfg(not(target_env = "uclibc"))]
2400-
pub const UDP_GRO: ::c_int = 104;
24012365

24022366
// include/uapi/linux/mman.h
24032367
pub const MAP_SHARED_VALIDATE: ::c_int = 0x3;
@@ -2816,25 +2780,73 @@ f! {
28162780
}
28172781
}
28182782

2819-
#[cfg(not(target_env = "uclibc"))]
2820-
extern "C" {
2821-
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
2822-
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
2823-
pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
2824-
pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
2825-
pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
2826-
pub fn aio_suspend(
2827-
aiocb_list: *const *const aiocb,
2828-
nitems: ::c_int,
2829-
timeout: *const ::timespec,
2830-
) -> ::c_int;
2831-
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
2832-
pub fn lio_listio(
2833-
mode: ::c_int,
2834-
aiocb_list: *const *mut aiocb,
2835-
nitems: ::c_int,
2836-
sevp: *mut ::sigevent,
2837-
) -> ::c_int;
2783+
cfg_if! {
2784+
if #[cfg(not(target_env = "uclibc"))] {
2785+
extern "C" {
2786+
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
2787+
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
2788+
pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
2789+
pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
2790+
pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
2791+
pub fn aio_suspend(
2792+
aiocb_list: *const *const aiocb,
2793+
nitems: ::c_int,
2794+
timeout: *const ::timespec,
2795+
) -> ::c_int;
2796+
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
2797+
pub fn lio_listio(
2798+
mode: ::c_int,
2799+
aiocb_list: *const *mut aiocb,
2800+
nitems: ::c_int,
2801+
sevp: *mut ::sigevent,
2802+
) -> ::c_int;
2803+
pub fn pwritev(
2804+
fd: ::c_int,
2805+
iov: *const ::iovec,
2806+
iovcnt: ::c_int,
2807+
offset: ::off_t,
2808+
) -> ::ssize_t;
2809+
pub fn preadv(
2810+
fd: ::c_int,
2811+
iov: *const ::iovec,
2812+
iovcnt: ::c_int,
2813+
offset: ::off_t,
2814+
) -> ::ssize_t;
2815+
pub fn getnameinfo(
2816+
sa: *const ::sockaddr,
2817+
salen: ::socklen_t,
2818+
host: *mut ::c_char,
2819+
hostlen: ::socklen_t,
2820+
serv: *mut ::c_char,
2821+
sevlen: ::socklen_t,
2822+
flags: ::c_int,
2823+
) -> ::c_int;
2824+
pub fn getloadavg(
2825+
loadavg: *mut ::c_double,
2826+
nelem: ::c_int
2827+
) -> ::c_int;
2828+
pub fn process_vm_readv(
2829+
pid: ::pid_t,
2830+
local_iov: *const ::iovec,
2831+
liovcnt: ::c_ulong,
2832+
remote_iov: *const ::iovec,
2833+
riovcnt: ::c_ulong,
2834+
flags: ::c_ulong,
2835+
) -> isize;
2836+
pub fn process_vm_writev(
2837+
pid: ::pid_t,
2838+
local_iov: *const ::iovec,
2839+
liovcnt: ::c_ulong,
2840+
remote_iov: *const ::iovec,
2841+
riovcnt: ::c_ulong,
2842+
flags: ::c_ulong,
2843+
) -> isize;
2844+
pub fn futimes(
2845+
fd: ::c_int,
2846+
times: *const ::timeval
2847+
) -> ::c_int;
2848+
}
2849+
}
28382850
}
28392851

28402852
extern "C" {
@@ -3049,20 +3061,6 @@ extern "C" {
30493061
new_value: *const itimerspec,
30503062
old_value: *mut itimerspec,
30513063
) -> ::c_int;
3052-
#[cfg(not(target_env = "uclibc"))]
3053-
pub fn pwritev(
3054-
fd: ::c_int,
3055-
iov: *const ::iovec,
3056-
iovcnt: ::c_int,
3057-
offset: ::off_t,
3058-
) -> ::ssize_t;
3059-
#[cfg(not(target_env = "uclibc"))]
3060-
pub fn preadv(
3061-
fd: ::c_int,
3062-
iov: *const ::iovec,
3063-
iovcnt: ::c_int,
3064-
offset: ::off_t,
3065-
) -> ::ssize_t;
30663064
pub fn quotactl(
30673065
cmd: ::c_int,
30683066
special: *const ::c_char,
@@ -3132,43 +3130,10 @@ extern "C" {
31323130
len: *mut ::socklen_t,
31333131
flg: ::c_int,
31343132
) -> ::c_int;
3135-
#[cfg(not(target_env = "uclibc"))]
3136-
pub fn getnameinfo(
3137-
sa: *const ::sockaddr,
3138-
salen: ::socklen_t,
3139-
host: *mut ::c_char,
3140-
hostlen: ::socklen_t,
3141-
serv: *mut ::c_char,
3142-
sevlen: ::socklen_t,
3143-
flags: ::c_int,
3144-
) -> ::c_int;
31453133
pub fn pthread_setschedprio(
31463134
native: ::pthread_t,
31473135
priority: ::c_int,
31483136
) -> ::c_int;
3149-
#[cfg(not(target_env = "uclibc"))]
3150-
pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
3151-
3152-
#[cfg(not(target_env = "uclibc"))]
3153-
pub fn process_vm_readv(
3154-
pid: ::pid_t,
3155-
local_iov: *const ::iovec,
3156-
liovcnt: ::c_ulong,
3157-
remote_iov: *const ::iovec,
3158-
riovcnt: ::c_ulong,
3159-
flags: ::c_ulong,
3160-
) -> isize;
3161-
3162-
#[cfg(not(target_env = "uclibc"))]
3163-
pub fn process_vm_writev(
3164-
pid: ::pid_t,
3165-
local_iov: *const ::iovec,
3166-
liovcnt: ::c_ulong,
3167-
remote_iov: *const ::iovec,
3168-
riovcnt: ::c_ulong,
3169-
flags: ::c_ulong,
3170-
) -> isize;
3171-
31723137
pub fn reboot(how_to: ::c_int) -> ::c_int;
31733138
pub fn setfsgid(gid: ::gid_t) -> ::c_int;
31743139
pub fn setfsuid(uid: ::uid_t) -> ::c_int;
@@ -3244,8 +3209,6 @@ extern "C" {
32443209
) -> ::ssize_t;
32453210
pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
32463211

3247-
#[cfg(not(target_env = "uclibc"))]
3248-
pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
32493212
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
32503213

32513214
pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;

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

+13
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,19 @@ s! {
236236
pub e_termination: ::c_short,
237237
pub e_exit: ::c_short,
238238
}
239+
240+
pub struct Elf64_Chdr {
241+
pub ch_type: ::Elf64_Word,
242+
pub ch_reserved: ::Elf64_Word,
243+
pub ch_size: ::Elf64_Xword,
244+
pub ch_addralign: ::Elf64_Xword,
245+
}
246+
247+
pub struct Elf32_Chdr {
248+
pub ch_type: ::Elf32_Word,
249+
pub ch_size: ::Elf32_Word,
250+
pub ch_addralign: ::Elf32_Word,
251+
}
239252
}
240253

241254
s_no_extra_traits! {

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

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub type __u64 = ::c_ulonglong;
1717
pub type fsblkcnt64_t = u64;
1818
pub type fsfilcnt64_t = u64;
1919

20-
2120
s! {
2221
pub struct stat {
2322
pub st_dev: ::dev_t,

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

-2
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ pub const POLLWRBAND: ::c_short = 0x100;
254254

255255
pub const PTHREAD_STACK_MIN: ::size_t = 16384;
256256

257-
258257
pub const VEOF: usize = 16;
259258
pub const VEOL: usize = 17;
260259
pub const VEOL2: usize = 6;
@@ -268,7 +267,6 @@ pub const TCSAFLUSH: ::c_int = 0x5410;
268267

269268
pub const CPU_SETSIZE: ::c_int = 0x400;
270269

271-
272270
pub const EFD_NONBLOCK: ::c_int = 0x80;
273271

274272
pub const F_GETLK: ::c_int = 14;

0 commit comments

Comments
 (0)