Skip to content

Commit ee13a88

Browse files
committed
uclibc: style fixes
1 parent 316a7fc commit ee13a88

File tree

8 files changed

+174
-184
lines changed

8 files changed

+174
-184
lines changed

libc-test/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2640,7 +2640,7 @@ fn test_linux(target: &str) {
26402640
| "CAN_J1939"
26412641
| "CAN_RAW_FILTER_MAX"
26422642
| "CAN_NPROTO" => true,
2643-
2643+
26442644
"MS_RMT_MASK" if uclibc => true, // updated in glibc 2.22 and musl 1.1.13
26452645

26462646
_ => false,

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,19 @@ s! {
285285
__re_nsub: ::size_t,
286286
__bitfield: u8,
287287
}
288+
289+
pub struct Elf64_Chdr {
290+
pub ch_type: ::Elf64_Word,
291+
pub ch_reserved: ::Elf64_Word,
292+
pub ch_size: ::Elf64_Xword,
293+
pub ch_addralign: ::Elf64_Xword,
294+
}
295+
296+
pub struct Elf32_Chdr {
297+
pub ch_type: ::Elf32_Word,
298+
pub ch_size: ::Elf32_Word,
299+
pub ch_addralign: ::Elf32_Word,
300+
}
288301
}
289302

290303
impl siginfo_t {

src/unix/linux_like/linux/mod.rs

Lines changed: 77 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -523,25 +523,6 @@ s! {
523523
}
524524
}
525525

526-
cfg_if! {
527-
if #[cfg(not(target_env = "uclibc"))] {
528-
s! {
529-
pub struct Elf64_Chdr {
530-
pub ch_type: Elf64_Word,
531-
pub ch_reserved: Elf64_Word,
532-
pub ch_size: Elf64_Xword,
533-
pub ch_addralign: Elf64_Xword,
534-
}
535-
536-
pub struct Elf32_Chdr {
537-
pub ch_type: Elf32_Word,
538-
pub ch_size: Elf32_Word,
539-
pub ch_addralign: Elf32_Word,
540-
}
541-
}
542-
}
543-
}
544-
545526
s_no_extra_traits! {
546527
pub struct sockaddr_nl {
547528
pub nl_family: ::sa_family_t,
@@ -981,13 +962,7 @@ cfg_if! {
981962
}
982963
}
983964

984-
cfg_if! {
985-
if #[cfg(not(target_env = "uclibc"))] {
986-
pub const RUSAGE_THREAD: ::c_int = 1;
987-
}
988-
}
989965
pub const RUSAGE_CHILDREN: ::c_int = -1;
990-
991966
pub const L_tmpnam: ::c_uint = 20;
992967
pub const _PC_LINK_MAX: ::c_int = 0;
993968
pub const _PC_MAX_CANON: ::c_int = 1;
@@ -1321,8 +1296,6 @@ pub const RTLD_NOW: ::c_int = 0x2;
13211296
pub const AT_EACCESS: ::c_int = 0x200;
13221297

13231298
pub const TCP_MD5SIG: ::c_int = 14;
1324-
#[cfg(not(target_env = "uclibc"))]
1325-
pub const TCP_ULP: ::c_int = 31;
13261299

