job control: sessions and process groups

This commit is contained in:
Matheus
2024-05-01 21:42:38 -03:00
parent 1f848fe596
commit 05049a091f
13 changed files with 484 additions and 18 deletions
+11 -1
View File
@@ -52,6 +52,11 @@ extern syscall_newthread
extern syscall_threadexit
extern syscall_futex
extern syscall_gettid
extern syscall_getppid
extern syscall_getpgid
extern syscall_getsid
extern syscall_setsid
extern syscall_setpgid
syscalltab:
dq syscall_print
dq syscall_mmap
@@ -106,7 +111,12 @@ dq syscall_newthread
dq syscall_threadexit
dq syscall_futex
dq syscall_gettid
syscallcount equ 53
dq syscall_getppid
dq syscall_getpgid
dq syscall_getsid
dq syscall_setsid
dq syscall_setpgid
syscallcount equ 58
section .text
global arch_syscall_entry
; on entry:
+13 -4
View File
@@ -4,7 +4,7 @@
#ifdef SYSCALL_LOGGING
#define SYSCALL_COUNT 53
#define SYSCALL_COUNT 58
#define LOGSTR(x) arch_e9_puts(x)
static char *name[] = {
@@ -60,7 +60,12 @@ static char *name[] = {
"newthread",
"threadexit",
"futex",
"gettid"
"gettid",
"getppid",
"getpgid",
"getsid",
"setsid",
"setpgid"
};
static char *args[] = {
@@ -116,7 +121,12 @@ static char *args[] = {
"entry %p stack %p", // newthread
"N/A", // threadexit
"futex %p op %d value %d timespec %p", // futex
"N/A" // gettid
"N/A", // gettid
"N/A", // getppid
"pid %d", // getpgid
"pid %d", // getsid
"N/A", // setsid
"pid %d pgid %d", // setpgid
};
#endif
@@ -129,7 +139,6 @@ __attribute__((no_caller_saved_registers)) void arch_syscall_log(int syscall, ui
thread_t *thread = _cpu()->thread;
proc_t *proc = thread->proc;
snprintf(argbuff, 768, syscall < SYSCALL_COUNT ? args[syscall] : "N/A", a1, a2, a3, a4, a5, a6);
snprintf(printbuff, 1024, "\e[92msyscall: pid %d tid %d: %s: %s (%lu free pages)\n\e[0m", proc->pid, thread->tid, syscall < SYSCALL_COUNT ? name[syscall] : "invalid syscall", argbuff, freepagecount);