shithub: scc

Download patch

ref: a7eae833f9d4a359b5346e6fe4c68522faabf245
parent: c41c061f0e08759eecbcd1c97c3117199fc56d0e
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue May 17 17:56:09 EDT 2022

libc: Add _execve() syscall in linux systems

--- a/include/bits/darwin/sys.h
+++ b/include/bits/darwin/sys.h
@@ -21,6 +21,7 @@
 struct sigaction;
 struct rusage;
 
+extern int _execve(char *, char *[], char *[]);
 extern int _fork(void);
 extern pid_t _getpid(void);
 extern int _kill(pid_t, int);
--- a/include/bits/dragonfly/sys.h
+++ b/include/bits/dragonfly/sys.h
@@ -21,6 +21,7 @@
 struct sigaction;
 struct rusage;
 
+extern int _execve(char *, char *[], char *[]);
 extern int _fork(void);
 extern pid_t _getpid(void);
 extern int _kill(pid_t, int);
--- a/include/bits/linux/sys.h
+++ b/include/bits/linux/sys.h
@@ -21,6 +21,7 @@
 struct sigaction;
 struct rusage;
 
+extern int _execve(char *, char *[], char *[]);
 extern int _fork(void);
 extern pid_t _getpid(void);
 extern int _kill(pid_t, int);
--- a/include/bits/netbsd/sys.h
+++ b/include/bits/netbsd/sys.h
@@ -21,6 +21,7 @@
 struct sigaction;
 struct rusage;
 
+extern int _execve(char *, char *[], char *[]);
 extern int _fork(void);
 extern pid_t _getpid(void);
 extern int _kill(pid_t, int);
--- a/include/bits/openbsd/sys.h
+++ b/include/bits/openbsd/sys.h
@@ -21,6 +21,7 @@
 struct sigaction;
 struct rusage;
 
+extern int _execve(char *, char *[], char *[]);
 extern int _fork(void);
 extern pid_t _getpid(void);
 extern int _kill(pid_t, int);
--- a/src/libc/arch/amd64/linux/.gitignore
+++ b/src/libc/arch/amd64/linux/.gitignore
@@ -1,6 +1,7 @@
 __sigaction.s
 _close.s
 _exit.s
+_execve.s
 _fork.s
 _getpid.s
 _getrusage.s
--- a/src/libc/arch/amd64/linux/Makefile
+++ b/src/libc/arch/amd64/linux/Makefile
@@ -8,6 +8,7 @@
 GENOBJS =\
 	__sigaction.$O\
 	_close.$O\
+	_execve.$O\
 	_exit.$O\
 	_fork.$O\
 	_getpid.$O\
--- a/src/libc/arch/amd64/linux/syscall.lst
+++ b/src/libc/arch/amd64/linux/syscall.lst
@@ -10,6 +10,7 @@
 15	_sigreturn	0
 39	_getpid	0
 57	_fork	0
+59	_execve	3
 60	_exit	1
 61	_wait4	4
 62	_kill	2
--- a/src/libc/arch/arm/linux/Makefile
+++ b/src/libc/arch/arm/linux/Makefile
@@ -6,6 +6,7 @@
 
 GENOBJS =\
 	_close.$O\
+	_execve.$O\
 	_exit.$O\
 	_fork.$O\
 	_getpid.$O\
--- a/src/libc/arch/arm/linux/syscall.lst
+++ b/src/libc/arch/arm/linux/syscall.lst
@@ -5,6 +5,7 @@
 3	_read
 4	_write
 1	_exit
+11	_execve
 20	_getpid
 37	_kill
 19	_lseek
--- a/src/libc/arch/arm64/linux/Makefile
+++ b/src/libc/arch/arm64/linux/Makefile
@@ -7,6 +7,7 @@
 
 GENOBJS =\
 	_close.$O\
+	_execve.$O\
 	_exit.$O\
 	_getpid.$O\
 	_kill.$O\
--- a/src/libc/arch/arm64/linux/syscall.lst
+++ b/src/libc/arch/arm64/linux/syscall.lst
@@ -9,4 +9,5 @@
 134	__sigaction
 172	_getpid
 214	_sys_brk
+221	_execve
 260	_wait4
--- a/src/libc/arch/i386/linux/Makefile
+++ b/src/libc/arch/i386/linux/Makefile
@@ -6,6 +6,7 @@
 
 GENOBJS =\
 	_close.$O\
+	_execve.$O\
 	_exit.$O\
 	_fork.$O\
 	_getpid.$O\
--- a/src/libc/arch/i386/linux/syscall.lst
+++ b/src/libc/arch/i386/linux/syscall.lst
@@ -6,6 +6,7 @@
 4	_write	3
 5	_open	2
 6	_close	1
+11	_execve	11
 19	_lseek	3
 20	_getpid	0
 37	_kill	2
--- a/src/libc/arch/ppc/linux/Makefile
+++ b/src/libc/arch/ppc/linux/Makefile
@@ -9,6 +9,7 @@
 GENOBJS =\
 	_close.$O\
 	_creat.$O\
+	_execve.$O\
 	_exit.$O\
 	_fork.$O\
 	_getpid.$O\
--- a/src/libc/arch/ppc/linux/syscall.lst
+++ b/src/libc/arch/ppc/linux/syscall.lst
@@ -8,6 +8,7 @@
 8	_creat
 9	_link
 10	_unlink
+11	_execve
 20	_getpid
 37	_kill
 45	_sys_brk
--- a/src/libc/objs/amd64-linux.mk
+++ b/src/libc/objs/amd64-linux.mk
@@ -5,6 +5,7 @@
 	arch/amd64/linux/__sigaction.$O\
 	arch/amd64/linux/_cerrno.$O\
 	arch/amd64/linux/_close.$O\
+	arch/amd64/linux/_execve.$O\
 	arch/amd64/linux/_exit.$O\
 	arch/amd64/linux/_getpid.$O\
 	arch/amd64/linux/_getrusage.$O\