processctl() PCTL_SPAWN cmd, scheduler embryo state, redirected pipes
This commit is contained in:
@ -7,9 +7,10 @@
|
||||
#include "errors.h"
|
||||
#include "pipe.h"
|
||||
|
||||
int32_t ipc_pipeinit(IpcPipe *pipe) {
|
||||
int32_t ipc_pipeinit(IpcPipe *pipe, uint64_t pid) {
|
||||
hal_memset(pipe, 0, sizeof(*pipe));
|
||||
spinlock_init(&pipe->spinlock);
|
||||
pipe->ownerpid = pid;
|
||||
pipe->rbuf.buffer = dlmalloc(IPC_PIPE_MAX);
|
||||
if (pipe->rbuf.buffer == NULL) {
|
||||
return E_NOMEMORY;
|
||||
@ -19,7 +20,9 @@ int32_t ipc_pipeinit(IpcPipe *pipe) {
|
||||
}
|
||||
|
||||
void ipc_pipefree(IpcPipe *pipe) {
|
||||
dlfree(pipe->rbuf.buffer);
|
||||
if (pipe->rbuf.buffer != NULL) {
|
||||
dlfree(pipe->rbuf.buffer);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t ipc_pipewrite(IpcPipe *pipe, const uint8_t *const buffer, size_t n) {
|
||||
|
@ -12,9 +12,10 @@ typedef struct IpcPipe {
|
||||
struct IpcPipe *next;
|
||||
RBuf rbuf;
|
||||
SpinLock spinlock;
|
||||
uint64_t ownerpid;
|
||||
} IpcPipe;
|
||||
|
||||
int32_t ipc_pipeinit(IpcPipe *pipe);
|
||||
int32_t ipc_pipeinit(IpcPipe *pipe, uint64_t pid);
|
||||
void ipc_pipefree(IpcPipe *pipe);
|
||||
int32_t ipc_pipewrite(IpcPipe *pipe, const uint8_t *const buffer, size_t n);
|
||||
int32_t ipc_piperead(IpcPipe *pipe, uint8_t *const buffer, size_t n);
|
||||
|
Reference in New Issue
Block a user