Skip to content

Commit 0108917

Browse files
Xing Xuetgross35
authored andcommitted
Add 'const' to signatures to be consistent with other platforms.
(backport <#4563>) (cherry picked from commit 6af1254)
1 parent b228704 commit 0108917

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
@@ -5750,6 +5750,15 @@ fn test_aix(target: &str) {
57505750
// The function is only available under macro _KERNEL in 'proto_uipc.h'.
57515751
"getpeereid" => true,
57525752

5753+
// The AIX signatures for these non-POSIX functions differ from
5754+
// those on platforms like Linux: some arguments are not marked
5755+
// with the 'const' qualifier, even though they are not modified.
5756+
// To be consistent with other platforms, 'const' is added to the
5757+
// Rust declarations. However, this causes a mismatch with the AIX
5758+
// header signatures. Skipping.
5759+
"setdomainname" | "settimeofday" | "statfs" | "statfs64" | "statx" | "swapoff"
5760+
| "swapon" | "utmpname" | "setgroups" => true,
5761+
57535762
_ => false,
57545763
}
57555764
});

src/unix/aix/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3250,15 +3250,15 @@ extern "C" {
32503250
#[link_name = "nsendmsg"]
32513251
pub fn sendmsg(sockfd: c_int, msg: *const msghdr, flags: c_int) -> ssize_t;
32523252
pub fn setcontext(ucp: *const ucontext_t) -> c_int;
3253-
pub fn setdomainname(name: *mut c_char, len: c_int) -> c_int;
3254-
pub fn setgroups(ngroups: c_int, ptr: *mut crate::gid_t) -> c_int;
3253+
pub fn setdomainname(name: *const c_char, len: c_int) -> c_int;
3254+
pub fn setgroups(ngroups: c_int, ptr: *const crate::gid_t) -> c_int;
32553255
pub fn setgrent();
32563256
pub fn setmntent(filename: *const c_char, ty: *const c_char) -> *mut crate::FILE;
32573257
pub fn setpriority(which: c_int, who: id_t, priority: c_int) -> c_int;
32583258
pub fn setpwent();
32593259
pub fn setrlimit(resource: c_int, rlim: *const crate::rlimit) -> c_int;
32603260
pub fn setrlimit64(resource: c_int, rlim: *const rlimit64) -> c_int;
3261-
pub fn settimeofday(tv: *mut crate::timeval, tz: *mut crate::timezone) -> c_int;
3261+
pub fn settimeofday(tv: *const crate::timeval, tz: *const crate::timezone) -> c_int;
32623262
pub fn setitimer(
32633263
which: c_int,
32643264
new_value: *const crate::itimerval,
@@ -3285,10 +3285,10 @@ extern "C" {
32853285
pub fn srand48(seed: c_long);
32863286
pub fn stat64(path: *const c_char, buf: *mut stat64) -> c_int;
32873287
pub fn stat64at(dirfd: c_int, path: *const c_char, buf: *mut stat64, flags: c_int) -> c_int;
3288-
pub fn statfs(path: *mut c_char, buf: *mut statfs) -> c_int;
3289-
pub fn statfs64(path: *mut c_char, buf: *mut statfs64) -> c_int;
3288+
pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int;
3289+
pub fn statfs64(path: *const c_char, buf: *mut statfs64) -> c_int;
32903290
pub fn statvfs64(path: *const c_char, buf: *mut statvfs64) -> c_int;
3291-
pub fn statx(path: *mut c_char, buf: *mut stat, length: c_int, command: c_int) -> c_int;
3291+
pub fn statx(path: *const c_char, buf: *mut stat, length: c_int, command: c_int) -> c_int;
32923292
pub fn strcasecmp_l(
32933293
string1: *const c_char,
32943294
string2: *const c_char,
@@ -3310,8 +3310,8 @@ extern "C" {
33103310
pub fn strptime(s: *const c_char, format: *const c_char, tm: *mut crate::tm) -> *mut c_char;
33113311
pub fn strsep(string: *mut *mut c_char, delim: *const c_char) -> *mut c_char;
33123312
pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> c_int;
3313-
pub fn swapoff(puath: *mut c_char) -> c_int;
3314-
pub fn swapon(path: *mut c_char) -> c_int;
3313+
pub fn swapoff(path: *const c_char) -> c_int;
3314+
pub fn swapon(path: *const c_char) -> c_int;
33153315
pub fn sync();
33163316
pub fn telldir(dirp: *mut crate::DIR) -> c_long;
33173317
pub fn timer_create(
@@ -3332,7 +3332,7 @@ extern "C" {
33323332
pub fn uname(buf: *mut crate::utsname) -> c_int;
33333333
pub fn updwtmp(file: *const c_char, u: *const utmp);
33343334
pub fn uselocale(loc: crate::locale_t) -> crate::locale_t;
3335-
pub fn utmpname(file: *mut c_char) -> c_int;
3335+
pub fn utmpname(file: *const c_char) -> c_int;
33363336
pub fn utimensat(
33373337
dirfd: c_int,
33383338
path: *const c_char,

0 commit comments

Comments
 (0)