proc: unlock console on exit if locked by the dying process

This commit is contained in:
Matheus
2026-06-29 00:46:51 -03:00
parent e4d3649a15
commit b186bf333d
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -47,6 +47,7 @@ typedef struct proc_t {
struct fd_t *fd; struct fd_t *fd;
mode_t umask; mode_t umask;
int flags; int flags;
bool console_locked;
vnode_t *cwd; vnode_t *cwd;
vnode_t *root; vnode_t *root;
spinlock_t nodeslock; spinlock_t nodeslock;
+5
View File
@@ -9,6 +9,7 @@
#include <kernel/elf.h> #include <kernel/elf.h>
#include <kernel/devfs.h> #include <kernel/devfs.h>
#include <kernel/kernel_args.h> #include <kernel/kernel_args.h>
#include <kernel/console.h>
static hashtable_t pid_table; static hashtable_t pid_table;
static scache_t *processcache; static scache_t *processcache;
@@ -296,6 +297,10 @@ void proc_exit(void) {
itimer_pause(&proc->timer.virtualtime, NULL, NULL); itimer_pause(&proc->timer.virtualtime, NULL, NULL);
itimer_pause(&proc->timer.profiling, NULL, NULL); itimer_pause(&proc->timer.profiling, NULL, NULL);
if (__atomic_load_n(&proc->console_locked, __ATOMIC_RELAXED)) {
__assert(console_set_lock(false) == 0);
}
// zombify the proc // zombify the proc
MUTEX_ACQUIRE(&proc->mutex); MUTEX_ACQUIRE(&proc->mutex);