Skip to content

Commit 6f47f51

Browse files
authored
Merge pull request #3597 from safinaskar/exec
libc 0.3: Change prototypes for exec* function to match headers
2 parents 3c30a03 + 6c15e7f commit 6f47f51

File tree

13 files changed

+34
-91
lines changed

13 files changed

+34
-91
lines changed

libc-test/build.rs

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,6 @@ fn test_apple(target: &str) {
329329
cfg.skip_fn(move |name| {
330330
// skip those that are manually verified
331331
match name {
332-
// FIXME: https://github.com/rust-lang/libc/issues/1272
333-
"execv" | "execve" | "execvp" => true,
334-
335332
// close calls the close_nocancel system call
336333
"close" => true,
337334

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

526523
cfg.skip_fn(move |name| {
527524
match name {
528-
// FIXME: https://github.com/rust-lang/libc/issues/1272
529-
"execv" | "execve" | "execvp" | "execvpe" => true,
530-
531525
// futex() has volatile arguments, but that doesn't exist in Rust.
532526
"futex" => true,
533527

@@ -694,14 +688,7 @@ fn test_windows(target: &str) {
694688
}
695689
});
696690

697-
cfg.skip_fn(move |name| {
698-
match name {
699-
// FIXME: https://github.com/rust-lang/libc/issues/1272
700-
"execv" | "execve" | "execvp" | "execvpe" => true,
701-
702-
_ => false,
703-
}
704-
});
691+
cfg.skip_fn(|_| false);
705692

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

976963
// const-ness issues
977-
"execv" | "execve" | "execvp" | "settimeofday" | "sethostname" => true,
964+
"settimeofday" | "sethostname" => true,
978965

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

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

@@ -1411,9 +1396,6 @@ fn test_dragonflybsd(target: &str) {
14111396
cfg.skip_fn(move |name| {
14121397
// skip those that are manually verified
14131398
match name {
1414-
// FIXME: https://github.com/rust-lang/libc/issues/1272
1415-
"execv" | "execve" | "execvp" | "fexecve" => true,
1416-
14171399
"getrlimit" | "getrlimit64" | // non-int in 1st arg
14181400
"setrlimit" | "setrlimit64" | // non-int in 1st arg
14191401
"prlimit" | "prlimit64" // non-int in 2nd arg
@@ -1908,8 +1890,8 @@ fn test_android(target: &str) {
19081890
cfg.skip_fn(move |name| {
19091891
// skip those that are manually verified
19101892
match name {
1911-
// FIXME: https://github.com/rust-lang/libc/issues/1272
1912-
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true,
1893+
// FIXME: for unknown reasons linker unable to find "fexecve"
1894+
"fexecve" => true,
19131895

19141896
// There are two versions of the sterror_r function, see
19151897
//
@@ -2487,9 +2469,6 @@ fn test_freebsd(target: &str) {
24872469
cfg.skip_fn(move |name| {
24882470
// skip those that are manually verified
24892471
match name {
2490-
// FIXME: https://github.com/rust-lang/libc/issues/1272
2491-
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true,
2492-
24932472
// The `uname` function in the `utsname.h` FreeBSD header is a C
24942473
// inline function (has no symbol) that calls the `__xuname` symbol.
24952474
// Therefore the function pointer comparison does not make sense for it.
@@ -3089,9 +3068,6 @@ fn test_neutrino(target: &str) {
30893068
cfg.skip_fn(move |name| {
30903069
// skip those that are manually verified
30913070
match name {
3092-
// FIXME: https://github.com/rust-lang/libc/issues/1272
3093-
"execv" | "execve" | "execvp" | "execvpe" => true,
3094-
30953071
// wrong signature
30963072
"signal" => true,
30973073

@@ -4168,9 +4144,6 @@ fn test_linux(target: &str) {
41684144
cfg.skip_fn(move |name| {
41694145
// skip those that are manually verified
41704146
match name {
4171-
// FIXME: https://github.com/rust-lang/libc/issues/1272
4172-
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true,
4173-
41744147
// There are two versions of the sterror_r function, see
41754148
//
41764149
// https://linux.die.net/man/3/strerror_r
@@ -4761,8 +4734,6 @@ fn test_haiku(target: &str) {
47614734
cfg.skip_fn(move |name| {
47624735
// skip those that are manually verified
47634736
match name {
4764-
// FIXME: https://github.com/rust-lang/libc/issues/1272
4765-
"execv" | "execve" | "execvp" | "execvpe" => true,
47664737
// FIXME: does not exist on haiku
47674738
"open_wmemstream" => true,
47684739
"mlockall" | "munlockall" => true,

src/fuchsia/mod.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3675,13 +3675,13 @@ extern "C" {
36753675
pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int;
36763676
pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
36773677
pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
3678-
pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int;
3678+
pub fn execv(prog: *const c_char, argv: *const *mut c_char) -> ::c_int;
36793679
pub fn execve(
36803680
prog: *const c_char,
3681-
argv: *const *const c_char,
3682-
envp: *const *const c_char,
3681+
argv: *const *mut c_char,
3682+
envp: *const *mut c_char,
36833683
) -> ::c_int;
3684-
pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int;
3684+
pub fn execvp(c: *const c_char, argv: *const *mut c_char) -> ::c_int;
36853685
pub fn fork() -> pid_t;
36863686
pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
36873687
pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char;
@@ -4023,14 +4023,10 @@ extern "C" {
40234023
) -> ::c_int;
40244024
pub fn execvpe(
40254025
file: *const ::c_char,
4026-
argv: *const *const ::c_char,
4027-
envp: *const *const ::c_char,
4028-
) -> ::c_int;
4029-
pub fn fexecve(
4030-
fd: ::c_int,
4031-
argv: *const *const ::c_char,
4032-
envp: *const *const ::c_char,
4026+
argv: *const *mut ::c_char,
4027+
envp: *const *mut ::c_char,
40334028
) -> ::c_int;
4029+
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;
40344030

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

src/unix/aix/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,11 +2810,7 @@ extern "C" {
28102810
) -> ::c_int;
28112811
pub fn fattach(fildes: ::c_int, path: *const ::c_char) -> ::c_int;
28122812
pub fn fdatasync(fd: ::c_int) -> ::c_int;
2813-
pub fn fexecve(
2814-
fd: ::c_int,
2815-
argv: *const *const ::c_char,
2816-
envp: *const *const ::c_char,
2817-
) -> ::c_int;
2813+
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;
28182814
pub fn ffs(value: ::c_int) -> ::c_int;
28192815
pub fn ffsl(value: ::c_long) -> ::c_int;
28202816
pub fn ffsll(value: ::c_longlong) -> ::c_int;

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,11 +1500,7 @@ extern "C" {
15001500
pub fn duplocale(base: ::locale_t) -> ::locale_t;
15011501
pub fn endutxent();
15021502
pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
1503-
pub fn fexecve(
1504-
fd: ::c_int,
1505-
argv: *const *const ::c_char,
1506-
envp: *const *const ::c_char,
1507-
) -> ::c_int;
1503+
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;
15081504
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
15091505
pub fn getdomainname(name: *mut ::c_char, len: ::c_int) -> ::c_int;
15101506
pub fn getgrent_r(

src/unix/bsd/netbsdlike/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,8 @@ extern "C" {
750750
pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
751751
pub fn execvpe(
752752
file: *const ::c_char,
753-
argv: *const *const ::c_char,
754-
envp: *const *const ::c_char,
753+
argv: *const *mut ::c_char,
754+
envp: *const *mut ::c_char,
755755
) -> ::c_int;
756756
pub fn waitid(
757757
idtype: idtype_t,

src/unix/haiku/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,8 +1765,8 @@ extern "C" {
17651765
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
17661766
pub fn execvpe(
17671767
file: *const ::c_char,
1768-
argv: *const *const ::c_char,
1769-
environment: *const *const ::c_char,
1768+
argv: *const *mut ::c_char,
1769+
environment: *const *mut ::c_char,
17701770
) -> ::c_int;
17711771
pub fn getgrgid_r(
17721772
gid: ::gid_t,

src/unix/hurd/mod.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4202,14 +4202,10 @@ extern "C" {
42024202
) -> ::c_int;
42034203
pub fn execvpe(
42044204
file: *const ::c_char,
4205-
argv: *const *const ::c_char,
4206-
envp: *const *const ::c_char,
4207-
) -> ::c_int;
4208-
pub fn fexecve(
4209-
fd: ::c_int,
4210-
argv: *const *const ::c_char,
4211-
envp: *const *const ::c_char,
4205+
argv: *const *mut ::c_char,
4206+
envp: *const *mut ::c_char,
42124207
) -> ::c_int;
4208+
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;
42134209

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

src/unix/linux_like/mod.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,14 +1755,10 @@ extern "C" {
17551755
pub fn login_tty(fd: ::c_int) -> ::c_int;
17561756
pub fn execvpe(
17571757
file: *const ::c_char,
1758-
argv: *const *const ::c_char,
1759-
envp: *const *const ::c_char,
1760-
) -> ::c_int;
1761-
pub fn fexecve(
1762-
fd: ::c_int,
1763-
argv: *const *const ::c_char,
1764-
envp: *const *const ::c_char,
1758+
argv: *const *mut ::c_char,
1759+
envp: *const *mut ::c_char,
17651760
) -> ::c_int;
1761+
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;
17661762
pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
17671763
pub fn freeifaddrs(ifa: *mut ::ifaddrs);
17681764
pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int;

src/unix/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -840,13 +840,13 @@ extern "C" {
840840
pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int;
841841
pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
842842
pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
843-
pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int;
843+
pub fn execv(prog: *const c_char, argv: *const *mut c_char) -> ::c_int;
844844
pub fn execve(
845845
prog: *const c_char,
846-
argv: *const *const c_char,
847-
envp: *const *const c_char,
846+
argv: *const *mut c_char,
847+
envp: *const *mut c_char,
848848
) -> ::c_int;
849-
pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int;
849+
pub fn execvp(c: *const c_char, argv: *const *mut c_char) -> ::c_int;
850850
pub fn fork() -> pid_t;
851851
pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
852852
pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char;

src/unix/newlib/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -689,11 +689,7 @@ extern "C" {
689689
flags: ::c_int,
690690
) -> ::c_int;
691691
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
692-
pub fn fexecve(
693-
fd: ::c_int,
694-
argv: *const *const ::c_char,
695-
envp: *const *const ::c_char,
696-
) -> ::c_int;
692+
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;
697693
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
698694
pub fn getgrgid_r(
699695
gid: ::gid_t,

src/unix/nto/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2935,8 +2935,8 @@ extern "C" {
29352935
) -> ::pid_t;
29362936
pub fn execvpe(
29372937
file: *const ::c_char,
2938-
argv: *const *const ::c_char,
2939-
envp: *const *const ::c_char,
2938+
argv: *const *mut ::c_char,
2939+
envp: *const *mut ::c_char,
29402940
) -> ::c_int;
29412941

29422942
pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;

src/unix/solarish/solaris.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ pub const F_DUP2FD_CLOEXEC: ::c_int = 48;
6666
pub const F_DUP2FD_CLOFORK: ::c_int = 50;
6767

6868
extern "C" {
69-
pub fn fexecve(
70-
fd: ::c_int,
71-
argv: *const *const ::c_char,
72-
envp: *const *const ::c_char,
73-
) -> ::c_int;
69+
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;
7470

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

src/windows/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,15 +460,15 @@ extern "C" {
460460
prog: *const c_char,
461461
argv: *const *const c_char,
462462
envp: *const *const c_char,
463-
) -> ::c_int;
463+
) -> ::intptr_t;
464464
#[link_name = "_execvp"]
465-
pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int;
465+
pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::intptr_t;
466466
#[link_name = "_execvpe"]
467467
pub fn execvpe(
468468
c: *const c_char,
469469
argv: *const *const c_char,
470470
envp: *const *const c_char,
471-
) -> ::c_int;
471+
) -> ::intptr_t;
472472
#[link_name = "_wexecv"]
473473
pub fn wexecv(prog: *const wchar_t, argv: *const *const wchar_t) -> ::intptr_t;
474474
#[link_name = "_wexecve"]

0 commit comments

Comments
 (0)