sockfs: support FIONBIO ioctl

This commit is contained in:
Matheus
2026-04-23 12:09:35 -03:00
parent 789384249f
commit d46ee0f4ec
7 changed files with 34 additions and 14 deletions
+1
View File
@@ -165,6 +165,7 @@ typedef struct {
#define SIOCGIFHWADDR 0x8927
#define SIOCADDRT 0x890b
#define FIONREAD 0x541B
#define FIONBIO 0x5421
typedef struct {
char name[IFNAMSIZ];
+6
View File
@@ -7,6 +7,7 @@
#include <kernel/poll.h>
#include <kernel/usercopy.h>
#include <kernel/iovec.h>
#include <stdbool.h>
#define SOCKET_STATE_UNBOUND 0
#define SOCKET_STATE_BOUND 1
@@ -27,6 +28,7 @@ typedef struct {
int type;
int shutdown;
int error;
bool nonblocking;
} socket_t;
typedef struct {
@@ -89,6 +91,10 @@ typedef struct {
#define SOCKET_TYPE_TCP 2
#define SOCKFS_SOCKET_FROM_NODE(nodep) (((socketnode_t *)(nodep))->socket)
static inline bool socket_nonblocking(socket_t *socket, uintmax_t flags) {
return socket->nonblocking || (flags & V_FFLAGS_NONBLOCKING);
}
static inline int socket_recv(socket_t *socket, void *buffer, size_t size, uintmax_t flags, size_t *bytes_read) {
iovec_iterator_t iovec_iterator;