Skip to content

Commit 79108fe

Browse files
Askar SafinAndy-Python-Programmer
Askar Safin
authored andcommitted
Change prototypes for exec* function to match headers.
Yes, this makes the prototypes harder to use. And less intuitive. But this makes them match headers, and thus now we can properly test them. This fixes rust-lang#1272 Also we fix return types for some Windows exec* functions
1 parent 255aa3e commit 79108fe

File tree

12 files changed

+30
-58
lines changed

12 files changed

+30
-58
lines changed

src/fuchsia/mod.rs

+7-11
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

+1-5
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

+1-5
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

+2-2
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

+2-2
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

+3-7
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

+3-7
Original file line numberDiff line numberDiff line change
@@ -1775,14 +1775,10 @@ extern "C" {
17751775
pub fn login_tty(fd: ::c_int) -> ::c_int;
17761776
pub fn execvpe(
17771777
file: *const ::c_char,
1778-
argv: *const *const ::c_char,
1779-
envp: *const *const ::c_char,
1780-
) -> ::c_int;
1781-
pub fn fexecve(
1782-
fd: ::c_int,
1783-
argv: *const *const ::c_char,
1784-
envp: *const *const ::c_char,
1778+
argv: *const *mut ::c_char,
1779+
envp: *const *mut ::c_char,
17851780
) -> ::c_int;
1781+
pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int;
17861782
pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
17871783
pub fn freeifaddrs(ifa: *mut ::ifaddrs);
17881784
pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int;

src/unix/mod.rs

+4-4
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

+1-5
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

+2-2
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

+1-5
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

+3-3
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)