-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Restore some non-POSIX functions for AIX #4607
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
base: main
Are you sure you want to change the base?
Conversation
Unknown labels: O-unix, S-waiting-on-review |
src/unix/aix/mod.rs
Outdated
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per https://www.ibm.com/docs/en/aix/7.2.0?topic=s-sctp-opt-info-subroutine, opt
is sctp_assoc_t
. I assume this is defined to unsigned
, but is it worth a typedef?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for checking. Yeah, there seems to be some AIX header weirdness. The AIX man page specifies the type sctp_assoc_t
for the argument id
, but the prototype in the header files has type uint32_t
for it.
Man page:
int sctp_opt_info(sd, id, opt, *arg_size, *size);
int sd;
sctp_assoc_t id;
int opt;
void *arg_size;
size_t *size;
net/proto_uipc.h
:
int sctp_opt_info PROTO((int, uint32_t, int, void *, size_t *));
I agree it makes it consistent with the man page if we define its type as sctp_assoc_t
on the Rust side. The typedef of sctp_assoc_t
is defined in header netinet/sctp.h
so I am pulling the header in. sctp_peeloff
and sctp_opt_info
are also declared in netinet/sctp.h
without the _KERNEL
guard so I am removing them from the function skip list in build.rs
.
typedef uint32_t sctp_assoc_t;
int sctp_peeloff(int s, uint32_t * assoc_id);
int sctp_opt_info(int s, uint32_t id, int opt, void *arg, size_t *size);
int sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **addrs);
int sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **addrs);
@@ -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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this only has three fields at https://www.ibm.com/docs/en/aix/7.3.0?topic=s-sendmmsg-subroutine, is that inaccurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The online doc does not seem to be accurate. The prototype in AIX header net/proto_uipc.h
is as follows. I will open an issue against the AIX doc.
int sendmmsg PROTO((int, struct mmsghdr *, unsigned int, int));
libc-test/build.rs
Outdated
// 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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking, are these somewhat common to use on AIX even though they aren't defined? mount
on other platforms usually has a void *data
arg of fs-specific flags, I'm wondering if there's a chance the AIX version changes to take one as well.
sendmmsg
/recvmmsg
are pretty common, I'm surprised nobody has moved your #ifdef __KERNEL
a few lines lower yet 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for checking. I checked the documentation for the latest AIX release (v7.3), and mount
still takes three arguments. By definition, _KERNEL
is meant to guard code used for writing kernel extensions, but it seems some of these functions are also used in OSS. Yes, sendmmsg
and recvmmsg
should be moved out of the block. I will open an issue against the AIX headers for these functions as well as mount
.
Description
These non-POSIX functions were previously removed because they are guarded by the
_KERNEL
macro in AIX headers. After discussion, we thought they might be useful, so this patch restores them with fixes.Sources
Checklist
libc-test/semver
have been updated*LAST
or*MAX
areincluded (see #3131)
cd libc-test && cargo test --target mytarget
);especially relevant for platforms that may not be checked in CI