Skip to content

Commit c8fa1a1

Browse files
danielframptonmyl7
authored andcommitted
Redirecting to musl time64 symbols
1 parent 76dc6a9 commit c8fa1a1

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,
@@ -5345,6 +5350,10 @@ cfg_if! {
53455350
pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
53465351
pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
53475352
pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
5353+
#[cfg_attr(
5354+
all(target_env = "musl", target_pointer_width = "32"),
5355+
link_name = "__aio_suspend_time64"
5356+
)]
53485357
pub fn aio_suspend(
53495358
aiocb_list: *const *const aiocb,
53505359
nitems: ::c_int,
@@ -5405,6 +5414,10 @@ cfg_if! {
54055414
riovcnt: ::c_ulong,
54065415
flags: ::c_ulong,
54075416
) -> isize;
5417+
#[cfg_attr(
5418+
all(target_env = "musl", target_pointer_width = "32"),
5419+
link_name = "__futimes_time64"
5420+
)]
54085421
pub fn futimes(
54095422
fd: ::c_int,
54105423
times: *const ::timeval
@@ -5428,43 +5441,6 @@ cfg_if! {
54285441
spbufp: *mut *mut spwd,
54295442
) -> ::c_int;
54305443

5431-
pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
5432-
pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
5433-
pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
5434-
pub fn mq_receive(
5435-
mqd: ::mqd_t,
5436-
msg_ptr: *mut ::c_char,
5437-
msg_len: ::size_t,
5438-
msg_prio: *mut ::c_uint,
5439-
) -> ::ssize_t;
5440-
pub fn mq_timedreceive(
5441-
mqd: ::mqd_t,
5442-
msg_ptr: *mut ::c_char,
5443-
msg_len: ::size_t,
5444-
msg_prio: *mut ::c_uint,
5445-
abs_timeout: *const ::timespec,
5446-
) -> ::ssize_t;
5447-
pub fn mq_send(
5448-
mqd: ::mqd_t,
5449-
msg_ptr: *const ::c_char,
5450-
msg_len: ::size_t,
5451-
msg_prio: ::c_uint,
5452-
) -> ::c_int;
5453-
pub fn mq_timedsend(
5454-
mqd: ::mqd_t,
5455-
msg_ptr: *const ::c_char,
5456-
msg_len: ::size_t,
5457-
msg_prio: ::c_uint,
5458-
abs_timeout: *const ::timespec,
5459-
) -> ::c_int;
5460-
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
5461-
pub fn mq_setattr(
5462-
mqd: ::mqd_t,
5463-
newattr: *const ::mq_attr,
5464-
oldattr: *mut ::mq_attr
5465-
) -> ::c_int;
5466-
5467-
pub fn pthread_mutex_consistent(mutex: *mut pthread_mutex_t) -> ::c_int;
54685444
pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int;
54695445
pub fn pthread_mutexattr_getrobust(
54705446
attr: *const pthread_mutexattr_t,
@@ -5500,6 +5476,10 @@ extern "C" {
55005476
pub fn seed48(xseed: *mut ::c_ushort) -> *mut ::c_ushort;
55015477
pub fn lcong48(p: *mut ::c_ushort);
55025478

5479+
#[cfg_attr(
5480+
all(target_env = "musl", target_pointer_width = "32"),
5481+
link_name = "__lutimes_time64"
5482+
)]
55035483
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
55045484

55055485
pub fn setpwent();
@@ -5595,7 +5575,15 @@ extern "C" {
55955575
pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
55965576
pub fn signalfd(fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int) -> ::c_int;
55975577
pub fn timerfd_create(clockid: ::clockid_t, flags: ::c_int) -> ::c_int;
5578+
#[cfg_attr(
5579+
all(target_env = "musl", target_pointer_width = "32"),
5580+
link_name = "__timerfd_gettime64"
5581+
)]
55985582
pub fn timerfd_gettime(fd: ::c_int, curr_value: *mut itimerspec) -> ::c_int;
5583+
#[cfg_attr(
5584+
all(target_env = "musl", target_pointer_width = "32"),
5585+
link_name = "__timerfd_settime64"
5586+
)]
55995587
pub fn timerfd_settime(
56005588
fd: ::c_int,
56015589
flags: ::c_int,
@@ -5608,6 +5596,45 @@ extern "C" {
56085596
id: ::c_int,
56095597
data: *mut ::c_char,
56105598
) -> ::c_int;
5599+
pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
5600+
pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
5601+
pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
5602+
pub fn mq_receive(
5603+
mqd: ::mqd_t,
5604+
msg_ptr: *mut ::c_char,
5605+
msg_len: ::size_t,
5606+
msg_prio: *mut ::c_uint,
5607+
) -> ::ssize_t;
5608+
#[cfg_attr(
5609+
all(target_env = "musl", target_pointer_width = "32"),
5610+
link_name = "__mq_timedreceive_time64"
5611+
)]
5612+
pub fn mq_timedreceive(
5613+
mqd: ::mqd_t,
5614+
msg_ptr: *mut ::c_char,
5615+
msg_len: ::size_t,
5616+
msg_prio: *mut ::c_uint,
5617+
abs_timeout: *const ::timespec,
5618+
) -> ::ssize_t;
5619+
pub fn mq_send(
5620+
mqd: ::mqd_t,
5621+
msg_ptr: *const ::c_char,
5622+
msg_len: ::size_t,
5623+
msg_prio: ::c_uint,
5624+
) -> ::c_int;
5625+
#[cfg_attr(
5626+
all(target_env = "musl", target_pointer_width = "32"),
5627+
link_name = "__mq_timedsend_time64"
5628+
)]
5629+
pub fn mq_timedsend(
5630+
mqd: ::mqd_t,
5631+
msg_ptr: *const ::c_char,
5632+
msg_len: ::size_t,
5633+
msg_prio: ::c_uint,
5634+
abs_timeout: *const ::timespec,
5635+
) -> ::c_int;
5636+
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
5637+
pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int;
56115638
pub fn epoll_pwait(
56125639
epfd: ::c_int,
56135640
events: *mut ::epoll_event,
@@ -5618,6 +5645,10 @@ extern "C" {
56185645
pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
56195646
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
56205647
pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
5648+
#[cfg_attr(
5649+
all(target_env = "musl", target_pointer_width = "32"),
5650+
link_name = "__sigtimedwait_time64"
5651+
)]
56215652
pub fn sigtimedwait(
56225653
set: *const sigset_t,
56235654
info: *mut siginfo_t,
@@ -5731,6 +5762,10 @@ extern "C" {
57315762
pub fn umount(target: *const ::c_char) -> ::c_int;
57325763
pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
57335764
pub fn tee(fd_in: ::c_int, fd_out: ::c_int, len: ::size_t, flags: ::c_uint) -> ::ssize_t;
5765+
#[cfg_attr(
5766+
all(target_env = "musl", target_pointer_width = "32"),
5767+
link_name = "__settimeofday_time64"
5768+
)]
57345769
pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
57355770
pub fn splice(
57365771
fd_in: ::c_int,
@@ -5744,7 +5779,15 @@ extern "C" {
57445779
pub fn eventfd_read(fd: ::c_int, value: *mut eventfd_t) -> ::c_int;
57455780
pub fn eventfd_write(fd: ::c_int, value: eventfd_t) -> ::c_int;
57465781

5782+
#[cfg_attr(
5783+
all(target_env = "musl", target_pointer_width = "32"),
5784+
link_name = "__sched_rr_get_interval_time64"
5785+
)]
57475786
pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
5787+
#[cfg_attr(
5788+
all(target_env = "musl", target_pointer_width = "32"),
5789+
link_name = "__sem_timedwait_time64"
5790+
)]
57485791
pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int;
57495792
pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int;
57505793
pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
@@ -5766,6 +5809,10 @@ extern "C" {
57665809
pub fn personality(persona: ::c_ulong) -> ::c_int;
57675810
pub fn prctl(option: ::c_int, ...) -> ::c_int;
57685811
pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int;
5812+
#[cfg_attr(
5813+
all(target_env = "musl", target_pointer_width = "32"),
5814+
link_name = "__ppoll_time64"
5815+
)]
57695816
pub fn ppoll(
57705817
fds: *mut ::pollfd,
57715818
nfds: nfds_t,
@@ -5780,7 +5827,11 @@ extern "C" {
57805827
attr: *mut pthread_mutexattr_t,
57815828
protocol: ::c_int,
57825829
) -> ::c_int;
5783-
5830+
pub fn pthread_mutex_consistent(mutex: *mut pthread_mutex_t) -> ::c_int;
5831+
#[cfg_attr(
5832+
all(target_env = "musl", target_pointer_width = "32"),
5833+
link_name = "__pthread_mutex_timedlock_time64"
5834+
)]
57845835
pub fn pthread_mutex_timedlock(
57855836
lock: *mut pthread_mutex_t,
57865837
abstime: *const ::timespec,
@@ -5815,6 +5866,10 @@ extern "C" {
58155866
...
58165867
) -> ::c_int;
58175868
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
5869+
#[cfg_attr(
5870+
all(target_env = "musl", target_pointer_width = "32"),
5871+
link_name = "__clock_nanosleep_time64"
5872+
)]
58185873
pub fn clock_nanosleep(
58195874
clk_id: ::clockid_t,
58205875
flags: ::c_int,
@@ -6084,7 +6139,15 @@ extern "C" {
60846139
) -> ::c_int;
60856140
pub fn timer_delete(timerid: ::timer_t) -> ::c_int;
60866141
pub fn timer_getoverrun(timerid: ::timer_t) -> ::c_int;
6142+
#[cfg_attr(
6143+
all(target_env = "musl", target_pointer_width = "32"),
6144+
link_name = "__timer_gettime64"
6145+
)]
60876146
pub fn timer_gettime(timerid: ::timer_t, curr_value: *mut ::itimerspec) -> ::c_int;
6147+
#[cfg_attr(
6148+
all(target_env = "musl", target_pointer_width = "32"),
6149+
link_name = "__timer_settime64"
6150+
)]
60886151
pub fn timer_settime(
60896152
timerid: ::timer_t,
60906153
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,
@@ -820,6 +821,7 @@ extern "C" {
820821
new_limit: *const ::rlimit,
821822
old_limit: *mut ::rlimit,
822823
) -> ::c_int;
824+
#[cfg_attr(target_pointer_width = "32", link_name = "__gettimeofday_time64")]
823825
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
824826
pub fn ptrace(request: ::c_int, ...) -> ::c_long;
825827
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
@@ -841,7 +843,9 @@ extern "C" {
841843
// Added in `musl` 1.2.2
842844
pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
843845

846+
#[cfg_attr(target_pointer_width = "32", link_name = "__adjtimex_time64")]
844847
pub fn adjtimex(buf: *mut ::timex) -> ::c_int;
848+
#[cfg_attr(target_pointer_width = "32", link_name = "__clock_adjtime64")]
845849
pub fn clock_adjtime(clk_id: ::clockid_t, buf: *mut ::timex) -> ::c_int;
846850

847851
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)