Skip to content

Commit 00ed98d

Browse files
committed
linux: hoist a few symbols which are now available in all libc variants
1 parent 0d87e07 commit 00ed98d

File tree

3 files changed

+35
-71
lines changed

3 files changed

+35
-71
lines changed

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

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,6 @@ s! {
141141
pub keepcost: ::size_t,
142142
}
143143

144-
pub struct nlmsghdr {
145-
pub nlmsg_len: u32,
146-
pub nlmsg_type: u16,
147-
pub nlmsg_flags: u16,
148-
pub nlmsg_seq: u32,
149-
pub nlmsg_pid: u32,
150-
}
151-
152-
pub struct nlmsgerr {
153-
pub error: ::c_int,
154-
pub msg: nlmsghdr,
155-
}
156-
157144
pub struct nl_pktinfo {
158145
pub group: u32,
159146
}
@@ -174,11 +161,6 @@ s! {
174161
pub nm_gid: u32,
175162
}
176163

177-
pub struct nlattr {
178-
pub nla_len: u16,
179-
pub nla_type: u16,
180-
}
181-
182164
pub struct rtentry {
183165
pub rt_pad1: ::c_ulong,
184166
pub rt_dst: ::sockaddr,
@@ -1210,13 +1192,6 @@ extern "C" {
12101192
statxbuf: *mut statx,
12111193
) -> ::c_int;
12121194
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
1213-
1214-
pub fn memmem(
1215-
haystack: *const ::c_void,
1216-
haystacklen: ::size_t,
1217-
needle: *const ::c_void,
1218-
needlelen: ::size_t,
1219-
) -> *mut ::c_void;
12201195
pub fn getauxval(type_: ::c_ulong) -> ::c_ulong;
12211196

12221197
pub fn adjtimex(buf: *mut timex) -> ::c_int;
@@ -1305,16 +1280,6 @@ extern "C" {
13051280
) -> ::c_int;
13061281
pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int;
13071282
pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int;
1308-
pub fn pthread_getaffinity_np(
1309-
thread: ::pthread_t,
1310-
cpusetsize: ::size_t,
1311-
cpuset: *mut ::cpu_set_t,
1312-
) -> ::c_int;
1313-
pub fn pthread_setaffinity_np(
1314-
thread: ::pthread_t,
1315-
cpusetsize: ::size_t,
1316-
cpuset: *const ::cpu_set_t,
1317-
) -> ::c_int;
13181283
pub fn pthread_rwlockattr_getkind_np(
13191284
attr: *const ::pthread_rwlockattr_t,
13201285
val: *mut ::c_int,
@@ -1323,7 +1288,6 @@ extern "C" {
13231288
attr: *mut ::pthread_rwlockattr_t,
13241289
val: ::c_int,
13251290
) -> ::c_int;
1326-
pub fn sched_getcpu() -> ::c_int;
13271291
pub fn mallinfo() -> ::mallinfo;
13281292
pub fn mallinfo2() -> ::mallinfo2;
13291293
pub fn malloc_info(options: ::c_int, stream: *mut ::FILE) -> ::c_int;

src/unix/linux_like/linux/mod.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,24 @@ s! {
563563
pub instruction_pointer: ::__u64,
564564
pub args: [::__u64; 6],
565565
}
566+
567+
pub struct nlmsghdr {
568+
pub nlmsg_len: u32,
569+
pub nlmsg_type: u16,
570+
pub nlmsg_flags: u16,
571+
pub nlmsg_seq: u32,
572+
pub nlmsg_pid: u32,
573+
}
574+
575+
pub struct nlmsgerr {
576+
pub error: ::c_int,
577+
pub msg: nlmsghdr,
578+
}
579+
580+
pub struct nlattr {
581+
pub nla_len: u16,
582+
pub nla_type: u16,
583+
}
566584
}
567585

568586
s_no_extra_traits! {
@@ -3438,6 +3456,16 @@ extern "C" {
34383456
len: *mut ::socklen_t,
34393457
flg: ::c_int,
34403458
) -> ::c_int;
3459+
pub fn pthread_getaffinity_np(
3460+
thread: ::pthread_t,
3461+
cpusetsize: ::size_t,
3462+
cpuset: *mut ::cpu_set_t,
3463+
) -> ::c_int;
3464+
pub fn pthread_setaffinity_np(
3465+
thread: ::pthread_t,
3466+
cpusetsize: ::size_t,
3467+
cpuset: *const ::cpu_set_t,
3468+
) -> ::c_int;
34413469
pub fn pthread_setschedprio(native: ::pthread_t, priority: ::c_int) -> ::c_int;
34423470
pub fn reboot(how_to: ::c_int) -> ::c_int;
34433471
pub fn setfsgid(gid: ::gid_t) -> ::c_int;
@@ -3850,6 +3878,13 @@ extern "C" {
38503878
pub fn gethostid() -> ::c_long;
38513879

38523880
pub fn pthread_getcpuclockid(thread: ::pthread_t, clk_id: *mut ::clockid_t) -> ::c_int;
3881+
pub fn memmem(
3882+
haystack: *const ::c_void,
3883+
haystacklen: ::size_t,
3884+
needle: *const ::c_void,
3885+
needlelen: ::size_t,
3886+
) -> *mut ::c_void;
3887+
pub fn sched_getcpu() -> ::c_int;
38533888
}
38543889

38553890
cfg_if! {

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

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -133,24 +133,6 @@ s! {
133133
__dummy4: [::c_char; 16],
134134
}
135135

136-
pub struct nlmsghdr {
137-
pub nlmsg_len: u32,
138-
pub nlmsg_type: u16,
139-
pub nlmsg_flags: u16,
140-
pub nlmsg_seq: u32,
141-
pub nlmsg_pid: u32,
142-
}
143-
144-
pub struct nlmsgerr {
145-
pub error: ::c_int,
146-
pub msg: nlmsghdr,
147-
}
148-
149-
pub struct nlattr {
150-
pub nla_len: u16,
151-
pub nla_type: u16,
152-
}
153-
154136
pub struct sigaction {
155137
pub sa_sigaction: ::sighandler_t,
156138
pub sa_mask: ::sigset_t,
@@ -757,23 +739,6 @@ extern "C" {
757739
pub fn ptrace(request: ::c_int, ...) -> ::c_long;
758740
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
759741
pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
760-
pub fn pthread_getaffinity_np(
761-
thread: ::pthread_t,
762-
cpusetsize: ::size_t,
763-
cpuset: *mut ::cpu_set_t,
764-
) -> ::c_int;
765-
pub fn pthread_setaffinity_np(
766-
thread: ::pthread_t,
767-
cpusetsize: ::size_t,
768-
cpuset: *const ::cpu_set_t,
769-
) -> ::c_int;
770-
pub fn sched_getcpu() -> ::c_int;
771-
pub fn memmem(
772-
haystack: *const ::c_void,
773-
haystacklen: ::size_t,
774-
needle: *const ::c_void,
775-
needlelen: ::size_t,
776-
) -> *mut ::c_void;
777742
// Musl targets need the `mask` argument of `fanotify_mark` be specified
778743
// `::c_ulonglong` instead of `u64` or there will be a type mismatch between
779744
// `long long unsigned int` and the expected `uint64_t`.

0 commit comments

Comments
 (0)