Skip to content

Commit

Permalink
Merge pull request #3597 from safinaskar/exec
Browse files Browse the repository at this point in the history
libc 0.3: Change prototypes for exec* function to match headers
  • Loading branch information
JohnTitor authored Feb 29, 2024
2 parents 3c30a03 + 6c15e7f commit 6f47f51
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 91 deletions.
37 changes: 4 additions & 33 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,6 @@ fn test_apple(target: &str) {
cfg.skip_fn(move |name| {
// skip those that are manually verified
match name {
// FIXME: https://github.com/rust-lang/libc/issues/1272
"execv" | "execve" | "execvp" => true,

// close calls the close_nocancel system call
"close" => true,

Expand Down Expand Up @@ -525,9 +522,6 @@ fn test_openbsd(target: &str) {

cfg.skip_fn(move |name| {
match name {
// FIXME: https://github.com/rust-lang/libc/issues/1272
"execv" | "execve" | "execvp" | "execvpe" => true,

// futex() has volatile arguments, but that doesn't exist in Rust.
"futex" => true,

Expand Down Expand Up @@ -694,14 +688,7 @@ fn test_windows(target: &str) {
}
});

cfg.skip_fn(move |name| {
match name {
// FIXME: https://github.com/rust-lang/libc/issues/1272
"execv" | "execve" | "execvp" | "execvpe" => true,

_ => false,
}
});
cfg.skip_fn(|_| false);

cfg.generate("../src/lib.rs", "main.rs");
}
Expand Down Expand Up @@ -974,7 +961,7 @@ fn test_solarish(target: &str) {
"cfmakeraw" | "cfsetspeed" => true,

// const-ness issues
"execv" | "execve" | "execvp" | "settimeofday" | "sethostname" => true,
"settimeofday" | "sethostname" => true,

// Solaris-different
"getpwent_r" | "getgrent_r" | "updwtmpx" if is_illumos => true,
Expand Down Expand Up @@ -1182,8 +1169,6 @@ fn test_netbsd(target: &str) {

cfg.skip_fn(move |name| {
match name {
// FIXME: https://github.com/rust-lang/libc/issues/1272
"execv" | "execve" | "execvp" => true,
// FIXME: netbsd 10 minimum
"getentropy" | "getrandom" => true,

Expand Down Expand Up @@ -1411,9 +1396,6 @@ fn test_dragonflybsd(target: &str) {
cfg.skip_fn(move |name| {
// skip those that are manually verified
match name {
// FIXME: https://github.com/rust-lang/libc/issues/1272
"execv" | "execve" | "execvp" | "fexecve" => true,

"getrlimit" | "getrlimit64" | // non-int in 1st arg
"setrlimit" | "setrlimit64" | // non-int in 1st arg
"prlimit" | "prlimit64" // non-int in 2nd arg
Expand Down Expand Up @@ -1908,8 +1890,8 @@ fn test_android(target: &str) {
cfg.skip_fn(move |name| {
// skip those that are manually verified
match name {
// FIXME: https://github.com/rust-lang/libc/issues/1272
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true,
// FIXME: for unknown reasons linker unable to find "fexecve"
"fexecve" => true,

// There are two versions of the sterror_r function, see
//
Expand Down Expand Up @@ -2487,9 +2469,6 @@ fn test_freebsd(target: &str) {
cfg.skip_fn(move |name| {
// skip those that are manually verified
match name {
// FIXME: https://github.com/rust-lang/libc/issues/1272
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true,

// The `uname` function in the `utsname.h` FreeBSD header is a C
// inline function (has no symbol) that calls the `__xuname` symbol.
// Therefore the function pointer comparison does not make sense for it.
Expand Down Expand Up @@ -3089,9 +3068,6 @@ fn test_neutrino(target: &str) {
cfg.skip_fn(move |name| {
// skip those that are manually verified
match name {
// FIXME: https://github.com/rust-lang/libc/issues/1272
"execv" | "execve" | "execvp" | "execvpe" => true,

// wrong signature
"signal" => true,

Expand Down Expand Up @@ -4168,9 +4144,6 @@ fn test_linux(target: &str) {
cfg.skip_fn(move |name| {
// skip those that are manually verified
match name {
// FIXME: https://github.com/rust-lang/libc/issues/1272
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true,

// There are two versions of the sterror_r function, see
//
// https://linux.die.net/man/3/strerror_r
Expand Down Expand Up @@ -4761,8 +4734,6 @@ fn test_haiku(target: &str) {
cfg.skip_fn(move |name| {
// skip those that are manually verified
match name {
// FIXME: https://github.com/rust-lang/libc/issues/1272
"execv" | "execve" | "execvp" | "execvpe" => true,
// FIXME: does not exist on haiku
"open_wmemstream" => true,
"mlockall" | "munlockall" => true,
Expand Down
18 changes: 7 additions & 11 deletions src/fuchsia/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3675,13 +3675,13 @@ extern "C" {
pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int;
pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int;
pub fn execv(prog: *const c_char, argv: *const *mut c_char) -> ::c_int;
pub fn execve(
prog: *const c_char,
argv: *const *const c_char,
envp: *const *const c_char,
argv: *const *mut c_char,
envp: *const *mut c_char,
) -> ::c_int;
pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int;
pub fn execvp(c: *const c_char, argv: *const *mut c_char) -> ::c_int;
pub fn fork() -> pid_t;
pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char;
Expand Down Expand Up @@ -4023,14 +4023,10 @@ extern "C" {
) -> ::c_int;
pub fn execvpe(
file: *const ::c_char,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
) -> ::c_int;
pub fn fexecve(
fd: ::c_int,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
argv: *const *mut ::c_char,
envp: *const *mut ::c_char,
) -> ::c_int;
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;

pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;

Expand Down
6 changes: 1 addition & 5 deletions src/unix/aix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2810,11 +2810,7 @@ extern "C" {
) -> ::c_int;
pub fn fattach(fildes: ::c_int, path: *const ::c_char) -> ::c_int;
pub fn fdatasync(fd: ::c_int) -> ::c_int;
pub fn fexecve(
fd: ::c_int,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
) -> ::c_int;
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;
pub fn ffs(value: ::c_int) -> ::c_int;
pub fn ffsl(value: ::c_long) -> ::c_int;
pub fn ffsll(value: ::c_longlong) -> ::c_int;
Expand Down
6 changes: 1 addition & 5 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1500,11 +1500,7 @@ extern "C" {
pub fn duplocale(base: ::locale_t) -> ::locale_t;
pub fn endutxent();
pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
pub fn fexecve(
fd: ::c_int,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
) -> ::c_int;
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
pub fn getdomainname(name: *mut ::c_char, len: ::c_int) -> ::c_int;
pub fn getgrent_r(
Expand Down
4 changes: 2 additions & 2 deletions src/unix/bsd/netbsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,8 @@ extern "C" {
pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
pub fn execvpe(
file: *const ::c_char,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
argv: *const *mut ::c_char,
envp: *const *mut ::c_char,
) -> ::c_int;
pub fn waitid(
idtype: idtype_t,
Expand Down
4 changes: 2 additions & 2 deletions src/unix/haiku/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1765,8 +1765,8 @@ extern "C" {
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
pub fn execvpe(
file: *const ::c_char,
argv: *const *const ::c_char,
environment: *const *const ::c_char,
argv: *const *mut ::c_char,
environment: *const *mut ::c_char,
) -> ::c_int;
pub fn getgrgid_r(
gid: ::gid_t,
Expand Down
10 changes: 3 additions & 7 deletions src/unix/hurd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4202,14 +4202,10 @@ extern "C" {
) -> ::c_int;
pub fn execvpe(
file: *const ::c_char,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
) -> ::c_int;
pub fn fexecve(
fd: ::c_int,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
argv: *const *mut ::c_char,
envp: *const *mut ::c_char,
) -> ::c_int;
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;

pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;

Expand Down
10 changes: 3 additions & 7 deletions src/unix/linux_like/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1755,14 +1755,10 @@ extern "C" {
pub fn login_tty(fd: ::c_int) -> ::c_int;
pub fn execvpe(
file: *const ::c_char,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
) -> ::c_int;
pub fn fexecve(
fd: ::c_int,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
argv: *const *mut ::c_char,
envp: *const *mut ::c_char,
) -> ::c_int;
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;
pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
pub fn freeifaddrs(ifa: *mut ::ifaddrs);
pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int;
Expand Down
8 changes: 4 additions & 4 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -840,13 +840,13 @@ extern "C" {
pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int;
pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int;
pub fn execv(prog: *const c_char, argv: *const *mut c_char) -> ::c_int;
pub fn execve(
prog: *const c_char,
argv: *const *const c_char,
envp: *const *const c_char,
argv: *const *mut c_char,
envp: *const *mut c_char,
) -> ::c_int;
pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int;
pub fn execvp(c: *const c_char, argv: *const *mut c_char) -> ::c_int;
pub fn fork() -> pid_t;
pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char;
Expand Down
6 changes: 1 addition & 5 deletions src/unix/newlib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,11 +689,7 @@ extern "C" {
flags: ::c_int,
) -> ::c_int;
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
pub fn fexecve(
fd: ::c_int,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
) -> ::c_int;
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
pub fn getgrgid_r(
gid: ::gid_t,
Expand Down
4 changes: 2 additions & 2 deletions src/unix/nto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2935,8 +2935,8 @@ extern "C" {
) -> ::pid_t;
pub fn execvpe(
file: *const ::c_char,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
argv: *const *mut ::c_char,
envp: *const *mut ::c_char,
) -> ::c_int;

pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
Expand Down
6 changes: 1 addition & 5 deletions src/unix/solarish/solaris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ pub const F_DUP2FD_CLOEXEC: ::c_int = 48;
pub const F_DUP2FD_CLOFORK: ::c_int = 50;

extern "C" {
pub fn fexecve(
fd: ::c_int,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
) -> ::c_int;
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;

pub fn mincore(addr: *const ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int;

Expand Down
6 changes: 3 additions & 3 deletions src/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,15 +460,15 @@ extern "C" {
prog: *const c_char,
argv: *const *const c_char,
envp: *const *const c_char,
) -> ::c_int;
) -> ::intptr_t;
#[link_name = "_execvp"]
pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int;
pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::intptr_t;
#[link_name = "_execvpe"]
pub fn execvpe(
c: *const c_char,
argv: *const *const c_char,
envp: *const *const c_char,
) -> ::c_int;
) -> ::intptr_t;
#[link_name = "_wexecv"]
pub fn wexecv(prog: *const wchar_t, argv: *const *const wchar_t) -> ::intptr_t;
#[link_name = "_wexecve"]
Expand Down

0 comments on commit 6f47f51

Please sign in to comment.