Skip to content

Restore some non-POSIX functions for AIX #4604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5738,6 +5738,14 @@ fn test_aix(target: &str) {
"setdomainname" | "settimeofday" | "statfs" | "statfs64" | "statx" | "swapoff"
| "swapon" | "utmpname" | "setgroups" => true,

// These non-POSIX functions are guarded by the _KERNEL macro in the AIX headers.
"recvmmsg" | "sendmmsg" | "sctp_opt_info" | "sctp_peeloff" | "sethostid"
| "sethostname" | "splice" => true,

// 'mount' is available in the system's libc.a and has a man page, but it is
// not declared in the AIX headers."
"mount" => true,

_ => false,
}
});
Expand Down
8 changes: 8 additions & 0 deletions libc-test/semver/aix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2133,6 +2133,7 @@ mmap
mmsghdr
mntent
mode_t
mount
mprotect
mq_attr
mq_close
Expand Down Expand Up @@ -2363,6 +2364,7 @@ realloc
realpath
recv
recvfrom
recvmmsg
recvmsg
regcomp
regerror
Expand Down Expand Up @@ -2393,6 +2395,8 @@ sched_rr_get_interval
sched_setparam
sched_setscheduler
sched_yield
sctp_opt_info
sctp_peeloff
seed48
seekdir
select
Expand All @@ -2413,6 +2417,7 @@ semget
semop
send
send_file
sendmmsg
sendmsg
sendto
servent
Expand All @@ -2425,6 +2430,8 @@ seteuid
setgid
setgrent
setgroups
sethostid
sethostname
setitimer
setlocale
setlogmask
Expand Down Expand Up @@ -2484,6 +2491,7 @@ socket
socketpair
socklen_t
speed_t
splice
sprintf
srand
srand48
Expand Down
20 changes: 20 additions & 0 deletions src/unix/aix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3027,6 +3027,7 @@ extern "C" {
pub fn mincore(addr: caddr_t, len: size_t, vec: *mut c_char) -> c_int;
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int;
pub fn mount(device: *const c_char, path: *const c_char, flags: c_int) -> c_int;
pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
pub fn mq_close(mqd: crate::mqd_t) -> c_int;
pub fn mq_getattr(mqd: crate::mqd_t, attr: *mut crate::mq_attr) -> c_int;
Expand Down Expand Up @@ -3196,6 +3197,13 @@ extern "C" {
addr: *mut crate::sockaddr,
addrlen: *mut crate::socklen_t,
) -> ssize_t;
pub fn recvmmsg(
sockfd: c_int,
msgvec: *mut crate::mmsghdr,
vlen: c_uint,
flags: c_int,
timeout: *mut crate::timespec,
) -> c_int;
// AIX header socket.h maps recvmsg() to nrecvmsg().
#[link_name = "nrecvmsg"]
pub fn recvmsg(sockfd: c_int, msg: *mut msghdr, flags: c_int) -> ssize_t;
Expand Down Expand Up @@ -3226,6 +3234,14 @@ extern "C" {
policy: c_int,
param: *const crate::sched_param,
) -> c_int;
pub fn sctp_opt_info(
sd: c_int,
id: c_uint,
opt: c_int,
arg_size: *mut c_void,
size: *mut size_t,
) -> c_int;
pub fn sctp_peeloff(s: c_int, id: *mut c_uint) -> c_int;
pub fn seed48(xseed: *mut c_ushort) -> *mut c_ushort;
pub fn seekdir(dirp: *mut crate::DIR, loc: c_long);
pub fn sem_close(sem: *mut sem_t) -> c_int;
Expand All @@ -3239,13 +3255,16 @@ extern "C" {
pub fn semget(key: crate::key_t, nsems: c_int, semflag: c_int) -> c_int;
pub fn semop(semid: c_int, sops: *mut sembuf, nsops: size_t) -> c_int;
pub fn send_file(socket: *mut c_int, iobuf: *mut sf_parms, flags: c_uint) -> ssize_t;
pub fn sendmmsg(sockfd: c_int, msgvec: *mut mmsghdr, vlen: c_uint, flags: c_int) -> c_int;
// AIX header socket.h maps sendmsg() to nsendmsg().
#[link_name = "nsendmsg"]
pub fn sendmsg(sockfd: c_int, msg: *const msghdr, flags: c_int) -> ssize_t;
pub fn setcontext(ucp: *const ucontext_t) -> c_int;
pub fn setdomainname(name: *const c_char, len: c_int) -> c_int;
pub fn setgroups(ngroups: c_int, ptr: *const crate::gid_t) -> c_int;
pub fn setgrent();
pub fn sethostid(hostid: c_int) -> c_int;
pub fn sethostname(name: *const c_char, len: c_int) -> c_int;
pub fn setmntent(filename: *const c_char, ty: *const c_char) -> *mut crate::FILE;
pub fn setpriority(which: c_int, who: id_t, priority: c_int) -> c_int;
pub fn setpwent();
Expand Down Expand Up @@ -3274,6 +3293,7 @@ extern "C" {
pub fn shmget(key: key_t, size: size_t, shmflg: c_int) -> c_int;
pub fn shm_open(name: *const c_char, oflag: c_int, mode: mode_t) -> c_int;
pub fn shm_unlink(name: *const c_char) -> c_int;
pub fn splice(socket1: c_int, socket2: c_int, flags: c_int) -> c_int;
pub fn srand(seed: c_uint);
pub fn srand48(seed: c_long);
pub fn stat64(path: *const c_char, buf: *mut stat64) -> c_int;
Expand Down
Loading