ipc: add fifo

This commit is contained in:
Michael Shaw 2025-02-12 20:01:11 -05:00
commit 4ec7ff5aaa
9 changed files with 133 additions and 19 deletions

View file

@ -42,5 +42,7 @@ void load_stack_and_jump(uintptr_t rsp, uintptr_t rbp, void *func, void *arg);
typedef uintptr_t paddr_t;
typedef uint32_t paddr32_t;
typedef int64_t ssize_t;
typedef int mode_t;
typedef long dev_t;
#endif /* _COMMON_H_ */

View file

@ -4,17 +4,17 @@
#include <kernel/common.h>
struct ringbuf {
typedef struct _ringbuf {
char *buf;
size_t size;
size_t head;
size_t tail;
};
} ringbuf_t;
struct ringbuf *ringbuf_create(size_t size);
void ringbuf_destroy(struct ringbuf *rb);
ringbuf_t *ringbuf_create(size_t size);
void ringbuf_destroy(ringbuf_t *rb);
size_t ringbuf_write(struct ringbuf *rb, const char *buf, size_t count);
size_t ringbuf_read(struct ringbuf *rb, char *buf, size_t count);
size_t ringbuf_write(ringbuf_t *rb, const char *buf, size_t count);
size_t ringbuf_read(ringbuf_t *rb, char *buf, size_t count);
#endif /* _RINGBUF_H */

View file

@ -7,6 +7,7 @@
#define SYS_OPEN 2
#define SYS_FORK 57
#define SYS_EXIT 60
#define SYS_MKNOD 133
#include <kernel/common.h>
#include <kernel/proc.h>