mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 20:58:22 +00:00
proc: unlock console on exit if locked by the dying process
This commit is contained in:
@@ -47,6 +47,7 @@ typedef struct proc_t {
|
||||
struct fd_t *fd;
|
||||
mode_t umask;
|
||||
int flags;
|
||||
bool console_locked;
|
||||
vnode_t *cwd;
|
||||
vnode_t *root;
|
||||
spinlock_t nodeslock;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <kernel/elf.h>
|
||||
#include <kernel/devfs.h>
|
||||
#include <kernel/kernel_args.h>
|
||||
#include <kernel/console.h>
|
||||
|
||||
static hashtable_t pid_table;
|
||||
static scache_t *processcache;
|
||||
@@ -296,6 +297,10 @@ void proc_exit(void) {
|
||||
itimer_pause(&proc->timer.virtualtime, 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
|
||||
MUTEX_ACQUIRE(&proc->mutex);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user