diff options
Diffstat (limited to 'lib/execve.c')
| -rw-r--r-- | lib/execve.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/execve.c b/lib/execve.c new file mode 100644 index 000000000000..2667ebc15045 --- /dev/null +++ b/lib/execve.c | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | #include <asm/bug.h> | ||
| 2 | #include <asm/uaccess.h> | ||
| 3 | |||
| 4 | #define __KERNEL_SYSCALLS__ | ||
| 5 | static int errno __attribute__((unused)); | ||
| 6 | #include <asm/unistd.h> | ||
| 7 | |||
| 8 | #ifdef _syscall3 | ||
| 9 | int kernel_execve (const char *filename, char *const argv[], char *const envp[]) | ||
| 10 | __attribute__((__weak__)); | ||
| 11 | int kernel_execve (const char *filename, char *const argv[], char *const envp[]) | ||
| 12 | { | ||
| 13 | mm_segment_t fs = get_fs(); | ||
| 14 | int ret; | ||
| 15 | |||
| 16 | WARN_ON(segment_eq(fs, USER_DS)); | ||
| 17 | ret = execve(filename, (char **)argv, (char **)envp); | ||
| 18 | if (ret) | ||
| 19 | ret = -errno; | ||
| 20 | |||
| 21 | return ret; | ||
| 22 | } | ||
| 23 | #endif | ||
