add PCTL_DELETE for removing pipes

This commit is contained in:
2025-09-18 22:43:24 +02:00
parent 024a5b2e21
commit 4c17f26915
4 changed files with 30 additions and 18 deletions

View File

@ -61,6 +61,21 @@ int32_t SYSCALL5(sys_ipcpipe, pid1, pipenum1, cmd1, buffer1, len1) {
ret = E_OK;
} break;
case IPCPIPE_DELETE: {
if (pipenum >= PROC_PIPEHANDLES_MAX) {
ret = E_NOMEMORY;
goto done;
}
spinlock_acquire(&proc->pipes_spinlock);
if (proc->pipes[pipenum] != NULL) {
ipc_pipefree(proc->pipes[pipenum]);
dlfree(proc->pipes[pipenum]);
proc->pipes[pipenum] = NULL;
}
spinlock_release(&proc->pipes_spinlock);
ret = E_OK;
} break;
case IPCPIPE_WRITE: {
if (pipenum >= PROC_PIPEHANDLES_MAX) {
ret = E_INVALIDARGUMENT;