Skip to content

Commit b95fa26

Browse files
committed
Auto merge of #1115 - asomers:libutil_overlinking, r=alexcrichton
On FreeBSD and Dragonfly, don't unnecessarily link to libutil Also, alphabetize this section, since I'm merging two sections anyway. Fixes #1113
2 parents 9525816 + e2b69a3 commit b95fa26

File tree

1 file changed

+135
-136
lines changed
  • src/unix/bsd/freebsdlike

1 file changed

+135
-136
lines changed

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 135 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,33 +1022,68 @@ f! {
10221022
}
10231023

10241024
extern {
1025-
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
1025+
pub fn accept4(s: ::c_int, addr: *mut ::sockaddr,
1026+
addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int;
1027+
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
1028+
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
1029+
pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
1030+
pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
1031+
pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
1032+
pub fn aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int,
1033+
timeout: *const ::timespec) -> ::c_int;
1034+
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
1035+
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
1036+
pub fn duplocale(base: ::locale_t) -> ::locale_t;
10261037
pub fn endutxent();
1027-
pub fn getutxent() -> *mut utmpx;
1028-
pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
1029-
pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
1030-
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
1031-
pub fn setutxent();
1032-
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
1033-
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
1034-
pub fn getgrouplist(name: *const ::c_char,
1035-
basegid: ::gid_t,
1036-
groups: *mut ::gid_t,
1037-
ngroups: *mut ::c_int) -> ::c_int;
1038-
pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
1038+
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
1039+
pub fn getdomainname(name: *mut ::c_char, len: ::c_int) -> ::c_int;
1040+
pub fn getgrent_r(grp: *mut ::group,
1041+
buf: *mut ::c_char,
1042+
buflen: ::size_t,
1043+
result: *mut *mut ::group) -> ::c_int;
10391044
#[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")]
10401045
pub fn getpwent_r(pwd: *mut ::passwd,
10411046
buf: *mut ::c_char,
10421047
buflen: ::size_t,
10431048
result: *mut *mut ::passwd) -> ::c_int;
1044-
pub fn getgrent_r(grp: *mut ::group,
1045-
buf: *mut ::c_char,
1046-
buflen: ::size_t,
1047-
result: *mut *mut ::group) -> ::c_int;
1048-
pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
1049+
pub fn getgrouplist(name: *const ::c_char,
1050+
basegid: ::gid_t,
1051+
groups: *mut ::gid_t,
1052+
ngroups: *mut ::c_int) -> ::c_int;
1053+
pub fn getnameinfo(sa: *const ::sockaddr,
1054+
salen: ::socklen_t,
1055+
host: *mut ::c_char,
1056+
hostlen: ::size_t,
1057+
serv: *mut ::c_char,
1058+
servlen: ::size_t,
1059+
flags: ::c_int) -> ::c_int;
1060+
pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int;
1061+
pub fn getutxent() -> *mut utmpx;
1062+
pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
1063+
pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
1064+
pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
1065+
#[cfg_attr(target_os = "freebsd", link_name = "kevent@FBSD_1.0")]
1066+
pub fn kevent(kq: ::c_int,
1067+
changelist: *const ::kevent,
1068+
nchanges: ::c_int,
1069+
eventlist: *mut ::kevent,
1070+
nevents: ::c_int,
1071+
timeout: *const ::timespec) -> ::c_int;
1072+
pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
1073+
nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
1074+
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
1075+
pub fn memrchr(cx: *const ::c_void,
1076+
c: ::c_int,
1077+
n: ::size_t) -> *mut ::c_void;
1078+
pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
1079+
mode: ::mode_t) -> ::c_int;
1080+
#[cfg_attr(target_os = "freebsd", link_name = "mknodat@FBSD_1.1")]
1081+
pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
1082+
mode: ::mode_t, dev: dev_t) -> ::c_int;
10491083
pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
10501084
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
10511085
pub fn mq_notify(mqd: ::mqd_t, notification: *const ::sigevent) -> ::c_int;
1086+
pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
10521087
pub fn mq_receive(mqd: ::mqd_t,
10531088
msg_ptr: *mut ::c_char,
10541089
msg_len: ::size_t,
@@ -1071,86 +1106,111 @@ extern {
10711106
msq_prio: ::c_uint,
10721107
abs_timeout: *const ::timespec) -> ::c_int;
10731108
pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
1074-
}
1075-
1076-
#[link(name = "util")]
1077-
extern {
1078-
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
1079-
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
1080-
pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
1081-
pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
1082-
pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
1083-
pub fn aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int,
1084-
timeout: *const ::timespec) -> ::c_int;
1085-
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
1086-
pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
1087-
nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
1088-
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
1089-
pub fn getnameinfo(sa: *const ::sockaddr,
1090-
salen: ::socklen_t,
1091-
host: *mut ::c_char,
1092-
hostlen: ::size_t,
1093-
serv: *mut ::c_char,
1094-
servlen: ::size_t,
1095-
flags: ::c_int) -> ::c_int;
1096-
#[cfg_attr(target_os = "freebsd", link_name = "kevent@FBSD_1.0")]
1097-
pub fn kevent(kq: ::c_int,
1098-
changelist: *const ::kevent,
1099-
nchanges: ::c_int,
1100-
eventlist: *mut ::kevent,
1101-
nevents: ::c_int,
1102-
timeout: *const ::timespec) -> ::c_int;
11031109
pub fn mincore(addr: *const ::c_void, len: ::size_t,
11041110
vec: *mut ::c_char) -> ::c_int;
1105-
pub fn pwritev(fd: ::c_int,
1106-
iov: *const ::iovec,
1107-
iovcnt: ::c_int,
1108-
offset: ::off_t) -> ::ssize_t;
1111+
pub fn newlocale(mask: ::c_int,
1112+
locale: *const ::c_char,
1113+
base: ::locale_t) -> ::locale_t;
1114+
pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
1115+
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
1116+
pub fn ppoll(fds: *mut ::pollfd,
1117+
nfds: ::nfds_t,
1118+
timeout: *const ::timespec,
1119+
sigmask: *const sigset_t) -> ::c_int;
11091120
pub fn preadv(fd: ::c_int,
11101121
iov: *const ::iovec,
11111122
iovcnt: ::c_int,
11121123
offset: ::off_t) -> ::ssize_t;
1113-
pub fn sysctlnametomib(name: *const ::c_char,
1114-
mibp: *mut ::c_int,
1115-
sizep: *mut ::size_t)
1116-
-> ::c_int;
1117-
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
1118-
-> ::c_int;
1119-
pub fn sysctl(name: *const ::c_int,
1120-
namelen: ::c_uint,
1121-
oldp: *mut ::c_void,
1122-
oldlenp: *mut ::size_t,
1123-
newp: *const ::c_void,
1124-
newlen: ::size_t)
1125-
-> ::c_int;
1126-
pub fn sysctlbyname(name: *const ::c_char,
1127-
oldp: *mut ::c_void,
1128-
oldlenp: *mut ::size_t,
1129-
newp: *const ::c_void,
1130-
newlen: ::size_t)
1131-
-> ::c_int;
1124+
pub fn pthread_attr_get_np(tid: ::pthread_t,
1125+
attr: *mut ::pthread_attr_t) -> ::c_int;
1126+
pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
1127+
guardsize: *mut ::size_t) -> ::c_int;
1128+
pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
1129+
stackaddr: *mut *mut ::c_void,
1130+
stacksize: *mut ::size_t) -> ::c_int;
1131+
pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
1132+
clock_id: *mut clockid_t) -> ::c_int;
1133+
pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
1134+
pshared: *mut ::c_int) -> ::c_int;
1135+
pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
1136+
clock_id: ::clockid_t) -> ::c_int;
1137+
pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
1138+
pshared: ::c_int) -> ::c_int;
1139+
pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
1140+
abstime: *const ::timespec) -> ::c_int;
1141+
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
1142+
pshared: *mut ::c_int) -> ::c_int;
1143+
pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
1144+
pshared: ::c_int) -> ::c_int;
1145+
pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
1146+
val: *mut ::c_int) -> ::c_int;
1147+
pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
1148+
val: ::c_int) -> ::c_int;
1149+
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
1150+
pub fn ptrace(request: ::c_int,
1151+
pid: ::pid_t,
1152+
addr: *mut ::c_char,
1153+
data: ::c_int) -> ::c_int;
1154+
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
1155+
pub fn pwritev(fd: ::c_int,
1156+
iov: *const ::iovec,
1157+
iovcnt: ::c_int,
1158+
offset: ::off_t) -> ::ssize_t;
1159+
pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char;
1160+
pub fn rtprio(function: ::c_int, pid: ::pid_t, rtp: *mut rtprio) -> ::c_int;
1161+
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
11321162
pub fn sched_setscheduler(pid: ::pid_t,
11331163
policy: ::c_int,
11341164
param: *const ::sched_param) -> ::c_int;
1135-
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
1136-
pub fn memrchr(cx: *const ::c_void,
1137-
c: ::c_int,
1138-
n: ::size_t) -> *mut ::c_void;
1165+
pub fn sem_getvalue(sem: *mut sem_t,
1166+
sval: *mut ::c_int) -> ::c_int;
1167+
pub fn sem_timedwait(sem: *mut sem_t,
1168+
abstime: *const ::timespec) -> ::c_int;
11391169
pub fn sendfile(fd: ::c_int,
11401170
s: ::c_int,
11411171
offset: ::off_t,
11421172
nbytes: ::size_t,
11431173
hdtr: *mut ::sf_hdtr,
11441174
sbytes: *mut ::off_t,
11451175
flags: ::c_int) -> ::c_int;
1176+
pub fn setdomainname(name: *const ::c_char, len: ::c_int) -> ::c_int;
1177+
pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int;
1178+
pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int;
1179+
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
1180+
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
1181+
pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
1182+
pub fn setutxent();
1183+
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
1184+
-> ::c_int;
11461185
pub fn sigtimedwait(set: *const sigset_t,
11471186
info: *mut siginfo_t,
11481187
timeout: *const ::timespec) -> ::c_int;
11491188
pub fn sigwaitinfo(set: *const sigset_t,
11501189
info: *mut siginfo_t) -> ::c_int;
1151-
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
1190+
pub fn sysctl(name: *const ::c_int,
1191+
namelen: ::c_uint,
1192+
oldp: *mut ::c_void,
1193+
oldlenp: *mut ::size_t,
1194+
newp: *const ::c_void,
1195+
newlen: ::size_t)
1196+
-> ::c_int;
1197+
pub fn sysctlbyname(name: *const ::c_char,
1198+
oldp: *mut ::c_void,
1199+
oldlenp: *mut ::size_t,
1200+
newp: *const ::c_void,
1201+
newlen: ::size_t)
1202+
-> ::c_int;
1203+
pub fn sysctlnametomib(name: *const ::c_char,
1204+
mibp: *mut ::c_int,
1205+
sizep: *mut ::size_t)
1206+
-> ::c_int;
1207+
pub fn uselocale(loc: ::locale_t) -> ::locale_t;
11521208
pub fn utimensat(dirfd: ::c_int, path: *const ::c_char,
11531209
times: *const ::timespec, flag: ::c_int) -> ::c_int;
1210+
}
1211+
1212+
#[link(name = "util")]
1213+
extern {
11541214
pub fn openpty(amaster: *mut ::c_int,
11551215
aslave: *mut ::c_int,
11561216
name: *mut ::c_char,
@@ -1160,67 +1220,6 @@ extern {
11601220
name: *mut ::c_char,
11611221
termp: *mut termios,
11621222
winp: *mut ::winsize) -> ::pid_t;
1163-
pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
1164-
pub fn duplocale(base: ::locale_t) -> ::locale_t;
1165-
pub fn newlocale(mask: ::c_int,
1166-
locale: *const ::c_char,
1167-
base: ::locale_t) -> ::locale_t;
1168-
pub fn uselocale(loc: ::locale_t) -> ::locale_t;
1169-
pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char;
1170-
pub fn accept4(s: ::c_int, addr: *mut ::sockaddr,
1171-
addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int;
1172-
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
1173-
pub fn pthread_attr_get_np(tid: ::pthread_t,
1174-
attr: *mut ::pthread_attr_t) -> ::c_int;
1175-
pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
1176-
guardsize: *mut ::size_t) -> ::c_int;
1177-
pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
1178-
stackaddr: *mut *mut ::c_void,
1179-
stacksize: *mut ::size_t) -> ::c_int;
1180-
pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
1181-
pshared: ::c_int) -> ::c_int;
1182-
pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
1183-
pshared: *mut ::c_int) -> ::c_int;
1184-
pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
1185-
pshared: ::c_int) -> ::c_int;
1186-
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
1187-
pshared: *mut ::c_int) -> ::c_int;
1188-
pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
1189-
val: *mut ::c_int) -> ::c_int;
1190-
pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
1191-
val: ::c_int) -> ::c_int;
1192-
pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int;
1193-
pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int;
1194-
pub fn rtprio(function: ::c_int, pid: ::pid_t, rtp: *mut rtprio) -> ::c_int;
1195-
1196-
#[cfg_attr(target_os = "freebsd", link_name = "mknodat@FBSD_1.1")]
1197-
pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
1198-
mode: ::mode_t, dev: dev_t) -> ::c_int;
1199-
pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
1200-
mode: ::mode_t) -> ::c_int;
1201-
pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
1202-
clock_id: *mut clockid_t) -> ::c_int;
1203-
pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
1204-
clock_id: ::clockid_t) -> ::c_int;
1205-
pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int;
1206-
pub fn sem_timedwait(sem: *mut sem_t,
1207-
abstime: *const ::timespec) -> ::c_int;
1208-
pub fn sem_getvalue(sem: *mut sem_t,
1209-
sval: *mut ::c_int) -> ::c_int;
1210-
pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
1211-
abstime: *const ::timespec) -> ::c_int;
1212-
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
1213-
pub fn ppoll(fds: *mut ::pollfd,
1214-
nfds: ::nfds_t,
1215-
timeout: *const ::timespec,
1216-
sigmask: *const sigset_t) -> ::c_int;
1217-
pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
1218-
pub fn getdomainname(name: *mut ::c_char, len: ::c_int) -> ::c_int;
1219-
pub fn setdomainname(name: *const ::c_char, len: ::c_int) -> ::c_int;
1220-
pub fn ptrace(request: ::c_int,
1221-
pid: ::pid_t,
1222-
addr: *mut ::c_char,
1223-
data: ::c_int) -> ::c_int;
12241223
}
12251224

12261225
cfg_if! {

0 commit comments

Comments
 (0)