Skip to content

Commit 1f84e92

Browse files
xingxue-ibmtgross35
authored andcommitted
Restore non-POSIX functions guarded by the _KERNEL macro.
(backport <rust-lang#4607>) (cherry picked from commit b02c121)
1 parent 06a23bd commit 1f84e92

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

libc-test/build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5583,6 +5583,7 @@ fn test_aix(target: &str) {
55835583
"net/if_dl.h",
55845584
"netdb.h",
55855585
"netinet/tcp.h",
5586+
"netinet/sctp.h",
55865587
"pthread.h",
55875588
"pwd.h",
55885589
"rpcsvc/mount.h",
@@ -5822,6 +5823,13 @@ fn test_aix(target: &str) {
58225823
"setdomainname" | "settimeofday" | "statfs" | "statfs64" | "statx" | "swapoff"
58235824
| "swapon" | "utmpname" | "setgroups" => true,
58245825

5826+
// These non-POSIX functions are guarded by the _KERNEL macro in the AIX headers.
5827+
"recvmmsg" | "sendmmsg" | "sethostid" | "sethostname" | "splice" => true,
5828+
5829+
// 'mount' is available in the system's libc.a and has a man page, but it is
5830+
// not declared in the AIX headers."
5831+
"mount" => true,
5832+
58255833
_ => false,
58265834
}
58275835
});

libc-test/semver/aix.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,6 +2133,7 @@ mmap
21332133
mmsghdr
21342134
mntent
21352135
mode_t
2136+
mount
21362137
mprotect
21372138
mq_attr
21382139
mq_close
@@ -2363,6 +2364,7 @@ realloc
23632364
realpath
23642365
recv
23652366
recvfrom
2367+
recvmmsg
23662368
recvmsg
23672369
regcomp
23682370
regerror
@@ -2393,6 +2395,9 @@ sched_rr_get_interval
23932395
sched_setparam
23942396
sched_setscheduler
23952397
sched_yield
2398+
sctp_assoc_t
2399+
sctp_opt_info
2400+
sctp_peeloff
23962401
seed48
23972402
seekdir
23982403
select
@@ -2413,6 +2418,7 @@ semget
24132418
semop
24142419
send
24152420
send_file
2421+
sendmmsg
24162422
sendmsg
24172423
sendto
24182424
servent
@@ -2425,6 +2431,8 @@ seteuid
24252431
setgid
24262432
setgrent
24272433
setgroups
2434+
sethostid
2435+
sethostname
24282436
setitimer
24292437
setlocale
24302438
setlogmask
@@ -2484,6 +2492,7 @@ socket
24842492
socketpair
24852493
socklen_t
24862494
speed_t
2495+
splice
24872496
sprintf
24882497
srand
24892498
srand48

src/unix/aix/mod.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ pub type rlim64_t = c_ulonglong;
4949

5050
pub type sem_t = c_int;
5151
pub type pollset_t = c_int;
52+
pub type sctp_assoc_t = c_uint;
5253

5354
pub type pthread_rwlockattr_t = *mut c_void;
5455
pub type pthread_condattr_t = *mut c_void;
@@ -3030,6 +3031,7 @@ extern "C" {
30303031
pub fn mincore(addr: caddr_t, len: size_t, vec: *mut c_char) -> c_int;
30313032
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
30323033
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int;
3034+
pub fn mount(device: *const c_char, path: *const c_char, flags: c_int) -> c_int;
30333035
pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
30343036
pub fn mq_close(mqd: crate::mqd_t) -> c_int;
30353037
pub fn mq_getattr(mqd: crate::mqd_t, attr: *mut crate::mq_attr) -> c_int;
@@ -3199,6 +3201,13 @@ extern "C" {
31993201
addr: *mut crate::sockaddr,
32003202
addrlen: *mut crate::socklen_t,
32013203
) -> ssize_t;
3204+
pub fn recvmmsg(
3205+
sockfd: c_int,
3206+
msgvec: *mut crate::mmsghdr,
3207+
vlen: c_uint,
3208+
flags: c_int,
3209+
timeout: *mut crate::timespec,
3210+
) -> c_int;
32023211
// AIX header socket.h maps recvmsg() to nrecvmsg().
32033212
#[link_name = "nrecvmsg"]
32043213
pub fn recvmsg(sockfd: c_int, msg: *mut msghdr, flags: c_int) -> ssize_t;
@@ -3229,6 +3238,14 @@ extern "C" {
32293238
policy: c_int,
32303239
param: *const crate::sched_param,
32313240
) -> c_int;
3241+
pub fn sctp_opt_info(
3242+
sd: c_int,
3243+
id: crate::sctp_assoc_t,
3244+
opt: c_int,
3245+
arg_size: *mut c_void,
3246+
size: *mut size_t,
3247+
) -> c_int;
3248+
pub fn sctp_peeloff(s: c_int, id: *mut c_uint) -> c_int;
32323249
pub fn seed48(xseed: *mut c_ushort) -> *mut c_ushort;
32333250
pub fn seekdir(dirp: *mut crate::DIR, loc: c_long);
32343251
pub fn sem_close(sem: *mut sem_t) -> c_int;
@@ -3242,13 +3259,16 @@ extern "C" {
32423259
pub fn semget(key: crate::key_t, nsems: c_int, semflag: c_int) -> c_int;
32433260
pub fn semop(semid: c_int, sops: *mut sembuf, nsops: size_t) -> c_int;
32443261
pub fn send_file(socket: *mut c_int, iobuf: *mut sf_parms, flags: c_uint) -> ssize_t;
3262+
pub fn sendmmsg(sockfd: c_int, msgvec: *mut mmsghdr, vlen: c_uint, flags: c_int) -> c_int;
32453263
// AIX header socket.h maps sendmsg() to nsendmsg().
32463264
#[link_name = "nsendmsg"]
32473265
pub fn sendmsg(sockfd: c_int, msg: *const msghdr, flags: c_int) -> ssize_t;
32483266
pub fn setcontext(ucp: *const ucontext_t) -> c_int;
32493267
pub fn setdomainname(name: *const c_char, len: c_int) -> c_int;
32503268
pub fn setgroups(ngroups: c_int, ptr: *const crate::gid_t) -> c_int;
32513269
pub fn setgrent();
3270+
pub fn sethostid(hostid: c_int) -> c_int;
3271+
pub fn sethostname(name: *const c_char, len: c_int) -> c_int;
32523272
pub fn setmntent(filename: *const c_char, ty: *const c_char) -> *mut crate::FILE;
32533273
pub fn setpriority(which: c_int, who: id_t, priority: c_int) -> c_int;
32543274
pub fn setpwent();
@@ -3277,6 +3297,7 @@ extern "C" {
32773297
pub fn shmget(key: key_t, size: size_t, shmflg: c_int) -> c_int;
32783298
pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int;
32793299
pub fn shm_unlink(name: *const c_char) -> c_int;
3300+
pub fn splice(socket1: c_int, socket2: c_int, flags: c_int) -> c_int;
32803301
pub fn srand(seed: c_uint);
32813302
pub fn srand48(seed: c_long);
32823303
pub fn stat64(path: *const c_char, buf: *mut stat64) -> c_int;

0 commit comments

Comments
 (0)