|
8 | 8 |
|
9 | 9 | #include "src/sys/socket/recvfrom.h" |
10 | 10 |
|
| 11 | +#include <linux/net.h> // For SYS_SOCKET socketcall number. |
| 12 | +#include <sys/syscall.h> // For syscall numbers. |
| 13 | + |
11 | 14 | #include "hdr/types/socklen_t.h" |
12 | 15 | #include "hdr/types/ssize_t.h" |
13 | 16 | #include "hdr/types/struct_sockaddr.h" |
14 | 17 | #include "src/__support/OSUtil/syscall.h" // For internal syscall function. |
15 | 18 | #include "src/__support/common.h" |
16 | 19 | #include "src/__support/macros/sanitizer.h" |
17 | 20 | #include "src/errno/libc_errno.h" |
18 | | -#include <linux/net.h> // For SYS_SOCKET socketcall number. |
19 | | -#include <sys/syscall.h> // For syscall numbers. |
20 | 21 |
|
21 | 22 | namespace LIBC_NAMESPACE_DECL { |
22 | 23 |
|
23 | 24 | LLVM_LIBC_FUNCTION(ssize_t, recvfrom, |
24 | 25 | (int sockfd, const void *buf, size_t len, int flags, |
25 | | - const struct sockaddr *dest_addr, socklen_t addrlen)) { |
| 26 | + const struct sockaddr *dest_addr, socklen_t *addrlen)) { |
26 | 27 | #ifdef SYS_recvfrom |
27 | | - |
28 | | - ssize_t ret = LIBC_NAMESPACE::syscall_impl<int>( |
29 | | - SYS_recvfrom, sockfd, reinterpret_cast<long>(buf), len, flags, |
30 | | - reinterpret_cast<long>(dest_addr), addrlen); |
| 28 | + ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>( |
| 29 | + SYS_recvfrom, sockfd, buf, len, flags, dest_addr, addrlen); |
31 | 30 | #elif defined(SYS_socketcall) |
32 | 31 | unsigned long sockcall_args[6] = {static_cast<unsigned long>(sockfd), |
33 | 32 | reinterpret_cast<unsigned long>(buf), |
34 | 33 | static_cast<unsigned long>(len), |
35 | 34 | static_cast<unsigned long>(flags), |
36 | 35 | reinterpret_cast<unsigned long>(dest_addr), |
37 | 36 | static_cast<unsigned long>(addrlen)}; |
38 | | - ssize_t ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_socketcall, SYS_RECVFROM, |
39 | | - sockcall_args); |
| 37 | + ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>( |
| 38 | + SYS_socketcall, SYS_RECVFROM, sockcall_args); |
40 | 39 | #else |
41 | 40 | #error "socket and socketcall syscalls unavailable for this platform." |
42 | 41 | #endif |
|
0 commit comments