apsun / loliOS

Lightweight & operational Linux-inspired OS.
33 stars 1 forks source link

Make socketcalls respect nonblocking flag #15

Closed apsun closed 2 years ago

apsun commented 5 years ago

Currently socketcalls always return -EAGAIN even if the file descriptor is not set to nonblocking mode which is kinda out of place. Potential solution paths:

a) use BLOCKING_WAIT at the socketcall level (socket.c). The socket struct can have a single sleep queue. Pros: less complexity at the protocol level, no need to propagate nonblocking flag to protocol layer. Cons: not as flexible.

b) use BLOCKING_WAIT at the protocol level (tcp.c/udp.c). Pros: fully customizable by syscall/whatever. Cons: need to figure out how to propagate the nonblocking flag.

apsun commented 2 years ago

Implemented in 577e13aa4e2ebb4d1e95b6e44bd663568183e498 and 443f88cff6df23eac1d12977ec0819cab8e5a951