Skip to content

Commit cc72dff

Browse files
danielframptonmyl7
authored andcommitted
Redirecting to musl time64 symbols
1 parent 6e1a730 commit cc72dff

File tree

4 files changed

+212
-60
lines changed

4 files changed

+212
-60
lines changed

src/unix/linux_like/linux/mod.rs

Lines changed: 101 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,11 @@ s! {
322322
}
323323

324324
pub struct input_event {
325+
#[cfg(all(target_env = "musl", target_pointer_width = "32"))]
326+
pub input_event_sec: ::c_ulong,
327+
#[cfg(all(target_env = "musl", target_pointer_width = "32"))]
328+
pub input_event_usec: ::c_ulong,
329+
#[cfg(not(all(target_env = "musl", target_pointer_width = "32")))]
325330
pub time: ::timeval,
326331
pub type_: ::__u16,
327332
pub code: ::__u16,
@@ -5310,6 +5315,10 @@ cfg_if! {
53105315
pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
53115316
pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
53125317
pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
5318+
#[cfg_attr(
5319+
all(target_env = "musl", target_pointer_width = "32"),
5320+
link_name = "__aio_suspend_time64"
5321+
)]
53135322
pub fn aio_suspend(
53145323
aiocb_list: *const *const aiocb,
53155324
nitems: ::c_int,
@@ -5370,6 +5379,10 @@ cfg_if! {
53705379
riovcnt: ::c_ulong,
53715380
flags: ::c_ulong,
53725381
) -> isize;
5382+
#[cfg_attr(
5383+
all(target_env = "musl", target_pointer_width = "32"),
5384+
link_name = "__futimes_time64"
5385+
)]
53735386
pub fn futimes(
53745387
fd: ::c_int,
53755388
times: *const ::timeval
@@ -5393,43 +5406,6 @@ cfg_if! {
53935406
spbufp: *mut *mut spwd,
53945407
) -> ::c_int;
53955408

5396-
pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
5397-
pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
5398-
pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
5399-
pub fn mq_receive(
5400-
mqd: ::mqd_t,
5401-
msg_ptr: *mut ::c_char,
5402-
msg_len: ::size_t,
5403-
msg_prio: *mut ::c_uint,
5404-
) -> ::ssize_t;
5405-
pub fn mq_timedreceive(
5406-
mqd: ::mqd_t,
5407-
msg_ptr: *mut ::c_char,
5408-
msg_len: ::size_t,
5409-
msg_prio: *mut ::c_uint,
5410-
abs_timeout: *const ::timespec,
5411-
) -> ::ssize_t;
5412-
pub fn mq_send(
5413-
mqd: ::mqd_t,
5414-
msg_ptr: *const ::c_char,
5415-
msg_len: ::size_t,
5416-
msg_prio: ::c_uint,
5417-
) -> ::c_int;
5418-
pub fn mq_timedsend(
5419-
mqd: ::mqd_t,
5420-
msg_ptr: *const ::c_char,
5421-
msg_len: ::size_t,
5422-
msg_prio: ::c_uint,
5423-
abs_timeout: *const ::timespec,
5424-
) -> ::c_int;
5425-
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
5426-
pub fn mq_setattr(
5427-
mqd: ::mqd_t,
5428-
newattr: *const ::mq_attr,
5429-
oldattr: *mut ::mq_attr
5430-
) -> ::c_int;
5431-
5432-
pub fn pthread_mutex_consistent(mutex: *mut pthread_mutex_t) -> ::c_int;
54335409
pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int;
54345410
pub fn pthread_mutexattr_getrobust(
54355411
attr: *const pthread_mutexattr_t,
@@ -5465,6 +5441,10 @@ extern "C" {
54655441
pub fn seed48(xseed: *mut ::c_ushort) -> *mut ::c_ushort;
54665442
pub fn lcong48(p: *mut ::c_ushort);
54675443

5444+
#[cfg_attr(
5445+
all(target_env = "musl", target_pointer_width = "32"),
5446+
link_name = "__lutimes_time64"
5447+
)]
54685448
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
54695449

54705450
pub fn setpwent();
@@ -5560,7 +5540,15 @@ extern "C" {
55605540
pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
55615541
pub fn signalfd(fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int) -> ::c_int;
55625542
pub fn timerfd_create(clockid: ::clockid_t, flags: ::c_int) -> ::c_int;
5543+
#[cfg_attr(
5544+
all(target_env = "musl", target_pointer_width = "32"),
5545+
link_name = "__timerfd_gettime64"
5546+
)]
55635547
pub fn timerfd_gettime(fd: ::c_int, curr_value: *mut itimerspec) -> ::c_int;
5548+
#[cfg_attr(
5549+
all(target_env = "musl", target_pointer_width = "32"),
5550+
link_name = "__timerfd_settime64"
5551+
)]
55645552
pub fn timerfd_settime(
55655553
fd: ::c_int,
55665554
flags: ::c_int,
@@ -5573,6 +5561,45 @@ extern "C" {
55735561
id: ::c_int,
55745562
data: *mut ::c_char,
55755563
) -> ::c_int;
5564+
pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
5565+
pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
5566+
pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
5567+
pub fn mq_receive(
5568+
mqd: ::mqd_t,
5569+
msg_ptr: *mut ::c_char,
5570+
msg_len: ::size_t,
5571+
msg_prio: *mut ::c_uint,
5572+
) -> ::ssize_t;
5573+
#[cfg_attr(
5574+
all(target_env = "musl", target_pointer_width = "32"),
5575+
link_name = "__mq_timedreceive_time64"
5576+
)]
5577+
pub fn mq_timedreceive(
5578+
mqd: ::mqd_t,
5579+
msg_ptr: *mut ::c_char,
5580+
msg_len: ::size_t,
5581+
msg_prio: *mut ::c_uint,
5582+
abs_timeout: *const ::timespec,
5583+
) -> ::ssize_t;
5584+
pub fn mq_send(
5585+
mqd: ::mqd_t,
5586+
msg_ptr: *const ::c_char,
5587+
msg_len: ::size_t,
5588+
msg_prio: ::c_uint,
5589+
) -> ::c_int;
5590+
#[cfg_attr(
5591+
all(target_env = "musl", target_pointer_width = "32"),
5592+
link_name = "__mq_timedsend_time64"
5593+
)]
5594+
pub fn mq_timedsend(
5595+
mqd: ::mqd_t,
5596+
msg_ptr: *const ::c_char,
5597+
msg_len: ::size_t,
5598+
msg_prio: ::c_uint,
5599+
abs_timeout: *const ::timespec,
5600+
) -> ::c_int;
5601+
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
5602+
pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int;
55765603
pub fn epoll_pwait(
55775604
epfd: ::c_int,
55785605
events: *mut ::epoll_event,
@@ -5583,6 +5610,10 @@ extern "C" {
55835610
pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
55845611
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
55855612
pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
5613+
#[cfg_attr(
5614+
all(target_env = "musl", target_pointer_width = "32"),
5615+
link_name = "__sigtimedwait_time64"
5616+
)]
55865617
pub fn sigtimedwait(
55875618
set: *const sigset_t,
55885619
info: *mut siginfo_t,
@@ -5696,6 +5727,10 @@ extern "C" {
56965727
pub fn umount(target: *const ::c_char) -> ::c_int;
56975728
pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
56985729
pub fn tee(fd_in: ::c_int, fd_out: ::c_int, len: ::size_t, flags: ::c_uint) -> ::ssize_t;
5730+
#[cfg_attr(
5731+
all(target_env = "musl", target_pointer_width = "32"),
5732+
link_name = "__settimeofday_time64"
5733+
)]
56995734
pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
57005735
pub fn splice(
57015736
fd_in: ::c_int,
@@ -5709,7 +5744,15 @@ extern "C" {
57095744
pub fn eventfd_read(fd: ::c_int, value: *mut eventfd_t) -> ::c_int;
57105745
pub fn eventfd_write(fd: ::c_int, value: eventfd_t) -> ::c_int;
57115746

5747+
#[cfg_attr(
5748+
all(target_env = "musl", target_pointer_width = "32"),
5749+
link_name = "__sched_rr_get_interval_time64"
5750+
)]
57125751
pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
5752+
#[cfg_attr(
5753+
all(target_env = "musl", target_pointer_width = "32"),
5754+
link_name = "__sem_timedwait_time64"
5755+
)]
57135756
pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int;
57145757
pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int;
57155758
pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
@@ -5731,6 +5774,10 @@ extern "C" {
57315774
pub fn personality(persona: ::c_ulong) -> ::c_int;
57325775
pub fn prctl(option: ::c_int, ...) -> ::c_int;
57335776
pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int;
5777+
#[cfg_attr(
5778+
all(target_env = "musl", target_pointer_width = "32"),
5779+
link_name = "__ppoll_time64"
5780+
)]
57345781
pub fn ppoll(
57355782
fds: *mut ::pollfd,
57365783
nfds: nfds_t,
@@ -5745,7 +5792,11 @@ extern "C" {
57455792
attr: *mut pthread_mutexattr_t,
57465793
protocol: ::c_int,
57475794
) -> ::c_int;
5748-
5795+
pub fn pthread_mutex_consistent(mutex: *mut pthread_mutex_t) -> ::c_int;
5796+
#[cfg_attr(
5797+
all(target_env = "musl", target_pointer_width = "32"),
5798+
link_name = "__pthread_mutex_timedlock_time64"
5799+
)]
57495800
pub fn pthread_mutex_timedlock(
57505801
lock: *mut pthread_mutex_t,
57515802
abstime: *const ::timespec,
@@ -5780,6 +5831,10 @@ extern "C" {
57805831
...
57815832
) -> ::c_int;
57825833
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
5834+
#[cfg_attr(
5835+
all(target_env = "musl", target_pointer_width = "32"),
5836+
link_name = "__clock_nanosleep_time64"
5837+
)]
57835838
pub fn clock_nanosleep(
57845839
clk_id: ::clockid_t,
57855840
flags: ::c_int,
@@ -6049,7 +6104,15 @@ extern "C" {
60496104
) -> ::c_int;
60506105
pub fn timer_delete(timerid: ::timer_t) -> ::c_int;
60516106
pub fn timer_getoverrun(timerid: ::timer_t) -> ::c_int;
6107+
#[cfg_attr(
6108+
all(target_env = "musl", target_pointer_width = "32"),
6109+
link_name = "__timer_gettime64"
6110+
)]
60526111
pub fn timer_gettime(timerid: ::timer_t, curr_value: *mut ::itimerspec) -> ::c_int;
6112+
#[cfg_attr(
6113+
all(target_env = "musl", target_pointer_width = "32"),
6114+
link_name = "__timer_settime64"
6115+
)]
60536116
pub fn timer_settime(
60546117
timerid: ::timer_t,
60556118
flags: ::c_int,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ extern "C" {
804804
vlen: ::c_uint,
805805
flags: ::c_uint,
806806
) -> ::c_int;
807+
#[cfg_attr(target_pointer_width = "32", link_name = "__recvmmsg_time64")]
807808
pub fn recvmmsg(
808809
sockfd: ::c_int,
809810
msgvec: *mut ::mmsghdr,
@@ -821,6 +822,7 @@ extern "C" {
821822
old_limit: *mut ::rlimit,
822823
) -> ::c_int;
823824
pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
825+
#[cfg_attr(target_pointer_width = "32", link_name = "__gettimeofday_time64")]
824826
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
825827
pub fn ptrace(request: ::c_int, ...) -> ::c_long;
826828
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
@@ -842,7 +844,9 @@ extern "C" {
842844
// Added in `musl` 1.2.2
843845
pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
844846

847+
#[cfg_attr(target_pointer_width = "32", link_name = "__adjtimex_time64")]
845848
pub fn adjtimex(buf: *mut ::timex) -> ::c_int;
849+
#[cfg_attr(target_pointer_width = "32", link_name = "__clock_adjtime64")]
846850
pub fn clock_adjtime(clk_id: ::clockid_t, buf: *mut ::timex) -> ::c_int;
847851

848852
pub fn ctermid(s: *mut ::c_char) -> *mut ::c_char;

src/unix/linux_like/mod.rs

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,8 +1675,20 @@ extern "C" {
16751675
pub fn fdatasync(fd: ::c_int) -> ::c_int;
16761676
pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_uchar) -> ::c_int;
16771677

1678+
#[cfg_attr(
1679+
all(target_env = "musl", target_pointer_width = "32"),
1680+
link_name = "__clock_getres_time64"
1681+
)]
16781682
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
1683+
#[cfg_attr(
1684+
all(target_env = "musl", target_pointer_width = "32"),
1685+
link_name = "__clock_gettime64"
1686+
)]
16791687
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
1688+
#[cfg_attr(
1689+
all(target_env = "musl", target_pointer_width = "32"),
1690+
link_name = "__clock_settime64"
1691+
)]
16801692
pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
16811693
pub fn clock_getcpuclockid(pid: ::pid_t, clk_id: *mut ::clockid_t) -> ::c_int;
16821694

