Skip to content

Commit 8df6f13

Browse files
committed
musl: time64: set link names for symbols
This corresponds to upstream commit bminor/musl@1febd21 (most symbols) and bminor/musl@22daaea (only dlsym)
1 parent 9d24137 commit 8df6f13

File tree

4 files changed

+58
-34
lines changed

4 files changed

+58
-34
lines changed

src/unix/linux_like/linux/mod.rs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6107,7 +6107,7 @@ cfg_if! {
61076107
pub fn aio_error(aiocbp: *const aiocb) -> c_int;
61086108
#[cfg_attr(gnu_file_offset_bits64, link_name = "aio_return64")]
61096109
pub fn aio_return(aiocbp: *mut aiocb) -> ssize_t;
6110-
#[cfg_attr(gnu_time_bits64, link_name = "__aio_suspend_time64")]
6110+
#[cfg_attr(any(musl_time64, gnu_time_bits64), link_name = "__aio_suspend_time64")]
61116111
pub fn aio_suspend(
61126112
aiocb_list: *const *const aiocb,
61136113
nitems: c_int,
@@ -6170,6 +6170,7 @@ cfg_if! {
61706170
flags: c_ulong,
61716171
) -> isize;
61726172
#[cfg_attr(gnu_time_bits64, link_name = "__futimes64")]
6173+
#[cfg_attr(musl_time64, link_name = "__futimes_time64")]
61736174
pub fn futimes(fd: c_int, times: *const crate::timeval) -> c_int;
61746175
}
61756176
}
@@ -6199,7 +6200,7 @@ cfg_if! {
61996200
msg_len: size_t,
62006201
msg_prio: *mut c_uint,
62016202
) -> ssize_t;
6202-
#[cfg_attr(gnu_time_bits64, link_name = "__mq_timedreceive_time64")]
6203+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__mq_timedreceive_time64")]
62036204
pub fn mq_timedreceive(
62046205
mqd: crate::mqd_t,
62056206
msg_ptr: *mut c_char,
@@ -6213,7 +6214,7 @@ cfg_if! {
62136214
msg_len: size_t,
62146215
msg_prio: c_uint,
62156216
) -> c_int;
6216-
#[cfg_attr(gnu_time_bits64, link_name = "__mq_timedsend_time64")]
6217+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__mq_timedsend_time64")]
62176218
pub fn mq_timedsend(
62186219
mqd: crate::mqd_t,
62196220
msg_ptr: *const c_char,
@@ -6265,6 +6266,7 @@ extern "C" {
62656266
pub fn lcong48(p: *mut c_ushort);
62666267

62676268
#[cfg_attr(gnu_time_bits64, link_name = "__lutimes64")]
6269+
#[cfg_attr(musl_time64, link_name = "__lutimes_time64")]
62686270
pub fn lutimes(file: *const c_char, times: *const crate::timeval) -> c_int;
62696271

62706272
pub fn setpwent();
@@ -6360,9 +6362,9 @@ extern "C" {
63606362
pub fn fremovexattr(filedes: c_int, name: *const c_char) -> c_int;
63616363
pub fn signalfd(fd: c_int, mask: *const crate::sigset_t, flags: c_int) -> c_int;
63626364
pub fn timerfd_create(clockid: crate::clockid_t, flags: c_int) -> c_int;
6363-
#[cfg_attr(gnu_time_bits64, link_name = "__timerfd_gettime64")]
6365+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__timerfd_gettime64")]
63646366
pub fn timerfd_gettime(fd: c_int, curr_value: *mut itimerspec) -> c_int;
6365-
#[cfg_attr(gnu_time_bits64, link_name = "__timerfd_settime64")]
6367+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__timerfd_settime64")]
63666368
pub fn timerfd_settime(
63676369
fd: c_int,
63686370
flags: c_int,
@@ -6379,6 +6381,7 @@ extern "C" {
63796381
) -> c_int;
63806382
pub fn dup3(oldfd: c_int, newfd: c_int, flags: c_int) -> c_int;
63816383
#[cfg_attr(gnu_time_bits64, link_name = "__sigtimedwait64")]
6384+
#[cfg_attr(musl_time64, link_name = "__sigtimedwait_time64")]
63826385
pub fn sigtimedwait(
63836386
set: *const sigset_t,
63846387
info: *mut siginfo_t,
@@ -6499,6 +6502,7 @@ extern "C" {
64996502
pub fn sched_get_priority_max(policy: c_int) -> c_int;
65006503
pub fn tee(fd_in: c_int, fd_out: c_int, len: size_t, flags: c_uint) -> ssize_t;
65016504
#[cfg_attr(gnu_time_bits64, link_name = "__settimeofday64")]
6505+
#[cfg_attr(musl_time64, link_name = "__settimeofday_time64")]
65026506
pub fn settimeofday(tv: *const crate::timeval, tz: *const crate::timezone) -> c_int;
65036507
pub fn splice(
65046508
fd_in: c_int,
@@ -6513,8 +6517,10 @@ extern "C" {
65136517
pub fn eventfd_write(fd: c_int, value: eventfd_t) -> c_int;
65146518

65156519
#[cfg_attr(gnu_time_bits64, link_name = "__sched_rr_get_interval64")]
6520+
#[cfg_attr(musl_time64, link_name = "__sched_rr_get_interval_time64")]
65166521
pub fn sched_rr_get_interval(pid: crate::pid_t, tp: *mut crate::timespec) -> c_int;
65176522
#[cfg_attr(gnu_time_bits64, link_name = "__sem_timedwait64")]
6523+
#[cfg_attr(musl_time64, link_name = "__sem_timedwait_time64")]
65186524
pub fn sem_timedwait(sem: *mut sem_t, abstime: *const crate::timespec) -> c_int;
65196525
pub fn sem_getvalue(sem: *mut sem_t, sval: *mut c_int) -> c_int;
65206526
pub fn sched_setparam(pid: crate::pid_t, param: *const crate::sched_param) -> c_int;
@@ -6534,6 +6540,7 @@ extern "C" {
65346540
pub fn prctl(option: c_int, ...) -> c_int;
65356541
pub fn sched_getparam(pid: crate::pid_t, param: *mut crate::sched_param) -> c_int;
65366542
#[cfg_attr(gnu_time_bits64, link_name = "__ppoll64")]
6543+
#[cfg_attr(musl_time64, link_name = "__ppoll_time64")]
65376544
pub fn ppoll(
65386545
fds: *mut crate::pollfd,
65396546
nfds: nfds_t,
@@ -6547,6 +6554,7 @@ extern "C" {
65476554
pub fn pthread_mutexattr_setprotocol(attr: *mut pthread_mutexattr_t, protocol: c_int) -> c_int;
65486555

65496556
#[cfg_attr(gnu_time_bits64, link_name = "__pthread_mutex_timedlock64")]
6557+
#[cfg_attr(musl_time64, link_name = "__pthread_mutex_timedlock_time64")]
65506558
pub fn pthread_mutex_timedlock(
65516559
lock: *mut pthread_mutex_t,
65526560
abstime: *const crate::timespec,
@@ -6581,7 +6589,10 @@ extern "C" {
65816589
...
65826590
) -> c_int;
65836591
pub fn sched_getscheduler(pid: crate::pid_t) -> c_int;
6584-
#[cfg_attr(gnu_time_bits64, link_name = "__clock_nanosleep_time64")]
6592+
#[cfg_attr(
6593+
any(gnu_time_bits64, musl_time64),
6594+
link_name = "__clock_nanosleep_time64"
6595+
)]
65856596
pub fn clock_nanosleep(
65866597
clk_id: crate::clockid_t,
65876598
flags: c_int,
@@ -6839,9 +6850,9 @@ extern "C" {
68396850
) -> c_int;
68406851
pub fn timer_delete(timerid: crate::timer_t) -> c_int;
68416852
pub fn timer_getoverrun(timerid: crate::timer_t) -> c_int;
6842-
#[cfg_attr(gnu_time_bits64, link_name = "__timer_gettime64")]
6853+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__timer_gettime64")]
68436854
pub fn timer_gettime(timerid: crate::timer_t, curr_value: *mut crate::itimerspec) -> c_int;
6844-
#[cfg_attr(gnu_time_bits64, link_name = "__timer_settime64")]
6855+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__timer_settime64")]
68456856
pub fn timer_settime(
68466857
timerid: crate::timer_t,
68476858
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
@@ -839,6 +839,7 @@ extern "C" {
839839
vlen: c_uint,
840840
flags: c_uint,
841841
) -> c_int;
842+
#[cfg_attr(musl_time64, link_name = "__recvmmsg_time64")]
842843
pub fn recvmmsg(
843844
sockfd: c_int,
844845
msgvec: *mut crate::mmsghdr,
@@ -855,6 +856,7 @@ extern "C" {
855856
new_limit: *const crate::rlimit,
856857
old_limit: *mut crate::rlimit,
857858
) -> c_int;
859+
#[cfg_attr(musl_time64, link_name = "__gettimeofday_time64")]
858860
pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int;
859861
pub fn ptrace(request: c_int, ...) -> c_long;
860862
pub fn getpriority(which: c_int, who: crate::id_t) -> c_int;
@@ -890,7 +892,9 @@ extern "C" {
890892
// Added in `musl` 1.2.2
891893
pub fn reallocarray(ptr: *mut c_void, nmemb: size_t, size: size_t) -> *mut c_void;
892894

895+
#[cfg_attr(musl_time64, link_name = "__adjtimex_time64")]
893896
pub fn adjtimex(buf: *mut crate::timex) -> c_int;
897+
#[cfg_attr(musl_time64, link_name = "__clock_adjtime64")]
894898
pub fn clock_adjtime(clk_id: crate::clockid_t, buf: *mut crate::timex) -> c_int;
895899

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

src/unix/linux_like/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,10 +1919,11 @@ extern "C" {
19191919
pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar) -> c_int;
19201920

19211921
#[cfg_attr(gnu_time_bits64, link_name = "__clock_getres64")]
1922+
#[cfg_attr(musl_time64, link_name = "__clock_getres_time64")]
19221923
pub fn clock_getres(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
1923-
#[cfg_attr(gnu_time_bits64, link_name = "__clock_gettime64")]
1924+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__clock_gettime64")]
19241925
pub fn clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
1925-
#[cfg_attr(gnu_time_bits64, link_name = "__clock_settime64")]
1926+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__clock_settime64")]
19261927
pub fn clock_settime(clk_id: crate::clockid_t, tp: *const crate::timespec) -> c_int;
19271928
pub fn clock_getcpuclockid(pid: crate::pid_t, clk_id: *mut crate::clockid_t) -> c_int;
19281929

@@ -1950,8 +1951,10 @@ extern "C" {
19501951
#[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fadvise64")]
19511952
pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int;
19521953
#[cfg_attr(gnu_time_bits64, link_name = "__futimens64")]
1954+
#[cfg_attr(musl_time64, link_name = "__futimens_time64")]
19531955
pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int;
19541956
#[cfg_attr(gnu_time_bits64, link_name = "__utimensat64")]
1957+
#[cfg_attr(musl_time64, link_name = "__utimensat_time64")]
19551958
pub fn utimensat(
19561959
dirfd: c_int,
19571960
path: *const c_char,
@@ -2001,7 +2004,7 @@ extern "C" {
20012004
pub fn sbrk(increment: intptr_t) -> *mut c_void;
20022005
pub fn setresgid(rgid: crate::gid_t, egid: crate::gid_t, sgid: crate::gid_t) -> c_int;
20032006
pub fn setresuid(ruid: crate::uid_t, euid: crate::uid_t, suid: crate::uid_t) -> c_int;
2004-
#[cfg_attr(gnu_time_bits64, link_name = "__wait4_time64")]
2007+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__wait4_time64")]
20052008
pub fn wait4(
20062009
pid: crate::pid_t,
20072010
status: *mut c_int,

src/unix/mod.rs

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,7 @@ extern "C" {
881881
all(not(gnu_time_bits64), gnu_file_offset_bits64),
882882
link_name = "fstat64"
883883
)]
884+
#[cfg_attr(musl_time64, link_name = "__fstat_time64")]
884885
pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
885886

886887
pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int;
@@ -899,6 +900,7 @@ extern "C" {
899900
all(not(gnu_time_bits64), gnu_file_offset_bits64),
900901
link_name = "stat64"
901902
)]
903+
#[cfg_attr(musl_time64, link_name = "__stat_time64")]
902904
pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
903905

904906
pub fn pclose(stream: *mut crate::FILE) -> c_int;
@@ -991,6 +993,7 @@ extern "C" {
991993
all(not(gnu_time_bits64), gnu_file_offset_bits64),
992994
link_name = "fstatat64"
993995
)]
996+
#[cfg_attr(musl_time64, link_name = "__fstatat_time64")]
994997
pub fn fstatat(dirfd: c_int, pathname: *const c_char, buf: *mut stat, flags: c_int) -> c_int;
995998
pub fn linkat(
996999
olddirfd: c_int,
@@ -1091,6 +1094,7 @@ extern "C" {
10911094
)]
10921095
#[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")]
10931096
#[cfg_attr(gnu_time_bits64, link_name = "__nanosleep64")]
1097+
#[cfg_attr(musl_time64, link_name = "__nanosleep_time64")]
10941098
pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> c_int;
10951099
pub fn tcgetpgrp(fd: c_int) -> pid_t;
10961100
pub fn tcsetpgrp(fd: c_int, pgrp: crate::pid_t) -> c_int;
@@ -1135,7 +1139,7 @@ extern "C" {
11351139
pub fn umask(mask: mode_t) -> mode_t;
11361140

11371141
#[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
1138-
#[cfg_attr(gnu_time_bits64, link_name = "__utime64")]
1142+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__utime64")]
11391143
pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int;
11401144

11411145
#[cfg_attr(
@@ -1190,6 +1194,7 @@ extern "C" {
11901194
all(not(gnu_time_bits64), gnu_file_offset_bits64),
11911195
link_name = "lstat64"
11921196
)]
1197+
#[cfg_attr(musl_time64, link_name = "__lstat_time64")]
11931198
pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
11941199

11951200
#[cfg_attr(
@@ -1221,6 +1226,7 @@ extern "C" {
12211226

12221227
#[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
12231228
#[cfg_attr(gnu_time_bits64, link_name = "__getrusage64")]
1229+
#[cfg_attr(musl_time64, link_name = "__getrusage_time64")]
12241230
pub fn getrusage(resource: c_int, usage: *mut rusage) -> c_int;
12251231

12261232
#[cfg_attr(
@@ -1297,6 +1303,7 @@ extern "C" {
12971303
link_name = "pthread_cond_timedwait$UNIX2003"
12981304
)]
12991305
#[cfg_attr(gnu_time_bits64, link_name = "__pthread_cond_timedwait64")]
1306+
#[cfg_attr(musl_time64, link_name = "__pthread_cond_timedwait_time64")]
13001307
pub fn pthread_cond_timedwait(
13011308
cond: *mut pthread_cond_t,
13021309
lock: *mut pthread_mutex_t,
@@ -1365,9 +1372,11 @@ extern "C" {
13651372

13661373
#[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
13671374
#[cfg_attr(gnu_time_bits64, link_name = "__utimes64")]
1375+
#[cfg_attr(musl_time64, link_name = "__utimes_time64")]
13681376
pub fn utimes(filename: *const c_char, times: *const crate::timeval) -> c_int;
13691377
pub fn dlopen(filename: *const c_char, flag: c_int) -> *mut c_void;
13701378
pub fn dlerror() -> *mut c_char;
1379+
#[cfg_attr(musl_time64, link_name = "__dlsym_time64")]
13711380
pub fn dlsym(handle: *mut c_void, symbol: *const c_char) -> *mut c_void;
13721381
pub fn dlclose(handle: *mut c_void) -> c_int;
13731382

@@ -1415,49 +1424,44 @@ extern "C" {
14151424
pub fn res_init() -> c_int;
14161425

14171426
#[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
1418-
#[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1419-
// FIXME(time): for `time_t`
14201427
#[cfg_attr(gnu_time_bits64, link_name = "__gmtime64_r")]
1428+
#[cfg_attr(musl_not_time64, allow(deprecated))]
1429+
#[cfg_attr(musl_time64, link_name = "__gmtime64_r")]
14211430
pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
14221431
#[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
1423-
#[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1424-
// FIXME(time): for `time_t`
14251432
#[cfg_attr(gnu_time_bits64, link_name = "__localtime64_r")]
1433+
#[cfg_attr(musl_not_time64, allow(deprecated))]
1434+
#[cfg_attr(musl_time64, link_name = "__localtime64_r")]
14261435
pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
14271436
#[cfg_attr(
14281437
all(target_os = "macos", target_arch = "x86"),
14291438
link_name = "mktime$UNIX2003"
14301439
)]
14311440
#[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
1432-
#[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1433-
// FIXME: for `time_t`
1434-
#[cfg_attr(gnu_time_bits64, link_name = "__mktime64")]
1441+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__mktime64")]
1442+
#[cfg_attr(musl_not_time64, allow(deprecated))]
14351443
pub fn mktime(tm: *mut tm) -> time_t;
14361444
#[cfg_attr(target_os = "netbsd", link_name = "__time50")]
1437-
#[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1438-
// FIXME: for `time_t`
1439-
#[cfg_attr(gnu_time_bits64, link_name = "__time64")]
1445+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__time64")]
1446+
#[cfg_attr(musl_not_time64, allow(deprecated))]
14401447
pub fn time(time: *mut time_t) -> time_t;
14411448
#[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
1442-
#[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1443-
// FIXME(time): for `time_t`
1444-
#[cfg_attr(gnu_time_bits64, link_name = "__gmtime64")]
1449+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__gmtime64")]
1450+
#[cfg_attr(musl_not_time64, allow(deprecated))]
14451451
pub fn gmtime(time_p: *const time_t) -> *mut tm;
14461452
#[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
1447-
#[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1448-
// FIXME(time): for `time_t`
1449-
#[cfg_attr(gnu_time_bits64, link_name = "__localtime64")]
1453+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__localtime64")]
1454+
#[cfg_attr(musl_not_time64, allow(deprecated))]
14501455
pub fn localtime(time_p: *const time_t) -> *mut tm;
14511456
#[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
1452-
#[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1453-
// FIXME(time): for `time_t`
1454-
#[cfg_attr(gnu_time_bits64, link_name = "__difftime64")]
1457+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__difftime64")]
1458+
#[cfg_attr(musl_not_time64, allow(deprecated))]
14551459
pub fn difftime(time1: time_t, time0: time_t) -> c_double;
14561460
#[cfg(not(target_os = "aix"))]
14571461
#[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
1458-
#[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1459-
// FIXME(time): for `time_t`
14601462
#[cfg_attr(gnu_time_bits64, link_name = "__timegm64")]
1463+
#[cfg_attr(musl_not_time64, allow(deprecated))]
1464+
#[cfg_attr(musl_time64, link_name = "__timegm_time64")]
14611465
pub fn timegm(tm: *mut crate::tm) -> time_t;
14621466

14631467
#[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
@@ -1517,6 +1521,7 @@ extern "C" {
15171521
#[cfg_attr(target_os = "netbsd", link_name = "__select50")]
15181522
#[cfg_attr(target_os = "aix", link_name = "__fd_select")]
15191523
#[cfg_attr(gnu_time_bits64, link_name = "__select64")]
1524+
#[cfg_attr(musl_time64, link_name = "__select_time64")]
15201525
pub fn select(
15211526
nfds: c_int,
15221527
readfds: *mut fd_set,
@@ -1639,7 +1644,7 @@ cfg_if! {
16391644
target_os = "aix",
16401645
)))] {
16411646
extern "C" {
1642-
#[cfg_attr(gnu_time_bits64, link_name = "__adjtime64")]
1647+
#[cfg_attr(any(gnu_time_bits64, musl_time64), link_name = "__adjtime64")]
16431648
pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> c_int;
16441649
}
16451650
} else if #[cfg(target_os = "solaris")] {
@@ -1794,6 +1799,7 @@ cfg_if! {
17941799
)]
17951800
#[cfg_attr(target_os = "netbsd", link_name = "__pselect50")]
17961801
#[cfg_attr(gnu_time_bits64, link_name = "__pselect64")]
1802+
#[cfg_attr(musl_time64, link_name = "__pselect_time64")]
17971803
pub fn pselect(
17981804
nfds: c_int,
17991805
readfds: *mut fd_set,

0 commit comments

Comments
 (0)