ipc: add fifo
This commit is contained in:
parent
f56f3842b2
commit
4ec7ff5aaa
9 changed files with 133 additions and 19 deletions
|
|
@ -46,6 +46,8 @@
|
|||
#define O_TRUNC 0x0010
|
||||
#define O_APPEND 0x0020
|
||||
|
||||
#define S_IFIFO 0x1000
|
||||
|
||||
#define FS_TYPE_EXT2 0x0001
|
||||
#define FS_TYPE_PFS 0x0002 /* pseudo fs */
|
||||
|
||||
|
|
@ -139,6 +141,7 @@ ssize_t vfs_write(struct file *file, void *buf, off_t off, size_t count);
|
|||
ssize_t vfs_read(struct file *file, void *buf, off_t off, size_t count);
|
||||
int vfs_statf(struct file *file, struct statbuf *statbuf);
|
||||
struct file *vfs_open(const char *pathname, int *err);
|
||||
struct vnode *vfs_mknod(const char *pathname, mode_t mode);
|
||||
int vfs_close(struct file *file);
|
||||
int unlink(const char *pathname);
|
||||
int statfd(struct file_descriptor *fdesc, struct statbuf *statbuf);
|
||||
|
|
|
|||
|
|
@ -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_ */
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue