summaryrefslogtreecommitdiff
path: root/src/kernel/handle.h
AgeCommit message (Collapse)Author
2024-05-11kernel: DUP_RDONLY and DUP_WRONLYdzwdz
I probably should've tested DUP_WRONLY too, now that I think about it. TODO?
2023-12-25kernel: _sys_getnull() (basically /dev/null)dzwdz
2023-01-25style: typedef structs, shorter namespacesdzwdz
I've wanted to do this for a while, and since I've just had a relatively large refactor commit (pcpy), this is as good of a time as any. Typedefing structs was mostly inspired by Plan 9's coding style. It makes some lines of code much shorter at basically no expense. Everything related to userland kept old-style struct definitions, so as not to force that style onto other people. I also considered changing SCREAMING_ENUM_FIELDS to NicerLookingCamelcase, but I didn't, just in case that'd be confusing.
2022-10-08kernel/handle: reuse ->writeable/->readable for pipesdzwdz
2022-10-02syscall/open: add the full suite of READ/WRITE flagsdzwdz
2022-08-19syscall/fs_wait: return a handle for each requestdzwdz
2022-08-12vfs: OPEN_RO flag, read-only whitelist entriesdzwdz
2022-07-26shared: move some headers from shared/ to camellia/dzwdz
2022-07-09syscalls/pipe: turn into a POSIX-style api with separate rw endsdzwdz
Without separate read/write ends you can't tell when there are no more writers left if you have multiple readers. Consider this piece of code: int fd = pipe(); fork(); // execution continues in 2 processes while (read(fd, &some_buf, sizeof somebuf) >= 0) { ... } Once both processes call `read()`, it's obvious that no writes are possible - all the processes that hold a reference to the pipe are currently stuck on a `read()` call, so the kernel could just make it return an error in both. But, what then? It's still possible to write to the pipe, and you can't know if the other process will do that. Thus, if you don't want to miss any output, you have to keep reading the pipe. Forever. Both processes end up stuck. Having separate read/write ends prevents that.
2022-07-08syscall/fs_respond: get the file id from the buf argumentdzwdz
Previously, file ids could only be positive integers, so their range was 31 bits - not enough to represent the entire memory. Now, pointers can be safely used as file ids.
2022-07-06kernel/pipes: read & write supportdzwdz
2022-07-05kernel: initial partial pipe supportdzwdz
2022-05-06kernel: remove the union in `struct handle`dzwdz
2022-05-05kernel: fix a few minor compiler warningsdzwdz
2022-05-05kernel: ps2 driver is now a separate backenddzwdz
2022-05-04kernel: refcount vfs_backenddzwdz
what a mess
2022-05-01kernel/proc: `process_handle_get` for safely accepting handle idsdzwdz
2022-05-01kernel/proc: make handles separate refcounted objectsdzwdz
2022-04-28kernel/proc: simplify `process_seed`dzwdz
2021-11-02fork2() refactor: remove the unused back handle typedzwdz
2021-09-18put the `handle_t` typedef in `shared/types.h`dzwdz
2021-09-18merge `kernel/types.h` and `init/types.h`dzwdz
2021-09-07implement fs_create(), front/back fs handlesdzwdz
2021-09-04new vfs impl pt. 1: implement open()dzwdz
2021-09-04nuke the old handle codedzwdz
2021-09-04rename file descriptors to handlesdzwdz