@@ -1695,7 +1707,21 @@ extern "C" {
16951707
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
16961708
pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
16971709
pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int;
1710+
pub fn posix_fadvise64(
1711+
fd: ::c_int,
1712+
offset: ::off64_t,
1713+
len: ::off64_t,
1714+
advise: ::c_int,
1715+
) -> ::c_int;
1716+
#[cfg_attr(
1717+
all(target_env = "musl", target_pointer_width = "32"),
1718+
link_name = "__futimens_time64"
1719+
)]
16981720
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
1721+
#[cfg_attr(
1722+
all(target_env = "musl", target_pointer_width = "32"),
1723+
link_name = "__utimensat_time64"
1724+
)]
16991725
pub fn utimensat(
17001726
dirfd: ::c_int,
17011727
path: *const ::c_char,
@@ -1741,6 +1767,10 @@ extern "C" {
17411767
pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
17421768
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
17431769
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
1770+
#[cfg_attr(
1771+
all(target_env = "musl", target_pointer_width = "32"),
1772+
link_name = "__wait4_time64"
1773+
)]
17441774
pub fn wait4(
17451775
pid: ::pid_t,
17461776
status: *mut ::c_int,
@@ -1800,12 +1830,6 @@ cfg_if! {
18001830
) -> *mut ::c_void;
18011831
pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
18021832
pub fn openat64(fd: ::c_int, path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
1803-
pub fn posix_fadvise64(
1804-
fd: ::c_int,
1805-
offset: ::off64_t,
1806-
len: ::off64_t,
1807-
advise: ::c_int,
1808-
) -> ::c_int;
18091833
pub fn pread64(
18101834
fd: ::c_int,
18111835
buf: *mut ::c_void,

0 commit comments

Comments
 (0)