From d50d18c9da3a125f0196bec89802dec1c5b0b800 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Fri, 27 Oct 2023 22:17:24 +0200 Subject: Kernel/LibC/Networking: Be able to send UDP messages Now it can send UDP messages to a specific IP address and libc has enough to create a basic UDP ECHO server, that is kinda cool. --- userland/libc/sys/socket/recvfrom.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 userland/libc/sys/socket/recvfrom.c (limited to 'userland/libc/sys/socket/recvfrom.c') diff --git a/userland/libc/sys/socket/recvfrom.c b/userland/libc/sys/socket/recvfrom.c new file mode 100644 index 0000000..5bbfeea --- /dev/null +++ b/userland/libc/sys/socket/recvfrom.c @@ -0,0 +1,17 @@ +#include +#include +#include + +struct two_args { + uint32_t a; + uint32_t b; +}; + +size_t recvfrom(int socket, void *buffer, size_t length, int flags, + struct sockaddr *address, socklen_t *address_len) { + struct two_args extra_args; + extra_args.a = address; + extra_args.b = address_len; + + return syscall(SYS_RECVFROM, socket, buffer, length, flags, &extra_args); +} -- cgit v1.2.3