Browse Source

mmap/mremap/socket/rewind gone

Peter S. Mazinger 18 years ago
parent
commit
77ccb5b1dc

+ 3 - 0
include/libc-internal.h

@@ -198,6 +198,9 @@ extern int __sigprocmask (int __how, __const __sigset_t *__restrict __set,
 /* #include <sys/ioctl.h> */
 extern int __ioctl (int __fd, unsigned long int __request, ...) attribute_hidden;
 
+/* #include <sys/socket.h> */
+extern int __socket (int __domain, int __type, int __protocol) attribute_hidden;
+
 #  if 0 /* undoable here */
 /* #include <dirent.h> */
 typedef struct __dirstream DIR;

+ 1 - 1
libc/inet/getaddrinfo.c

@@ -159,7 +159,7 @@ static int addrconfig (sa_family_t af)
     int s;
     int ret;
     int saved_errno = errno;
-    s = socket(af, SOCK_DGRAM, 0);
+    s = __socket(af, SOCK_DGRAM, 0);
     if (s < 0)
 	ret = (errno == EMFILE) ? 1 : 0;
     else

+ 1 - 0
libc/inet/getnetent.c

@@ -16,6 +16,7 @@
  */
 
 #define inet_network __inet_network
+#define rewind __rewind
 
 #define __FORCE_GLIBC
 #include <features.h>

+ 1 - 0
libc/inet/getproto.c

@@ -53,6 +53,7 @@
 
 #define strpbrk __strpbrk
 #define atoi __atoi
+#define rewind __rewind
 
 #define __FORCE_GLIBC
 #define _GNU_SOURCE

+ 1 - 0
libc/inet/getservice.c

@@ -53,6 +53,7 @@
 
 #define strpbrk __strpbrk
 #define atoi __atoi
+#define rewind __rewind
 
 #define __FORCE_GLIBC
 #define _GNU_SOURCE

+ 2 - 2
libc/inet/if_nametoindex.c

@@ -32,10 +32,10 @@ static int __opensock(void)
 {
     int fd;
 #ifdef __UCLIBC_HAS_IPV6__
-    fd=socket(AF_INET6,SOCK_DGRAM,0);
+    fd=__socket(AF_INET6,SOCK_DGRAM,0);
     if (fd<0)
 #endif /* __UCLIBC_HAS_IPV6__ */
-	fd=socket(AF_INET,SOCK_DGRAM,0);
+	fd=__socket(AF_INET,SOCK_DGRAM,0);
     return(fd);
 }
 

+ 4 - 2
libc/inet/resolv.c

@@ -146,6 +146,8 @@
 #define inet_ntop __inet_ntop
 #define connect __connect
 #define select __select
+#define recv __recv
+#define send __send
 
 #define __FORCE_GLIBC
 #include <features.h>
@@ -770,9 +772,9 @@ int attribute_hidden __dns_lookup(const char *name, int type, int nscount, char
 
 #ifdef __UCLIBC_HAS_IPV6__
 		v6 = inet_pton(AF_INET6, dns, &sa6.sin6_addr) > 0;
-		fd = socket(v6 ? AF_INET6 : AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+		fd = __socket(v6 ? AF_INET6 : AF_INET, SOCK_DGRAM, IPPROTO_UDP);
 #else
-		fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+		fd = __socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
 #endif
 		if (fd < 0) {
                     retries++;

+ 1 - 1
libc/inet/rpc/clnt_tcp.c

@@ -175,7 +175,7 @@ __clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers,
    */
   if (*sockp < 0)
     {
-      *sockp = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
+      *sockp = __socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
       (void) bindresvport (*sockp, (struct sockaddr_in *) 0);
       if ((*sockp < 0)
 	  || (connect (*sockp, (struct sockaddr *) raddr,

+ 4 - 1
libc/inet/rpc/clnt_udp.c

@@ -49,6 +49,9 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
 #define _seterr_reply __seterr_reply
 #define setsockopt __setsockopt
 #define bindresvport __bindresvport
+#define recvfrom __recvfrom
+#define sendto __sendto
+#define recvmsg __recvmsg
 
 #define __FORCE_GLIBC
 #include <features.h>
@@ -197,7 +200,7 @@ __clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
     {
       int dontblock = 1;
 
-      *sockp = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+      *sockp = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
       if (*sockp < 0)
 	{
 	  struct rpc_createerr *ce = &get_rpc_createerr ();

+ 3 - 1
libc/inet/rpc/clnt_unix.c

@@ -59,6 +59,8 @@
 #define _seterr_reply __seterr_reply
 #define setsockopt __setsockopt
 #define connect __connect
+#define recvmsg __recvmsg
+#define sendmsg __sendmsg
 
 #define __FORCE_GLIBC
 #include <features.h>
@@ -158,7 +160,7 @@ __clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers,
    */
   if (*sockp < 0)
     {
-      *sockp = socket (AF_UNIX, SOCK_STREAM, 0);
+      *sockp = __socket (AF_UNIX, SOCK_STREAM, 0);
       len = __strlen (raddr->sun_path) + sizeof (raddr->sun_family) + 1;
       if (*sockp < 0
 	  || connect (*sockp, (struct sockaddr *) raddr, len) < 0)

+ 1 - 1
libc/inet/rpc/get_myaddress.c

@@ -65,7 +65,7 @@ get_myaddress (struct sockaddr_in *addr)
   struct ifreq ifreq, *ifr;
   int len, loopback = 0;
 
-  if ((s = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
+  if ((s = __socket (AF_INET, SOCK_DGRAM, 0)) < 0)
     {
       __perror ("get_myaddress: socket");
       exit (1);

+ 1 - 0
libc/inet/rpc/getrpcent.c

@@ -34,6 +34,7 @@
  */
 
 #define atoi __atoi
+#define rewind __rewind
 
 #define __FORCE_GLIBC
 #include <features.h>

+ 1 - 1
libc/inet/rpc/pmap_clnt.c

@@ -66,7 +66,7 @@ __get_myaddress (struct sockaddr_in *addr)
   struct ifreq ifreq, *ifr;
   int len, loopback = 1;
 
-  if ((s = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
+  if ((s = __socket (AF_INET, SOCK_DGRAM, 0)) < 0)
     {
       __perror ("__get_myaddress: socket");
       exit (1);

+ 3 - 1
libc/inet/rpc/pmap_rmt.c

@@ -49,6 +49,8 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";
 #define inet_netof __inet_netof
 #define clntudp_create __clntudp_create
 #define setsockopt __setsockopt
+#define recvfrom __recvfrom
+#define sendto __sendto
 
 #define __FORCE_GLIBC
 #include <features.h>
@@ -274,7 +276,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
    * initialization: create a socket, a broadcast address, and
    * preserialize the arguments into a send buffer.
    */
-  if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
+  if ((sock = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
     {
       __perror (_("Cannot create socket for broadcast rpc"));
       stat = RPC_CANTSEND;

+ 1 - 1
libc/inet/rpc/rcmd.c

@@ -280,7 +280,7 @@ int attribute_hidden __rresvport(int *alport)
 
     sin.sin_family = AF_INET;
     sin.sin_addr.s_addr = INADDR_ANY;
-    s = socket(AF_INET, SOCK_STREAM, 0);
+    s = __socket(AF_INET, SOCK_STREAM, 0);
     if (s < 0)
 	return -1;
     for (;;) {

+ 2 - 2
libc/inet/rpc/rexec.c

@@ -93,7 +93,7 @@ __rexec_af(char **ahost, int rport, const char *name, const char *pass, const ch
 	}
 	__ruserpass(res0->ai_canonname, &name, &pass);
 retry:
-	s = socket(res0->ai_family, res0->ai_socktype, 0);
+	s = __socket(res0->ai_family, res0->ai_socktype, 0);
 	if (s < 0) {
 		__perror("rexec: socket");
 		return (-1);
@@ -115,7 +115,7 @@ retry:
 		char num[32];
 		int s2, sa2len;
 
-		s2 = socket(res0->ai_family, res0->ai_socktype, 0);
+		s2 = __socket(res0->ai_family, res0->ai_socktype, 0);
 		if (s2 < 0) {
 			(void) __close(s);
 			return (-1);

+ 3 - 1
libc/inet/rpc/rtime.c

@@ -44,6 +44,8 @@ static char sccsid[] = "@(#)rtime.c	2.2 88/08/10 4.0 RPCSRC; from 1.8 88/02/08 S
  */
 
 #define connect __connect
+#define recvfrom __recvfrom
+#define sendto __sendto
 
 #define __FORCE_GLIBC
 #include <features.h>
@@ -93,7 +95,7 @@ rtime (struct sockaddr_in *addrp, struct rpc_timeval *timep,
   else
     type = SOCK_DGRAM;
 
-  s = socket (AF_INET, type, 0);
+  s = __socket (AF_INET, type, 0);
   if (s < 0)
     return (-1);
 

+ 1 - 1
libc/inet/rpc/svc_tcp.c

@@ -166,7 +166,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize)
 
   if (sock == RPC_ANYSOCK)
     {
-      if ((sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
+      if ((sock = __socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
 	{
 	  __perror (_("svc_tcp.c - tcp socket creation problem"));
 	  return (SVCXPRT *) NULL;

+ 5 - 1
libc/inet/rpc/svc_udp.c

@@ -48,6 +48,10 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";
 #define setsockopt __setsockopt
 #define bind __bind
 #define bindresvport __bindresvport
+#define recvfrom __recvfrom
+#define sendto __sendto
+#define recvmsg __recvmsg
+#define sendmsg __sendmsg
 
 #define __FORCE_GLIBC
 #define _GNU_SOURCE
@@ -135,7 +139,7 @@ __svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz)
 
   if (sock == RPC_ANYSOCK)
     {
-      if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
+      if ((sock = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
 	{
 	  __perror (_("svcudp_create: socket creation problem"));
 	  return (SVCXPRT *) NULL;

+ 3 - 1
libc/inet/rpc/svc_unix.c

@@ -50,6 +50,8 @@
 #define getsockname __getsockname
 #define setsockopt __setsockopt
 #define bind __bind
+#define recvmsg __recvmsg
+#define sendmsg __sendmsg
 
 #define __FORCE_GLIBC
 #include <features.h>
@@ -161,7 +163,7 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path)
 
   if (sock == RPC_ANYSOCK)
     {
-      if ((sock = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
+      if ((sock = __socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
 	{
 	  __perror (_("svc_unix.c - AF_UNIX socket creation problem"));
 	  return (SVCXPRT *) NULL;

+ 1 - 1
libc/misc/syslog/syslog.c

@@ -148,7 +148,7 @@ __openlog( const char *ident, int logstat, int logfac )
 		      sizeof(SyslogAddr.sa_data));
 retry:
 	if (LogStat & LOG_NDELAY) {
-	    if ((LogFile = socket(AF_UNIX, logType, 0)) == -1){
+	    if ((LogFile = __socket(AF_UNIX, logType, 0)) == -1){
 		UNLOCK;
 		return;
 	    }

+ 1 - 0
libc/misc/ttyent/getttyent.c

@@ -28,6 +28,7 @@
  */
 
 #define __fsetlocking __fsetlocking_internal
+#define rewind __rewind
 
 #define _GNU_SOURCE
 #include <features.h>

+ 1 - 0
libc/pwd_grp/pwd_grp.c

@@ -20,6 +20,7 @@
 
 #define setgroups __setgroups
 #define strtoul __strtoul
+#define rewind __rewind
 
 #define _GNU_SOURCE
 #include <features.h>

+ 2 - 1
libc/stdio/rewind.c

@@ -7,7 +7,7 @@
 
 #include "_stdio.h"
 
-void rewind(register FILE *stream)
+void attribute_hidden __rewind(register FILE *stream)
 {
 	__STDIO_AUTO_THREADLOCK_VAR;
 
@@ -18,3 +18,4 @@ void rewind(register FILE *stream)
 
 	__STDIO_AUTO_THREADUNLOCK(stream);
 }
+strong_alias(__rewind,rewind)

+ 1 - 0
libc/stdlib/malloc-simple/alloc.c

@@ -6,6 +6,7 @@
  * Parts of the memalign code were stolen from malloc-930716.
  */
 
+#define mmap __mmap
 #define munmap __munmap
 
 #define _GNU_SOURCE

+ 1 - 0
libc/stdlib/malloc-standard/malloc.h

@@ -14,6 +14,7 @@
   Hacked up for uClibc by Erik Andersen <andersen@codepoet.org>
 */
 
+#define mmap __mmap
 #define sysconf __sysconf
 
 #include <features.h>

+ 2 - 0
libc/stdlib/malloc-standard/realloc.c

@@ -14,6 +14,8 @@
   Hacked up for uClibc by Erik Andersen <andersen@codepoet.org>
 */
 
+#define mremap __mremap
+
 #include "malloc.h"
 
 

+ 2 - 0
libc/stdlib/malloc/malloc.c

@@ -11,6 +11,8 @@
  * Written by Miles Bader <miles@gnu.org>
  */
 
+#define mmap __mmap
+
 #include <stdlib.h>
 #include <unistd.h>
 #include <errno.h>

+ 1 - 0
libc/sysdeps/linux/arm/ioperm.c

@@ -34,6 +34,7 @@
    enable all the ports all of the time.  */
 
 #define readlink __readlink
+#define mmap __mmap
 
 #include <errno.h>
 #include <fcntl.h>

+ 1 - 4
libc/sysdeps/linux/arm/mmap64.S

@@ -52,10 +52,7 @@ mmap64:
 	mov	r0, ip			@ first arg was clobbered
 	teq	r5, $0
 	ldmeqfd	sp!, {r4, r5, lr}
-#ifdef __PIC__
-	beq	mmap(PLT)
-#else
-	beq	mmap
+	beq	__mmap
 #endif
 .Linval:
 	mov	r0, $-EINVAL

+ 2 - 1
libc/sysdeps/linux/common/mmap.c

@@ -14,7 +14,7 @@
 #ifdef __NR_mmap
 #define __NR__mmap __NR_mmap
 static inline _syscall1(__ptr_t, _mmap, unsigned long *, buffer);
-__ptr_t mmap(__ptr_t addr, size_t len, int prot,
+__ptr_t attribute_hidden __mmap(__ptr_t addr, size_t len, int prot,
 			 int flags, int fd, __off_t offset)
 {
 	unsigned long buffer[6];
@@ -27,4 +27,5 @@ __ptr_t mmap(__ptr_t addr, size_t len, int prot,
 	buffer[5] = (unsigned long) offset;
 	return (__ptr_t) _mmap(buffer);
 }
+strong_alias(__mmap,mmap)
 #endif

+ 2 - 1
libc/sysdeps/linux/common/mmap64.c

@@ -19,6 +19,8 @@
 
 /* Massivly hacked up for uClibc by Erik Andersen */
 
+#define mmap __mmap
+
 #include <features.h>
 #include <errno.h>
 #include <unistd.h>
@@ -84,4 +86,3 @@ __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t
 
 #endif
 #endif /* __UCLIBC_HAS_LFS__ */
-

+ 3 - 1
libc/sysdeps/linux/common/mremap.c

@@ -10,5 +10,7 @@
 #include "syscalls.h"
 #include <unistd.h>
 #include <sys/mman.h>
-_syscall4(__ptr_t, mremap, __ptr_t, old_address, size_t, old_size, size_t,
+#define __NR___mremap __NR_mremap
+attribute_hidden _syscall4(__ptr_t, __mremap, __ptr_t, old_address, size_t, old_size, size_t,
 		  new_size, int, may_move);
+strong_alias(__mremap,mremap)

+ 2 - 1
libc/sysdeps/linux/frv/mmap.c

@@ -38,7 +38,7 @@ static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
 #  define MMAP2_PAGE_SHIFT 12
 # endif
 
-__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
+__ptr_t attribute_hidden __mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
 {
     if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) {
 	__set_errno (EINVAL);
@@ -46,3 +46,4 @@ __ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offs
     }
     return(__syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT)));
 }
+strong_alias(__mmap,mmap)

+ 3 - 1
libc/sysdeps/linux/hppa/mmap.c

@@ -13,5 +13,7 @@
 #include <sys/mman.h>
 #include <sys/syscall.h>
 
-_syscall6(void *, mmap, void *, start, size_t, length, int, prot,
+#define __NR___mmap __NR_mmap
+attribute_hidden _syscall6(void *, __mmap, void *, start, size_t, length, int, prot,
           int, flags, int, fd, off_t, offset);
+strong_alias(__mmap,mmap)

+ 7 - 4
libc/sysdeps/linux/i386/mmap.S

@@ -21,10 +21,13 @@
 #include <bits/errno.h>
 #include <sys/syscall.h>
 
-.text
 .global mmap
-.type   mmap,%function
-mmap:
+.set mmap,__mmap
+.text
+.global __mmap
+.hidden __mmap
+.type   __mmap,%function
+__mmap:
 
 	/* Save registers.  */
 	movl %ebx, %edx
@@ -46,4 +49,4 @@ mmap:
 	/* Successful; return the syscall's value.  */
 	ret
 
-.size mmap,.-mmap
+.size __mmap,.-__mmap

+ 3 - 1
libc/sysdeps/linux/mips/mmap.c

@@ -14,5 +14,7 @@
 #endif
 #endif
 
-_syscall6 (__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot,
+#define __NR___mmap __NR_mmap
+attribute_hidden _syscall6 (__ptr_t, __mmap, __ptr_t, addr, size_t, len, int, prot,
 	   int, flags, int, fd, __off_t, offset);
+strong_alias(__mmap,mmap)

+ 2 - 2
libc/sysdeps/linux/powerpc/mmap.c

@@ -10,7 +10,7 @@
 	return (__sc_err & 0x10000000 ? errno = __sc_ret, __sc_ret = -1 : 0), \
 	       (type) __sc_ret
 
-void * mmap(void *start, size_t length, int prot, int flags, int fd,
+void attribute_hidden * __mmap(void *start, size_t length, int prot, int flags, int fd,
 	off_t offset)
 {
 	unsigned long __sc_ret, __sc_err;
@@ -45,4 +45,4 @@ void * mmap(void *start, size_t length, int prot, int flags, int fd,
 
 	__syscall_return (void *);
 }
-
+strong_alias(__mmap,mmap)

+ 3 - 1
libc/sysdeps/linux/sh/mmap.c

@@ -31,4 +31,6 @@
 
 #include <sys/syscall.h>
 
-_syscall6(__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset);
+#define __NR___mmap __NR_mmap
+attribute_hidden _syscall6(__ptr_t, __mmap, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, offset);
+strong_alias(__mmap,mmap)

+ 3 - 1
libc/sysdeps/linux/x86_64/mmap.c

@@ -13,5 +13,7 @@
 #include <sys/mman.h>
 #include <sys/syscall.h>
 
-_syscall6(void *, mmap, void *, start, size_t, length, int, prot,
+#define __NR___mmap __NR_mmap
+attribute_hidden _syscall6(void *, __mmap, void *, start, size_t, length, int, prot,
           int, flags, int, fd, off_t, offset);
+strong_alias(__mmap,mmap)

+ 1 - 0
libc/unistd/exec.c

@@ -30,6 +30,7 @@
  * to free the storage allocated for the copy.  Better ideas anyone?
  */
 
+#define mmap __mmap
 #define munmap __munmap
 #define execve __execve