Browse Source

if both __NR_send and __NR_socketcall do not exist, fall back to __NR_sendto (same goes for recv/recvfrom)

Mike Frysinger 19 years ago
parent
commit
7d0af1f89e
1 changed files with 12 additions and 0 deletions
  1. 12 0
      libc/inet/socketcalls.c

+ 12 - 0
libc/inet/socketcalls.c

@@ -164,6 +164,12 @@ ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags)
 	return (__socketcall(SYS_RECV, args));
 }
 weak_alias(__libc_recv, recv);
+#elif defined(__NR_recvfrom)
+ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags)
+{
+	return (recvfrom(sockfd, buffer, len, flags, NULL, NULL));
+}
+weak_alias(__libc_recv, recv);
 #endif
 #endif
 
@@ -227,6 +233,12 @@ ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags)
 	return (__socketcall(SYS_SEND, args));
 }
 weak_alias(__libc_send, send);
+#elif defined(__NR_sendto)
+ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags)
+{
+	return (sendto(sockfd, buffer, len, flags, NULL, 0));
+}
+weak_alias(__libc_send, send);
 #endif
 #endif