13271300
align_const! {
13281301
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
@@ -1384,17 +1357,13 @@ pub const MSG_INFO: ::c_int = 12;
13841357

13851358
pub const MSG_NOERROR: ::c_int = 0o10000;
13861359
pub const MSG_EXCEPT: ::c_int = 0o20000;
1387-
#[cfg(not(target_env = "uclibc"))]
1388-
pub const MSG_COPY: ::c_int = 0o40000;
13891360

13901361
pub const SHM_R: ::c_int = 0o400;
13911362
pub const SHM_W: ::c_int = 0o200;
13921363

13931364
pub const SHM_RDONLY: ::c_int = 0o10000;
13941365
pub const SHM_RND: ::c_int = 0o20000;
13951366
pub const SHM_REMAP: ::c_int = 0o40000;
1396-
#[cfg(not(target_env = "uclibc"))]
1397-
pub const SHM_EXEC: ::c_int = 0o100000;
13981367

13991368
pub const SHM_LOCK: ::c_int = 11;
14001369
pub const SHM_UNLOCK: ::c_int = 12;
@@ -1404,8 +1373,6 @@ pub const SHM_HUGETLB: ::c_int = 0o4000;
14041373
pub const SHM_NORESERVE: ::c_int = 0o10000;
14051374

14061375
pub const EPOLLRDHUP: ::c_int = 0x2000;
1407-
#[cfg(not(target_env = "uclibc"))]
1408-
pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
14091376
pub const EPOLLONESHOT: ::c_int = 0x40000000;
14101377

14111378
pub const QFMT_VFS_OLD: ::c_int = 1;
@@ -1467,6 +1434,16 @@ cfg_if! {
14671434
pub const LIO_NOP: ::c_int = 2;
14681435
pub const LIO_WAIT: ::c_int = 0;
14691436
pub const LIO_NOWAIT: ::c_int = 1;
1437+
pub const RUSAGE_THREAD: ::c_int = 1;
1438+
pub const TCP_ULP: ::c_int = 31;
1439+
pub const MSG_COPY: ::c_int = 0o40000;
1440+
pub const SHM_EXEC: ::c_int = 0o100000;
1441+
pub const IPV6_MULTICAST_ALL: ::c_int = 29;
1442+
pub const IPV6_ROUTER_ALERT_ISOLATE: ::c_int = 30;
1443+
pub const PACKET_MR_UNICAST: ::c_int = 3;
1444+
pub const PTRACE_EVENT_STOP: ::c_int = 128;
1445+
pub const UDP_SEGMENT: ::c_int = 103;
1446+
pub const UDP_GRO: ::c_int = 104;
14701447
}
14711448
}
14721449

@@ -1631,10 +1608,6 @@ pub const SO_ORIGINAL_DST: ::c_int = 80;
16311608
pub const IP_RECVFRAGSIZE: ::c_int = 25;
16321609

16331610
pub const IPV6_FLOWINFO: ::c_int = 11;
1634-
#[cfg(not(target_env = "uclibc"))]
1635-
pub const IPV6_MULTICAST_ALL: ::c_int = 29;
1636-
#[cfg(not(target_env = "uclibc"))]
1637-
pub const IPV6_ROUTER_ALERT_ISOLATE: ::c_int = 30;
16381611
pub const IPV6_FLOWLABEL_MGR: ::c_int = 32;
16391612
pub const IPV6_FLOWINFO_SEND: ::c_int = 33;
16401613
pub const IPV6_RECVFRAGSIZE: ::c_int = 77;
@@ -1965,8 +1938,6 @@ pub const PACKET_DROP_MEMBERSHIP: ::c_int = 2;
19651938
pub const PACKET_MR_MULTICAST: ::c_int = 0;
19661939
pub const PACKET_MR_PROMISC: ::c_int = 1;
19671940
pub const PACKET_MR_ALLMULTI: ::c_int = 2;
1968-
#[cfg(not(target_env = "uclibc"))]
1969-
pub const PACKET_MR_UNICAST: ::c_int = 3;
19701941

19711942
// linux/netfilter.h
19721943
pub const NF_DROP: ::c_int = 0;
@@ -2087,9 +2058,6 @@ pub const SIOCSRARP: ::c_ulong = 0x00008962;
20872058
pub const SIOCGIFMAP: ::c_ulong = 0x00008970;
20882059
pub const SIOCSIFMAP: ::c_ulong = 0x00008971;
20892060

2090-
#[cfg(not(target_env = "uclibc"))]
2091-
pub const PTRACE_EVENT_STOP: ::c_int = 128;
2092-
20932061
pub const IPTOS_TOS_MASK: u8 = 0x1E;
20942062
pub const IPTOS_PREC_MASK: u8 = 0xE0;
20952063

@@ -2392,10 +2360,6 @@ pub const UDP_CORK: ::c_int = 1;
23922360
pub const UDP_ENCAP: ::c_int = 100;
23932361
pub const UDP_NO_CHECK6_TX: ::c_int = 101;
23942362
pub const UDP_NO_CHECK6_RX: ::c_int = 102;
2395-
#[cfg(not(target_env = "uclibc"))]
2396-
pub const UDP_SEGMENT: ::c_int = 103;
2397-
#[cfg(not(target_env = "uclibc"))]
2398-
pub const UDP_GRO: ::c_int = 104;
23992363

