Add special event pipes, rework ps2kb process

This commit is contained in:
2025-09-08 22:12:50 +02:00
parent 94dd38d010
commit ab224eda8e
9 changed files with 101 additions and 13 deletions

View File

@ -44,6 +44,7 @@ int32_t SYSCALL5(sys_ipcpipe, pid1, pipenum1, cmd1, buffer1, len1) {
}
if ((ret = ipc_pipeinit(pipe)) < 0) {
ret = E_NOMEMORY;
goto done;
}
@ -93,6 +94,37 @@ int32_t SYSCALL5(sys_ipcpipe, pid1, pipenum1, cmd1, buffer1, len1) {
ret = ipc_piperead(pipe, buffer, len1);
} break;
case IPCPIPE_REG_EVT_PIPE: {
if (pipenum >= PROC_PIPEHANDLES_MAX) {
ret = E_NOMEMORY;
goto done;
}
IpcPipe *pipe = proc->pipes[pipenum];
if (pipe == NULL) {
ret = E_INVALIDARGUMENT;
goto done;
}
uint64_t pid2 = len1;
Proc *proc2 = NULL;
spinlock_acquire(&PROCS.spinlock);
LL_FINDPROP(PROCS.procs, proc2, pid, pid2);
spinlock_release(&PROCS.spinlock);
if (proc2 == NULL) {
ret = E_INVALIDARGUMENT;
goto done;
}
spinlock_acquire(&proc2->eventpipes_spinlock);
LL_APPEND(proc2->eventpipes, pipe);
spinlock_release(&proc2->eventpipes_spinlock);
ret = E_OK;
} break;
default: {
ret = E_INVALIDARGUMENT;
} break;