all procs are user procs

This commit is contained in:
2025-09-29 21:32:07 +02:00
parent 20a89502c0
commit 4e8afae5fb
5 changed files with 13 additions and 36 deletions

View File

@ -200,7 +200,6 @@ void proc_reaper(void) {
pmm_free((uintptr_t)(zombie->platformdata.kstack - PROC_STACKSIZE), PROC_STACKBLOCKS);
pmm_free((uintptr_t)(zombie->platformdata.pstack - PROC_STACKSIZE), PROC_STACKBLOCKS);
if (!zombie->kern) {
VasRange *vas, *vastmp;
LL_FOREACH_SAFE(zombie->vas, vas, vastmp) {
hal_vmm_unmap_range(zombie->platformdata.cr3, vas->virtstart, vas->physstart, vas->size);
@ -215,7 +214,6 @@ void proc_reaper(void) {
dlfree(arg->string);
dlfree(arg);
}
}
dlfree(zombie);
}
spinlock_release(&PROCS.spinlock);
@ -250,22 +248,6 @@ void proc_killself(void) {
spinlock_release(&PROCS.spinlock);
}
void proc_status(void) {
static const char *statuses[] = {"ready", "running", "zombie", "waiting"};
for (;;) {
spinlock_acquire(&PROCS.spinlock);
Proc *head = PROCS.procs;
while (head) {
kprintf("%s %s %s\n", head->kern ? "kern" : "user", statuses[head->state], head->name);
head = head->next;
}
kprintf("\n\n");
spinlock_release(&PROCS.spinlock);
hal_wait(3 * 1000);
}
}
void proc_init(void) {
spinlock_init(&PROCS.spinlock);
PROCS.procs = NULL;

View File

@ -54,8 +54,6 @@ typedef struct Proc {
uint8_t state;
VasRange *vas;
bool kern;
VfsObj *vobjs[PROC_VFSHANDLES_MAX];
uint64_t vobjcnt;

View File

@ -139,7 +139,6 @@ int32_t SYSCALL5(sys_processctl, pid1, cmd1, arg1, arg2, arg3) {
stat->pid = p->pid;
hal_strcpy(stat->name, p->name);
stat->state = p->state;
stat->kern = p->kern;
VasRange *vas, *vastmp;
LL_FOREACH_SAFE(p->vas, vas, vastmp) {

View File

@ -20,7 +20,6 @@ typedef struct {
char name[0x100];
uint8_t state;
size_t usemem;
bool kern;
} ProcStat;
#endif // SHARE_HDRS_PROCESSCTL_H_

View File

@ -64,7 +64,7 @@ void pctl_ls(void) {
char *namebuf = umalloc(34);
char *membuf = umalloc(20);
uprintf("%-30s %s %-6s %-15s %-8s\n", "NAME", "PID", "TYPE", "MEMORY", "STATE");
uprintf("%-30s %s %-15s %-8s\n", "NAME", "PID", "MEMORY", "STATE");
for (size_t i = 0; i < procslen; i++) {
ProcStat stat; ZERO(&stat);
@ -86,10 +86,9 @@ void pctl_ls(void) {
namebuf[31] = namebuf[32] = namebuf[33] = '.';
// Too big format string causes a stack overflow. This is an issue with printf ;(
uprintf("%-30s %-3lu %-6s %-15s ",
uprintf("%-30s %-3lu %-15s ",
namebuf,
stat.pid,
stat.kern ? "KERNEL" : "USER",
human_size(stat.usemem, membuf, 20)
);
uprintf("%-8s", states[stat.state]);