Skip to content

Commit 17299d3

Browse files
authored
Merge pull request #4563 from xingxue-ibm/fix-signatures
Add 'const' to some signatures for AIX
2 parents d2125d0 + 6af1254 commit 17299d3

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

libc-test/build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5673,6 +5673,15 @@ fn test_aix(target: &str) {
56735673
// The function is only available under macro _KERNEL in 'proto_uipc.h'.
56745674
"getpeereid" => true,
56755675

5676+
// The AIX signatures for these non-POSIX functions differ from
5677+
// those on platforms like Linux: some arguments are not marked
5678+
// with the 'const' qualifier, even though they are not modified.
5679+
// To be consistent with other platforms, 'const' is added to the
5680+
// Rust declarations. However, this causes a mismatch with the AIX
5681+
// header signatures. Skipping.
5682+
"setdomainname" | "settimeofday" | "statfs" | "statfs64" | "statx" | "swapoff"
5683+
| "swapon" | "utmpname" | "setgroups" => true,
5684+
56765685
_ => false,
56775686
}
56785687
});

src/unix/aix/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3246,15 +3246,15 @@ extern "C" {
32463246
#[link_name = "nsendmsg"]
32473247
pub fn sendmsg(sockfd: c_int, msg: *const msghdr, flags: c_int) -> ssize_t;
32483248
pub fn setcontext(ucp: *const ucontext_t) -> c_int;
3249-
pub fn setdomainname(name: *mut c_char, len: c_int) -> c_int;
3250-
pub fn setgroups(ngroups: c_int, ptr: *mut crate::gid_t) -> c_int;
3249+
pub fn setdomainname(name: *const c_char, len: c_int) -> c_int;
3250+
pub fn setgroups(ngroups: c_int, ptr: *const crate::gid_t) -> c_int;
32513251
pub fn setgrent();
32523252
pub fn setmntent(filename: *const c_char, ty: *const c_char) -> *mut crate::FILE;
32533253
pub fn setpriority(which: c_int, who: id_t, priority: c_int) -> c_int;
32543254
pub fn setpwent();
32553255
pub fn setrlimit(resource: c_int, rlim: *const crate::rlimit) -> c_int;
32563256
pub fn setrlimit64(resource: c_int, rlim: *const rlimit64) -> c_int;
3257-
pub fn settimeofday(tv: *mut crate::timeval, tz: *mut crate::timezone) -> c_int;
3257+
pub fn settimeofday(tv: *const crate::timeval, tz: *const crate::timezone) -> c_int;
32583258
pub fn setitimer(
32593259
which: c_int,
32603260
new_value: *const crate::itimerval,
@@ -3281,10 +3281,10 @@ extern "C" {
32813281
pub fn srand48(seed: c_long);
32823282
pub fn stat64(path: *const c_char, buf: *mut stat64) -> c_int;
32833283
pub fn stat64at(dirfd: c_int, path: *const c_char, buf: *mut stat64, flags: c_int) -> c_int;
3284-
pub fn statfs(path: *mut c_char, buf: *mut statfs) -> c_int;
3285-
pub fn statfs64(path: *mut c_char, buf: *mut statfs64) -> c_int;
3284+
pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int;
3285+
pub fn statfs64(path: *const c_char, buf: *mut statfs64) -> c_int;
32863286
pub fn statvfs64(path: *const c_char, buf: *mut statvfs64) -> c_int;
3287-
pub fn statx(path: *mut c_char, buf: *mut stat, length: c_int, command: c_int) -> c_int;
3287+
pub fn statx(path: *const c_char, buf: *mut stat, length: c_int, command: c_int) -> c_int;
32883288
pub fn strcasecmp_l(
32893289
string1: *const c_char,
32903290
string2: *const c_char,
@@ -3306,8 +3306,8 @@ extern "C" {
33063306
pub fn strptime(s: *const c_char, format: *const c_char, tm: *mut crate::tm) -> *mut c_char;
33073307
pub fn strsep(string: *mut *mut c_char, delim: *const c_char) -> *mut c_char;
33083308
pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> c_int;
3309-
pub fn swapoff(puath: *mut c_char) -> c_int;
3310-
pub fn swapon(path: *mut c_char) -> c_int;
3309+
pub fn swapoff(path: *const c_char) -> c_int;
3310+
pub fn swapon(path: *const c_char) -> c_int;
33113311
pub fn sync();
33123312
pub fn telldir(dirp: *mut crate::DIR) -> c_long;
33133313
pub fn timer_create(
@@ -3328,7 +3328,7 @@ extern "C" {
33283328
pub fn uname(buf: *mut crate::utsname) -> c_int;
33293329
pub fn updwtmp(file: *const c_char, u: *const utmp);
33303330
pub fn uselocale(loc: crate::locale_t) -> crate::locale_t;
3331-
pub fn utmpname(file: *mut c_char) -> c_int;
3331+
pub fn utmpname(file: *const c_char) -> c_int;
33323332
pub fn utimensat(
33333333
dirfd: c_int,
33343334
path: *const c_char,

0 commit comments

Comments
 (0)