diff options
Diffstat (limited to 'userland/libc/sys/socket')
-rw-r--r-- | userland/libc/sys/socket/recvfrom.c | 17 | ||||
-rw-r--r-- | userland/libc/sys/socket/sendto.c | 16 |
2 files changed, 33 insertions, 0 deletions
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 <assert.h> +#include <sys/socket.h> +#include <syscall.h> + +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); +} diff --git a/userland/libc/sys/socket/sendto.c b/userland/libc/sys/socket/sendto.c new file mode 100644 index 0000000..73437ab --- /dev/null +++ b/userland/libc/sys/socket/sendto.c @@ -0,0 +1,16 @@ +#include <sys/socket.h> +#include <syscall.h> + +struct two_args { + uint32_t a; + uint32_t b; +}; + +size_t sendto(int socket, const void *message, size_t length, int flags, + const struct sockaddr *dest_addr, socklen_t dest_len) { + struct two_args extra = { + .a = dest_addr, + .b = dest_len, + }; + return syscall(SYS_SENDTO, socket, message, length, flags, &extra); +} |