41 #define MIN_PIPE_BUFFER_SIZE 0x1000 42 #define MAX_PIPE_BUFFER_SIZE 0x10000 44 static void __pipeDestroy(
struct object *obj);
45 static uint32_t __pipeGetMinHandle(
UNUSED struct object *obj);
46 static void __pipeShutdown(
struct object *obj, uint32_t
mode);
47 static int32_t __pipeGetStatus(
struct object *obj, uint32_t
mode);
48 static struct linkedList *__pipeWait(
struct object *obj, uint32_t
mode, uint32_t *result);
49 static int32_t __pipeWrite(
struct object *obj, uint8_t *buf, uint32_t length);
50 static int32_t __pipeRead(
struct object *obj, uint8_t *buf, uint32_t length);
66 static void __stdoutDestroy(
struct object *obj);
67 static uint32_t __stdoutGetMinHandle(
UNUSED struct object *obj);
68 static int32_t __stdoutWrite(
UNUSED struct object *obj, uint8_t *buf, uint32_t length);
104 __objectInit(&p->
obj, &pipeFunctions);
121 static void __pipeDestroy(
struct object *
obj)
145 static uint32_t __pipeGetMinHandle(
UNUSED struct object *obj)
163 static void __pipeShutdown(
struct object *obj, uint32_t
mode)
197 static int32_t __pipeGetStatus(
struct object *obj, uint32_t
mode)
201 if (!p->
writeable && (mode || used == 0))
return -1;
218 static struct linkedList *__pipeWait(
struct object *obj, uint32_t
mode, uint32_t *result)
269 static int32_t __pipeWrite(
struct object *obj, uint8_t *buf, uint32_t length)
297 uint32_t new_size = p->
size * 2;
298 while (new_size < p->
writePos + length) new_size *= 2;
314 if (used) queueWakeup(&p->
readWaiters,
true, used);
329 static int32_t __pipeRead(
struct object *obj, uint8_t *buf, uint32_t length)
341 if (length > used) length = used;
389 __objectInit(&p->
obj, &stdoutFunctions);
399 static void __stdoutDestroy(
struct object *obj)
414 static uint32_t __stdoutGetMinHandle(
UNUSED struct object *obj)
428 static int32_t __stdoutWrite(
UNUSED struct object *obj, uint8_t *buf, uint32_t length)
struct linkedList writeWaiters
void * heapReAlloc(void *addr, uint32_t length)
Resizes a block of kernel memory.
const struct objectFunctions * functions
void * heapAlloc(uint32_t length)
Allocates a block of kernel memory.
void heapFree(void *addr)
Deallocates a block of kernel memory.
#define MAX_PIPE_BUFFER_SIZE
struct pipe * pipeCreate()
Creates a new kernel pipe object.
#define MIN_PIPE_BUFFER_SIZE
void * memmove(void *destination, const void *source, size_t num)
Moves a block of memory from source to destination.
#define objectContainer(p, type, functions)
void * memcpy(void *destination, const void *source, size_t num)
Copies a block of memory from source to destination.
struct linkedList readWaiters
void consoleWriteStringLen(const char *str, size_t len)
Write a string with a fixed size to the console.
struct stdout * stdoutCreate()
Creates a new kernel stdout object.