From 231301a6190605bd3ced4d961ee0d5d3fcd49d65 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Mon, 29 Apr 2024 22:00:55 +0200 Subject: Kernel/IRC: Add setsockopt and move IRC client to use new socket interface --- userland/libc/include/socket.h | 57 -------------------------------------- userland/libc/include/sys/socket.h | 11 -------- userland/libc/include/syscall.h | 3 +- 3 files changed, 2 insertions(+), 69 deletions(-) delete mode 100644 userland/libc/include/socket.h delete mode 100644 userland/libc/include/sys/socket.h (limited to 'userland/libc/include') diff --git a/userland/libc/include/socket.h b/userland/libc/include/socket.h deleted file mode 100644 index bee592b..0000000 --- a/userland/libc/include/socket.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef SOCKET_H -#define SOCKET_H -#include -#include - -#define AF_UNIX 0 -#define AF_INET 1 -#define AF_LOCAL AF_UNIX - -#define SOCK_DGRAM 0 -#define SOCK_STREAM 1 - -#define INADDR_ANY 0 - -typedef struct { - int domain; - int type; - int protocol; - - // UNIX socket - char *path; - int incoming_fd; -} SOCKET; - -typedef struct { - char *path; - SOCKET *s; -} OPEN_UNIX_SOCKET; - -typedef uint32_t in_addr_t; -typedef uint16_t in_port_t; -typedef unsigned int sa_family_t; -typedef int socklen_t; - -struct sockaddr { - sa_family_t sa_family; /* Address family */ - char *sa_data; /* Socket address */ -}; - -struct sockaddr_in { - sa_family_t sin_family; - union { - uint32_t s_addr; - uint8_t a[4]; - } sin_addr; - uint16_t sin_port; -}; - -struct sockaddr_un { - sa_family_t sun_family; /* Address family */ - char *sun_path; /* Socket pathname */ -}; - -int socket(int domain, int type, int protocol); -int accept(int socket, struct sockaddr *address, socklen_t *address_len); -int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen); -#endif // SOCKET_H diff --git a/userland/libc/include/sys/socket.h b/userland/libc/include/sys/socket.h deleted file mode 100644 index fb874a1..0000000 --- a/userland/libc/include/sys/socket.h +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -#define MSG_WAITALL 1 - -size_t recvfrom(int socket, void *buffer, size_t length, int flags, - struct sockaddr *address, socklen_t *address_len); -size_t sendto(int socket, const void *message, size_t length, int flags, - const struct sockaddr *dest_addr, socklen_t dest_len); -int listen(int socket, int backlog); -int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); diff --git a/userland/libc/include/syscall.h b/userland/libc/include/syscall.h index f318955..dcc4742 100644 --- a/userland/libc/include/syscall.h +++ b/userland/libc/include/syscall.h @@ -1,8 +1,8 @@ #ifndef SYSCALL_H #define SYSCALL_H -#include "socket.h" #include #include +#include #include #define SYS_OPEN 0 @@ -60,6 +60,7 @@ #define SYS_OPEN_PROCESS 49 #define SYS_LSEEK 50 #define SYS_CONNECT 51 +#define SYS_SETSOCKOPT 52 int syscall(uint32_t eax, uint32_t ebx, uint32_t ecx, uint32_t edx, uint32_t esi, uint32_t edi); -- cgit v1.2.3