mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 20:58:22 +00:00
syscalls: implement sysctl and add process listing
This commit is contained in:
@@ -51,6 +51,18 @@ static syscallret_t execve(context_t *context, char *upath, char *uargv[], char
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *last_component = strrchr(path, '/');
|
||||
if (last_component) {
|
||||
++last_component;
|
||||
if (*last_component == '\0') {
|
||||
ret.errno = EISDIR;
|
||||
free(path);
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
last_component = path;
|
||||
}
|
||||
|
||||
size_t argsize = 0;
|
||||
size_t envsize = 0;
|
||||
char **argv = NULL;
|
||||
@@ -315,6 +327,10 @@ static syscallret_t execve(context_t *context, char *upath, char *uargv[], char
|
||||
|
||||
cred_doexec(¤t_thread()->proc->cred, suid, sgid);
|
||||
|
||||
strncpy(current_thread()->proc->name, last_component, sizeof(current_thread()->proc->name));
|
||||
proc->start_time = timekeeper_timefromboot();
|
||||
memset(&proc->total_runtime, 0, sizeof(proc->total_runtime));
|
||||
|
||||
error:
|
||||
free(path);
|
||||
if (argv)
|
||||
|
||||
Reference in New Issue
Block a user