Compare commits

...

2 Commits

Author SHA1 Message Date
91ecc2dc6a Break when IpcPipe is full 2025-11-11 00:51:29 +01:00
1f793f287f Clean up kernel/proc, remove devs_spinlock, remove PROC_DIE() macro 2025-11-11 00:32:09 +01:00
3 changed files with 3 additions and 10 deletions

View File

@ -33,7 +33,9 @@ int32_t ipc_pipewrite(IpcPipe *pipe, const uint8_t *const buffer, size_t n) {
size_t i = 0;
spinlock_acquire(&pipe->spinlock);
for (; i < n; i++) {
rbuf_push(&pipe->rbuf, buffer[i]);
if (rbuf_push(&pipe->rbuf, buffer[i]) < 0) {
break;
}
}
spinlock_release(&pipe->spinlock);
return i;

View File

@ -141,7 +141,6 @@ Proc *proc_spawnuser(char *mountpoint, char *path) {
proc->pid = pids++;
proc->mman_map_base = PROC_MMAN_MAP_BASE;
spinlock_init(&proc->pipes_spinlock);
spinlock_init(&proc->devs_spinlock);
proc->pipes[0] = dlmalloc(sizeof(IpcPipe));
ipc_pipeinit(proc->pipes[0], proc->pid);

View File

@ -61,7 +61,6 @@ typedef struct Proc {
SpinLock pipes_spinlock;
Dev *devs[PROC_DEVHANDLES_MAX];
SpinLock devs_spinlock;
struct {
ProcArg *list;
@ -88,13 +87,6 @@ void proc_sched(void *cpustate);
void proc_killself(void);
void proc_kill(Proc *proc);
#define PROC_DIE() \
do { \
proc_killself(); \
for(;;); \
} while(0)
#define PROC_ARG(proc, str) \
do { \
ProcArg *__arg = dlmalloc(sizeof(*__arg)); \