Skip to content

Commit 6acf1bd

Browse files
xingxue-ibmtgross35
authored andcommitted
Restore non-POSIX functions guarded by the _KERNEL macro.
1 parent 041ac9d commit 6acf1bd

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
@@ -5411,6 +5411,7 @@ fn test_aix(target: &str) {
54115411
"net/if_dl.h",
54125412
"netdb.h",
54135413
"netinet/tcp.h",
5414+
"netinet/sctp.h",
54145415
"pthread.h",
54155416
"pwd.h",
54165417
"rpcsvc/mount.h",
@@ -5644,6 +5645,13 @@ fn test_aix(target: &str) {
56445645
"setdomainname" | "settimeofday" | "statfs" | "statfs64" | "statx" | "swapoff"
56455646
| "swapon" | "utmpname" | "setgroups" => true,
56465647

5648+
// These non-POSIX functions are guarded by the _KERNEL macro in the AIX headers.
5649+
"recvmmsg" | "sendmmsg" | "sethostid" | "sethostname" | "splice" => true,
5650+
5651+
// 'mount' is available in the system's libc.a and has a man page, but it is
5652+
// not declared in the AIX headers."
5653+
"mount" => true,
5654+
56475655
_ => false,
56485656
}
56495657
});

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;
@@ -3027,6 +3028,7 @@ extern "C" {
30273028
pub fn mincore(addr: caddr_t, len: size_t, vec: *mut c_char) -> c_int;
30283029
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
30293030
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int;
3031+
pub fn mount(device: *const c_char, path: *const c_char, flags: c_int) -> c_int;
30303032
pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
30313033
pub fn mq_close(mqd: crate::mqd_t) -> c_int;
30323034
pub fn mq_getattr(mqd: crate::mqd_t, attr: *mut crate::mq_attr) -> c_int;
@@ -3196,6 +3198,13 @@ extern "C" {
31963198
addr: *mut crate::sockaddr,
31973199
addrlen: *mut crate::socklen_t,
31983200
) -> ssize_t;
3201+
pub fn recvmmsg(
3202+
sockfd: c_int,
3203+
msgvec: *mut crate::mmsghdr,
3204+
vlen: c_uint,
3205+
flags: c_int,
3206+
timeout: *mut crate::timespec,
3207+
) -> c_int;
31993208
// AIX header socket.h maps recvmsg() to nrecvmsg().
32003209
#[link_name = "nrecvmsg"]
32013210
pub fn recvmsg(sockfd: c_int, msg: *mut msghdr, flags: c_int) -> ssize_t;
@@ -3226,6 +3235,14 @@ extern "C" {
32263235
policy: c_int,
32273236
param: *const crate::sched_param,
32283237
) -> c_int;
3238+
pub fn sctp_opt_info(
3239+
sd: c_int,
3240+
id: crate::sctp_assoc_t,
3241+
opt: c_int,
3242+
arg_size: *mut c_void,
3243+
size: *mut size_t,
3244+
) -> c_int;
3245+
pub fn sctp_peeloff(s: c_int, id: *mut c_uint) -> c_int;
32293246
pub fn seed48(xseed: *mut c_ushort) -> *mut c_ushort;
32303247
pub fn seekdir(dirp: *mut crate::DIR, loc: c_long);
32313248
pub fn sem_close(sem: *mut sem_t) -> c_int;
@@ -3239,13 +3256,16 @@ extern "C" {
32393256
pub fn semget(key: crate::key_t, nsems: c_int, semflag: c_int) -> c_int;
32403257
pub fn semop(semid: c_int, sops: *mut sembuf, nsops: size_t) -> c_int;
32413258
pub fn send_file(socket: *mut c_int, iobuf: *mut sf_parms, flags: c_uint) -> ssize_t;
3259+
pub fn sendmmsg(sockfd: c_int, msgvec: *mut mmsghdr, vlen: c_uint, flags: c_int) -> c_int;
32423260
// AIX header socket.h maps sendmsg() to nsendmsg().
32433261
#[link_name = "nsendmsg"]
32443262
pub fn sendmsg(sockfd: c_int, msg: *const msghdr, flags: c_int) -> ssize_t;
32453263
pub fn setcontext(ucp: *const ucontext_t) -> c_int;
32463264
pub fn setdomainname(name: *const c_char, len: c_int) -> c_int;
32473265
pub fn setgroups(ngroups: c_int, ptr: *const crate::gid_t) -> c_int;
32483266
pub fn setgrent();
3267+
pub fn sethostid(hostid: c_int) -> c_int;
3268+
pub fn sethostname(name: *const c_char, len: c_int) -> c_int;
32493269
pub fn setmntent(filename: *const c_char, ty: *const c_char) -> *mut crate::FILE;
32503270
pub fn setpriority(which: c_int, who: id_t, priority: c_int) -> c_int;
32513271
pub fn setpwent();
@@ -3274,6 +3294,7 @@ extern "C" {
32743294
pub fn shmget(key: key_t, size: size_t, shmflg: c_int) -> c_int;
32753295
pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int;
32763296
pub fn shm_unlink(name: *const c_char) -> c_int;
3297+
pub fn splice(socket1: c_int, socket2: c_int, flags: c_int) -> c_int;
32773298
pub fn srand(seed: c_uint);
32783299
pub fn srand48(seed: c_long);
32793300
pub fn stat64(path: *const c_char, buf: *mut stat64) -> c_int;

0 commit comments

Comments
 (0)