libc: Add support for the new exec() system call
execv() is a temporary wrapper that ignores the second parameter, while execve() and execvp() still error out.
This commit is contained in:
parent
f8b3567042
commit
531afc3d6f
@ -21,7 +21,7 @@ void Syscall::entry(Context* context)
|
|||||||
case SYS_read: sys_read(context, (int)context->rdi, context->rsi, (char*)context->rdx); break;
|
case SYS_read: sys_read(context, (int)context->rdi, context->rsi, (char*)context->rdx); break;
|
||||||
case SYS_close: sys_close(context, (int)context->rdi); break;
|
case SYS_close: sys_close(context, (int)context->rdi); break;
|
||||||
case SYS_seek: sys_seek(context, (int)context->rdi, (long)context->rsi, (int)context->rdx); break;
|
case SYS_seek: sys_seek(context, (int)context->rdi, (long)context->rsi, (int)context->rdx); break;
|
||||||
case SYS_exec: sys_exec(context, (const char*)context->rdi);
|
case SYS_exec: sys_exec(context, (const char*)context->rdi); break;
|
||||||
default: context->rax = -ENOSYS; break;
|
default: context->rax = -ENOSYS; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,6 +14,7 @@
|
|||||||
#define SYS_read 10
|
#define SYS_read 10
|
||||||
#define SYS_close 11
|
#define SYS_close 11
|
||||||
#define SYS_seek 12
|
#define SYS_seek 12
|
||||||
|
#define SYS_exec 13
|
||||||
|
|
||||||
#ifndef __want_syscalls
|
#ifndef __want_syscalls
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -9,8 +9,10 @@ extern "C"
|
|||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Not implemented. */
|
/* Executes the program program. On success, does not return. The second parameter (arguments) is not implemented
|
||||||
int execv(const char*, char* const[]);
|
* for now. You can pass NULL to it. */
|
||||||
|
int execv(const char* program, char* const[]);
|
||||||
|
|
||||||
/* Not implemented. */
|
/* Not implemented. */
|
||||||
int execve(const char*, char* const[], char* const[]);
|
int execve(const char*, char* const[], char* const[]);
|
||||||
/* Not implemented. */
|
/* Not implemented. */
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
int execv(const char*, char* const[])
|
int execv(const char* program, char* const[])
|
||||||
{
|
{
|
||||||
NOT_IMPLEMENTED("execv");
|
return (int)syscall(SYS_exec, program);
|
||||||
}
|
}
|
||||||
int execve(const char*, char* const[], char* const[])
|
int execve(const char*, char* const[], char* const[])
|
||||||
{
|
{
|
||||||
@ -36,6 +36,7 @@ extern "C"
|
|||||||
case SYS_rand: result = __luna_syscall0(number); break;
|
case SYS_rand: result = __luna_syscall0(number); break;
|
||||||
case SYS_exit:
|
case SYS_exit:
|
||||||
case SYS_close:
|
case SYS_close:
|
||||||
|
case SYS_exec:
|
||||||
case SYS_sleep: result = __luna_syscall1(number, va_arg(ap, arg)); break;
|
case SYS_sleep: result = __luna_syscall1(number, va_arg(ap, arg)); break;
|
||||||
case SYS_munmap:
|
case SYS_munmap:
|
||||||
case SYS_open: {
|
case SYS_open: {
|
||||||
|
Loading…
Reference in New Issue
Block a user