summaryrefslogtreecommitdiff
path: root/userland/libc/sys
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-04-29 22:00:55 +0200
committerAnton Kling <anton@kling.gg>2024-04-29 22:00:55 +0200
commit231301a6190605bd3ced4d961ee0d5d3fcd49d65 (patch)
tree8af67c28f9b638393f700fbaf2c9e33fd97a8b46 /userland/libc/sys
parent7d2ab3a71f4bda9d8ee997764d98b29e13a902c5 (diff)
Kernel/IRC: Add setsockopt and move IRC client to use new socket interface
Diffstat (limited to 'userland/libc/sys')
-rw-r--r--userland/libc/sys/socket/connect.c6
-rw-r--r--userland/libc/sys/socket/setsockopt.c8
2 files changed, 14 insertions, 0 deletions
diff --git a/userland/libc/sys/socket/connect.c b/userland/libc/sys/socket/connect.c
new file mode 100644
index 0000000..9b692ef
--- /dev/null
+++ b/userland/libc/sys/socket/connect.c
@@ -0,0 +1,6 @@
+#include <sys/socket.h>
+#include <syscall.h>
+
+int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) {
+ RC_ERRNO(syscall(SYS_CONNECT, sockfd, addr, addrlen, 0, 0));
+}
diff --git a/userland/libc/sys/socket/setsockopt.c b/userland/libc/sys/socket/setsockopt.c
new file mode 100644
index 0000000..3fa69d6
--- /dev/null
+++ b/userland/libc/sys/socket/setsockopt.c
@@ -0,0 +1,8 @@
+#include <sys/socket.h>
+#include <syscall.h>
+
+int setsockopt(int socket, int level, int option_name, const void *option_value,
+ socklen_t option_len) {
+ RC_ERRNO(syscall(SYS_SETSOCKOPT, socket, level, option_name, option_value,
+ option_len));
+}