28#define SOCK_NONBLOCK 0x00000800
29#define SOCK_CLOEXEC 0x00080000
34#define MSG_CTRUNC 0x0008
35#define MSG_DONTWAIT 0x0040
36#define MSG_NOSIGNAL 0x4000
37#define MSG_CMSG_CLOEXEC 0x40000000
39#define UNIX_PATH_MAX 108
40#define SOCKET_MAX_FDS 16
124 struct file **files,
uint32_t file_count,
bool dontwait);
136 struct file **files,
uint32_t *file_count,
bool dontwait);
kerr_t
unified kernel error codes.
Definition error.h:14
uint8_t flags
Definition idt.c:3
unsigned int uint32_t
Definition fb.h:17
unsigned short uint16_t
Definition stdint.h:13
int int32_t
Definition stdint.h:14
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:19
int socket(int domain, int type, int protocol)
an open-file description.
Definition file.h:64
Definition unix_socket.h:66
size_t len
Definition unix_socket.h:67
int32_t type
Definition unix_socket.h:69
int32_t level
Definition unix_socket.h:68
Definition unix_socket.h:49
uintptr_t base
Definition unix_socket.h:50
size_t len
Definition unix_socket.h:51
Definition unix_socket.h:55
uint32_t namelen
Definition unix_socket.h:57
int32_t flags
Definition unix_socket.h:62
uintptr_t name
Definition unix_socket.h:56
uintptr_t iov
Definition unix_socket.h:58
size_t iovlen
Definition unix_socket.h:59
size_t controllen
Definition unix_socket.h:61
uintptr_t control
Definition unix_socket.h:60
Definition unix_socket.h:43
char sun_path[UNIX_PATH_MAX]
Definition unix_socket.h:45
uint16_t sun_family
Definition unix_socket.h:44
kerr_t unix_socket_pair(uint32_t flags, file_t **a, file_t **b)
make two connected sockets (socketpair).
Definition unix_socket.c:299
int32_t unix_socket_send(file_t *file, const kiovec_t *iov, uint32_t iov_count, file_t **files, uint32_t file_count, bool dontwait)
send data from user memory, with files to pass (may be 0 of them).
Definition unix_socket.c:502
kerr_t unix_socket_create(uint32_t flags, file_t **out)
make a new, unconnected socket and its open file.
Definition unix_socket.c:281
unix_socket_t * unix_socket_of(file_t *file)
the socket of an open file, or NULL if the file is not a socket.
Definition unix_socket.c:181
int32_t unix_socket_listen(unix_socket_t *s, uint32_t backlog)
let a bound socket take connections.
Definition unix_socket.c:363
int32_t unix_socket_connect(unix_socket_t *s, const char *path)
connect to the listening socket with this name.
Definition unix_socket.c:380
int32_t unix_socket_accept(file_t *listener, uint32_t new_flags, file_t **out)
take the next connection of a listening socket (blocks unless the file is non-blocking).
Definition unix_socket.c:431
int32_t unix_socket_receive(file_t *file, const kiovec_t *iov, uint32_t iov_count, file_t **files, uint32_t *file_count, bool dontwait)
receive data into user memory, and the files passed with its first byte.
Definition unix_socket.c:605
int32_t unix_socket_bind(unix_socket_t *s, const char *path)
give a socket a name.
Definition unix_socket.c:319
#define UNIX_PATH_MAX
Definition unix_socket.h:39
struct unix_socket unix_socket_t
Definition unix_socket.h:72