24002364
// include/uapi/linux/mman.h
24012365
pub const MAP_SHARED_VALIDATE: ::c_int = 0x3;
@@ -2814,25 +2778,73 @@ f! {
28142778
}
28152779
}
28162780

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

28382850
extern "C" {
@@ -3047,20 +3059,6 @@ extern "C" {
30473059
new_value: *const itimerspec,
30483060
old_value: *mut itimerspec,
30493061
) -> ::c_int;
3050-
#[cfg(not(target_env = "uclibc"))]
3051-
pub fn pwritev(
3052-
fd: ::c_int,
3053-
iov: *const ::iovec,
3054-
iovcnt: ::c_int,
3055-
offset: ::off_t,
3056-
) -> ::ssize_t;
3057-
#[cfg(not(target_env = "uclibc"))]
3058-
pub fn preadv(
3059-
fd: ::c_int,
3060-
iov: *const ::iovec,
3061-
iovcnt: ::c_int,
3062-
offset: ::off_t,
3063-
) -> ::ssize_t;
30643062
pub fn quotactl(
30653063
cmd: ::c_int,
30663064
special: *const ::c_char,
@@ -3130,43 +3128,10 @@ extern "C" {
31303128
len: *mut ::socklen_t,
31313129
flg: ::c_int,
31323130
) -> ::c_int;
3133-
#[cfg(not(target_env = "uclibc"))]
3134-
pub fn getnameinfo(
3135-
sa: *const ::sockaddr,
3136-
salen: ::socklen_t,
3137-
host: *mut ::c_char,
3138-
hostlen: ::socklen_t,
3139-
serv: *mut ::c_char,
3140-
sevlen: ::socklen_t,
3141-
flags: ::c_int,
3142-
) -> ::c_int;
31433131
pub fn pthread_setschedprio(
31443132
native: ::pthread_t,
31453133
priority: ::c_int,
31463134
) -> ::c_int;
3147-
#[cfg(not(target_env = "uclibc"))]
3148-
pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
3149-
3150-
#[cfg(not(target_env = "uclibc"))]
3151-
pub fn process_vm_readv(
3152-
pid: ::pid_t,
3153-
local_iov: *const ::iovec,
3154-
liovcnt: ::c_ulong,
3155-
remote_iov: *const ::iovec,
3156-
riovcnt: ::c_ulong,
3157-
flags: ::c_ulong,
3158-
) -> isize;
3159-
3160-
#[cfg(not(target_env = "uclibc"))]
3161-
pub fn process_vm_writev(
3162-
pid: ::pid_t,
3163-
local_iov: *const ::iovec,
3164-
liovcnt: ::c_ulong,
3165-
remote_iov: *const ::iovec,
3166-
riovcnt: ::c_ulong,
3167-
flags: ::c_ulong,
3168-
) -> isize;
3169-
31703135
pub fn reboot(how_to: ::c_int) -> ::c_int;
31713136
pub fn setfsgid(gid: ::gid_t) -> ::c_int;
31723137
pub fn setfsuid(uid: ::uid_t) -> ::c_int;
@@ -3242,8 +3207,6 @@ extern "C" {
32423207
) -> ::ssize_t;
32433208
pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
32443209

3245-
#[cfg(not(target_env = "uclibc"))]
3246-
pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
32473210
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
32483211

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

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,19 @@ s! {
233233
pub e_termination: ::c_short,
234234
pub e_exit: ::c_short,
235235
}
236+
237+
pub struct Elf64_Chdr {
238+
pub ch_type: ::Elf64_Word,
239+
pub ch_reserved: ::Elf64_Word,
240+
pub ch_size: ::Elf64_Xword,
241+
pub ch_addralign: ::Elf64_Xword,
242+
}
243+
244+
pub struct Elf32_Chdr {
245+
pub ch_type: ::Elf32_Word,
246+
pub ch_size: ::Elf32_Word,
247+
pub ch_addralign: ::Elf32_Word,
248+
}
236249
}
237250

238251
s_no_extra_traits! {

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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 2 deletions
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)