mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-29 13:48:21 +00:00
kernel: usercopy functions
This commit is contained in:
@@ -5,8 +5,9 @@
|
||||
#include <kernel/net.h>
|
||||
#include <kernel/alloc.h>
|
||||
|
||||
// TODO nosignal
|
||||
syscallret_t syscall_sendmsg(context_t *, int fd, msghdr_t *umsghdr, int flags) {
|
||||
__assert(flags == 0);
|
||||
//__assert(flags == 0);
|
||||
syscallret_t ret;
|
||||
|
||||
msghdr_t msghdr;
|
||||
@@ -25,7 +26,10 @@ syscallret_t syscall_sendmsg(context_t *, int fd, msghdr_t *umsghdr, int flags)
|
||||
uintmax_t iovoffset = 0;
|
||||
|
||||
for (int i = 0; i < msghdr.iovcount; ++i) {
|
||||
memcpy((void *)((uintptr_t)buffer + iovoffset), msghdr.iov[i].addr, msghdr.iov[i].len);
|
||||
ret.errno = usercopy_fromuser((void *)((uintptr_t)buffer + iovoffset), msghdr.iov[i].addr, msghdr.iov[i].len);
|
||||
if (ret.errno)
|
||||
goto cleanup;
|
||||
|
||||
iovoffset += msghdr.iov[i].len;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user