summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-03-21 22:43:25 -0700
committerElliott Hughes <enh@google.com>2013-03-21 23:07:11 -0700
commit8794ece296dd62cbeb3d00fe57c831c90a1bef77 (patch)
treed8ade6d821c0d1c3090a5aebcbd538fb36b98a67 /libc
parent3323628d635d3973965ee458c1fee7d8ab45136f (diff)
downloadbionic-8794ece296dd62cbeb3d00fe57c831c90a1bef77.tar.gz
bionic-8794ece296dd62cbeb3d00fe57c831c90a1bef77.tar.bz2
bionic-8794ece296dd62cbeb3d00fe57c831c90a1bef77.zip
Replace unnecessary ARM uses of <sys/linux-syscalls.h> with <asm/unistd.h>.
For some reason, socketcalls.c was only being compiled for ARM, where it makes no sense. For x86 we generate stubs for the socket functions that use __NR_socketcall directly. Change-Id: I84181e6183fae2314ae3ed862276eba82ad21e8e
Diffstat (limited to 'libc')
-rw-r--r--libc/Android.mk1
-rw-r--r--libc/arch-arm/bionic/_exit_with_stack_teardown.S2
-rw-r--r--libc/arch-arm/bionic/clone.S2
-rw-r--r--libc/arch-arm/bionic/futex_arm.S2
-rw-r--r--libc/arch-arm/bionic/syscall.S1
-rw-r--r--libc/bionic/socketcalls.c259
6 files changed, 3 insertions, 264 deletions
diff --git a/libc/Android.mk b/libc/Android.mk
index 9064907cc..c47cc6722 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -366,7 +366,6 @@ libc_upstream_netbsd_src_files := \
ifeq ($(TARGET_ARCH),arm)
libc_common_src_files += \
bionic/memmove.c.arm \
- bionic/socketcalls.c \
string/bcopy.c \
string/strncmp.c \
diff --git a/libc/arch-arm/bionic/_exit_with_stack_teardown.S b/libc/arch-arm/bionic/_exit_with_stack_teardown.S
index b00ea28d2..ac79d4323 100644
--- a/libc/arch-arm/bionic/_exit_with_stack_teardown.S
+++ b/libc/arch-arm/bionic/_exit_with_stack_teardown.S
@@ -27,7 +27,7 @@
*/
#include <machine/asm.h>
-#include <sys/linux-syscalls.h>
+#include <asm/unistd.h>
// void _exit_with_stack_teardown(void* stackBase, int stackSize, int retCode)
ENTRY(_exit_with_stack_teardown)
diff --git a/libc/arch-arm/bionic/clone.S b/libc/arch-arm/bionic/clone.S
index 281230c9e..01eb96610 100644
--- a/libc/arch-arm/bionic/clone.S
+++ b/libc/arch-arm/bionic/clone.S
@@ -28,7 +28,7 @@
#include <linux/err.h>
#include <machine/asm.h>
-#include <sys/linux-syscalls.h>
+#include <asm/unistd.h>
// int __pthread_clone(void* (*fn)(void*), void* child_stack, int flags, void* arg);
ENTRY(__pthread_clone)
diff --git a/libc/arch-arm/bionic/futex_arm.S b/libc/arch-arm/bionic/futex_arm.S
index bbd0629b8..e21a38509 100644
--- a/libc/arch-arm/bionic/futex_arm.S
+++ b/libc/arch-arm/bionic/futex_arm.S
@@ -26,7 +26,7 @@
* SUCH DAMAGE.
*/
-#include <sys/linux-syscalls.h>
+#include <asm/unistd.h>
#include <machine/asm.h>
#define FUTEX_WAIT 0
diff --git a/libc/arch-arm/bionic/syscall.S b/libc/arch-arm/bionic/syscall.S
index be9591e4e..510d2984f 100644
--- a/libc/arch-arm/bionic/syscall.S
+++ b/libc/arch-arm/bionic/syscall.S
@@ -28,7 +28,6 @@
#include <linux/err.h>
#include <machine/asm.h>
-#include <sys/linux-syscalls.h>
ENTRY(syscall)
mov ip, sp
diff --git a/libc/bionic/socketcalls.c b/libc/bionic/socketcalls.c
deleted file mode 100644
index 51bdf5776..000000000
--- a/libc/bionic/socketcalls.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#include <unistd.h>
-#include <sys/socket.h>
-#include <sys/linux-syscalls.h>
-
-enum
-{
- SYS_SOCKET = 1,
- SYS_BIND,
- SYS_CONNECT,
- SYS_LISTEN,
- SYS_ACCEPT,
- SYS_GETSOCKNAME,
- SYS_GETPEERNAME,
- SYS_SOCKETPAIR,
- SYS_SEND,
- SYS_RECV,
- SYS_SENDTO,
- SYS_RECVFROM,
- SYS_SHUTDOWN,
- SYS_SETSOCKOPT,
- SYS_GETSOCKOPT,
- SYS_SENDMSG,
- SYS_RECVMSG
-};
-
-#ifndef __NR_socket
-int socket(int domain, int type, int protocol)
-{
- unsigned long t[3];
-
- t[0] = (unsigned long) domain;
- t[1] = (unsigned long) type;
- t[2] = (unsigned long) protocol;
-
- return (int) __socketcall( SYS_SOCKET, t );
-}
-#endif /* !__NR_socket */
-
-
-#ifndef __NR_bind
-int bind(int sockfd, const struct sockaddr *my_addr, socklen_t addrlen)
-{
- unsigned long t[3];
-
- t[0] = (unsigned long) sockfd;
- t[1] = (unsigned long) my_addr;
- t[2] = (unsigned long) addrlen;
-
- return (int) __socketcall( SYS_BIND, t );
-}
-#endif /* !__NR_bind */
-
-#ifndef __NR_connect
-int connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen )
-{
- unsigned long t[3];
-
- t[0] = (unsigned long) sockfd;
- t[1] = (unsigned long) serv_addr;
- t[2] = (unsigned long) addrlen;
-
- return (int) __socketcall( SYS_CONNECT, t );
-}
-#endif /* !__NR_connect */
-
-#ifndef __NR_listen
-int listen(int s, int backlog)
-{
- unsigned long t[2];
-
- t[0] = (unsigned long) s;
- t[1] = (unsigned long) backlog;
-
- return (int) __socketcall( SYS_LISTEN, t );
-}
-#endif /* __NR_listen */
-
-#ifndef __NR_accept
-int accept(int sock, struct sockaddr *adresse, socklen_t *longueur)
-{
- unsigned long t[3];
-
- t[0] = (unsigned long) sock;
- t[1] = (unsigned long) adresse;
- t[2] = (unsigned long) longueur;
-
- return (int) __socketcall( SYS_ACCEPT, t );
-}
-#endif /* __NR_accept */
-
-#ifndef __NR_getsockname
-int getsockname(int s, struct sockaddr * name, socklen_t * namelen )
-{
- unsigned long t[3];
-
- t[0] = (unsigned long) s;
- t[1] = (unsigned long) name;
- t[2] = (unsigned long) namelen;
-
- return (int) __socketcall( SYS_GETSOCKNAME, t );
-}
-#endif /* __NR_getsockname */
-
-#ifndef __NR_getpeername
-int getpeername(int s, struct sockaddr *name, socklen_t *namelen)
-{
- unsigned long t[3];
-
- t[0] = (unsigned long) s;
- t[1] = (unsigned long) name;
- t[2] = (unsigned long) namelen;
-
- return (int) __socketcall( SYS_GETPEERNAME, t );
-}
-#endif /* !__NR_getpeername */
-
-#ifndef __NR_socketpair
-int socketpair(int d, int type, int protocol, int sv[2])
-{
- unsigned long t[4];
-
- t[0] = (unsigned long) d;
- t[1] = (unsigned long) type;
- t[2] = (unsigned long) protocol;
- t[3] = (unsigned long) sv;
-
- return (int) __socketcall( SYS_SOCKETPAIR, t );
-}
-#endif /* __NR_socketpair */
-
-#ifndef __NR_sendto
-ssize_t sendto(int socket, const void *message, size_t length, int flags,
- const struct sockaddr *dest_addr, socklen_t dest_len)
-{
- unsigned long t[6];
-
- t[0] = (unsigned long) socket;
- t[1] = (unsigned long) message;
- t[2] = (unsigned long) length;
- t[3] = (unsigned long) flags;
- t[4] = (unsigned long) dest_addr;
- t[5] = (unsigned long) dest_len;
-
- return __socketcall( SYS_SENDTO, t );
-}
-#endif /* !__NR_sendto */
-
-#ifndef __NR_recvfrom
-ssize_t recvfrom(int socket, void *buffer, size_t length, unsigned int flags,
- const struct sockaddr *address, socklen_t *address_len)
-{
- unsigned long t[6];
-
- t[0] = (unsigned long) socket;
- t[1] = (unsigned long) buffer;
- t[2] = (unsigned long) length;
- t[3] = (unsigned long) flags;
- t[4] = (unsigned long) address;
- t[5] = (unsigned long) address_len;
-
- return __socketcall( SYS_RECVFROM, t );
-}
-#endif /* !__NR_recvfrom */
-
-#ifndef __NR_shutdown
-int shutdown(int socket, int how)
-{
- unsigned long t[2];
-
- t[0] = (unsigned long) socket;
- t[1] = (unsigned long) how;
-
- return (int) __socketcall( SYS_SHUTDOWN, t );
-}
-#endif /* !__NR_shutdown */
-
-#ifndef __NR_setsockopt
-int setsockopt( int s, int level, int optname, const void* optval, socklen_t optlen )
-{
- unsigned long t[5];
-
- t[0] = (unsigned long) s;
- t[1] = (unsigned long) level;
- t[2] = (unsigned long) optname;
- t[3] = (unsigned long) optval;
- t[4] = (unsigned long) optlen;
-
- return (int) __socketcall( SYS_SETSOCKOPT, t );
-}
-#endif /* !__NR_setsockopt */
-
-#ifndef __NR_getsockopt
-int getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
-{
- unsigned long t[5];
-
- t[0] = (unsigned long) s;
- t[1] = (unsigned long) level;
- t[2] = (unsigned long) optname;
- t[3] = (unsigned long) optval;
- t[4] = (unsigned long) optlen;
-
- return (int) __socketcall( SYS_GETSOCKOPT, t );
-}
-#endif /* !__NR_getsockopt */
-
-#ifndef __NR_sendmsg
-int sendmsg (int socket, const struct msghdr *message, unsigned int flags)
-{
- unsigned long t[3];
-
- t[0] = (unsigned long) socket;
- t[1] = (unsigned long) message;
- t[2] = (unsigned long) flags;
-
- return __socketcall( SYS_SENDMSG, t );
-}
-#endif /* __NR_sendmsg */
-
-#ifndef __NR_recvmsg
-int recvmsg(int socket, struct msghdr *message, unsigned int flags)
-{
- unsigned long t[3];
-
- t[0] = (unsigned long) socket;
- t[1] = (unsigned long) message;
- t[2] = (unsigned long) flags;
-
- return __socketcall( SYS_RECVMSG, t );
-}
-#endif /* __NR_recvmsg */
-