about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/abort.c6
-rw-r--r--sysdeps/generic/dl-environ.c69
-rw-r--r--sysdeps/generic/dl-sysdep.c46
-rw-r--r--sysdeps/generic/fstatfs64.c4
-rw-r--r--sysdeps/generic/ftruncate64.c4
-rw-r--r--sysdeps/generic/getrlimit64.c4
-rw-r--r--sysdeps/generic/glob.c7
-rw-r--r--sysdeps/generic/prof-freq.c4
-rw-r--r--sysdeps/generic/putenv.c7
-rw-r--r--sysdeps/generic/statfs64.c4
-rw-r--r--sysdeps/generic/ttyname_r.c6
-rw-r--r--sysdeps/generic/utmp_file.c44
-rw-r--r--sysdeps/generic/vlimit.c4
-rw-r--r--sysdeps/generic/vtimes.c4
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h4
-rw-r--r--sysdeps/i386/memchr.S8
-rw-r--r--sysdeps/libm-i387/i686/s_fdim.S2
-rw-r--r--sysdeps/libm-i387/i686/s_fdimf.S2
-rw-r--r--sysdeps/libm-i387/i686/s_fdiml.S2
-rw-r--r--sysdeps/posix/cuserid.c4
-rw-r--r--sysdeps/posix/euidaccess.c8
-rw-r--r--sysdeps/posix/mkstemp.c4
-rw-r--r--sysdeps/posix/mktemp.c2
-rw-r--r--sysdeps/posix/pread.c10
-rw-r--r--sysdeps/posix/pread64.c10
-rw-r--r--sysdeps/posix/profil.c6
-rw-r--r--sysdeps/posix/pwrite.c10
-rw-r--r--sysdeps/posix/pwrite64.c10
-rw-r--r--sysdeps/posix/sigblock.c4
-rw-r--r--sysdeps/posix/sigpause.c6
-rw-r--r--sysdeps/posix/ttyname.c10
-rw-r--r--sysdeps/posix/ttyname_r.c10
-rw-r--r--sysdeps/posix/waitid.c2
-rw-r--r--sysdeps/unix/getlogin_r.c6
-rw-r--r--sysdeps/unix/grantpt.c10
-rw-r--r--sysdeps/unix/rewinddir.c4
-rw-r--r--sysdeps/unix/sysv/linux/accept.S1
-rw-r--r--sysdeps/unix/sysv/linux/bind.S1
-rw-r--r--sysdeps/unix/sysv/linux/gethostid.c4
-rw-r--r--sysdeps/unix/sysv/linux/getpt.c4
-rw-r--r--sysdeps/unix/sysv/linux/getsockname.S1
-rw-r--r--sysdeps/unix/sysv/linux/i386/socket.S6
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c40
-rw-r--r--sysdeps/unix/sysv/linux/listen.S1
-rw-r--r--sysdeps/unix/sysv/linux/ptsname.c2
-rw-r--r--sysdeps/unix/sysv/linux/recvfrom.S1
-rw-r--r--sysdeps/unix/sysv/linux/sendmsg.c6
-rw-r--r--sysdeps/unix/sysv/linux/sendto.S1
-rw-r--r--sysdeps/unix/sysv/linux/setsockopt.S1
-rw-r--r--sysdeps/unix/sysv/linux/statvfs.c4
-rw-r--r--sysdeps/unix/sysv/linux/ttyname.c6
-rw-r--r--sysdeps/unix/sysv/linux/ttyname_r.c10
-rw-r--r--sysdeps/unix/sysv/linux/ulimit.c4
-rw-r--r--sysdeps/unix/sysv/linux/unlockpt.c2
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h4
55 files changed, 243 insertions, 203 deletions
diff --git a/sysdeps/generic/abort.c b/sysdeps/generic/abort.c
index a38022a1a9..91c504607a 100644
--- a/sysdeps/generic/abort.c
+++ b/sysdeps/generic/abort.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 93, 95, 96, 97, 98 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,6 +31,10 @@
 # define ABORT_INSTRUCTION
 #endif
 
+#ifdef USE_IN_LIBIO
+# define fflush(s) _IO_fflush (s)
+#endif
+
 /* We must avoid to run in circles.  Therefore we remember how far we
    already got.  */
 static int stage;
diff --git a/sysdeps/generic/dl-environ.c b/sysdeps/generic/dl-environ.c
new file mode 100644
index 0000000000..433102757c
--- /dev/null
+++ b/sysdeps/generic/dl-environ.c
@@ -0,0 +1,69 @@
+/*Environment handling for dynamic loader.
+   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <string.h>
+
+
+extern char **_environ;
+
+/* Walk through the environment of the process and return all entries
+   starting with `LD_'.  */
+char *
+internal_function
+_dl_next_ld_env_entry (char ***position)
+{
+  char **current = *position;
+  char *result = NULL;
+
+  if (current == NULL)
+    /* We start over.  */
+    current = _environ;
+
+  while (result == NULL && *current != NULL)
+    {
+      if ((*current)[0] == 'L' && (*current)[1] == 'D' && (*current)[2] == '_')
+	result = *current;
+
+      ++current;
+    }
+
+  /* Save current position for next visit.  */
+  *position = current;
+
+  return result;
+}
+
+void
+unsetenv (const char *name)
+{
+  const size_t len = strlen (name);
+  char **ep;
+
+  for (ep = _environ; *ep != NULL; ++ep)
+    if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+      {
+	/* Found it.  Remove this pointer by moving later ones back.  */
+	char **dp = ep;
+
+	do
+	  dp[0] = dp[1];
+	while (*dp++);
+	/* Continue the loop in case NAME appears again.  */
+      }
+}
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index 6516ba9b1a..15f85550fe 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -252,52 +252,6 @@ _dl_show_auxv (void)
       }
 }
 
-/* Walk through the environment of the process and return all entries
-   starting with `LD_'.  */
-char *
-internal_function
-_dl_next_ld_env_entry (char ***position)
-{
-  char **current = *position;
-  char *result = NULL;
-
-  if (current == NULL)
-    /* We start over.  */
-    current = _environ;
-
-  while (result == NULL && *current != NULL)
-    {
-      if ((*current)[0] == 'L' && (*current)[1] == 'D' && (*current)[2] == '_')
-	result = *current;
-
-      ++current;
-    }
-
-  /* Save current position for next visit.  */
-  *position = current;
-
-  return result;
-}
-
-void
-unsetenv (const char *name)
-{
-  const size_t len = strlen (name);
-  char **ep;
-
-  for (ep = __environ; *ep != NULL; ++ep)
-    if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
-      {
-	/* Found it.  Remove this pointer by moving later ones back.  */
-	char **dp = ep;
-
-	do
-	  dp[0] = dp[1];
-	while (*dp++);
-	/* Continue the loop in case NAME appears again.  */
-      }
-}
-
 
 /* Return an array of useful/necessary hardware capability names.  */
 const struct r_strlenpair *
diff --git a/sysdeps/generic/fstatfs64.c b/sysdeps/generic/fstatfs64.c
index e34af2aa45..5ffdf9cd84 100644
--- a/sysdeps/generic/fstatfs64.c
+++ b/sysdeps/generic/fstatfs64.c
@@ -1,5 +1,5 @@
 /* Return information about the filesystem on which FD resides.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,7 +27,7 @@ fstatfs64 (int fd, struct statfs64 *buf)
 {
   struct statfs buf32;
 
-  if (fstatfs (fd, &buf32) < 0)
+  if (__fstatfs (fd, &buf32) < 0)
     return -1;
 
   buf->f_type = buf32.f_type;
diff --git a/sysdeps/generic/ftruncate64.c b/sysdeps/generic/ftruncate64.c
index 40c312c21b..a85293baf6 100644
--- a/sysdeps/generic/ftruncate64.c
+++ b/sysdeps/generic/ftruncate64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,5 +31,5 @@ ftruncate64 (fd, length)
       __set_errno (EINVAL);
       return -1;
     }
-  return ftruncate (fd, (off_t) length);
+  return __ftruncate (fd, (off_t) length);
 }
diff --git a/sysdeps/generic/getrlimit64.c b/sysdeps/generic/getrlimit64.c
index 742505f4b5..20b06d2154 100644
--- a/sysdeps/generic/getrlimit64.c
+++ b/sysdeps/generic/getrlimit64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,7 +27,7 @@ getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits)
 {
   struct rlimit rlimits32;
 
-  if (getrlimit (resource, &rlimits32) < 0)
+  if (__getrlimit (resource, &rlimits32) < 0)
     return -1;
 
   if (rlimits32.rlim_cur == RLIM_INFINITY)
diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c
index bc32d99359..70d125c200 100644
--- a/sysdeps/generic/glob.c
+++ b/sysdeps/generic/glob.c
@@ -239,6 +239,13 @@ extern char *alloca ();
 # endif
 #endif
 
+#ifdef _LIBC
+# define sysconf(id) __sysconf (id)
+# define closedir(dir) __closedir (dir)
+# define opendir(name) __opendir (name)
+# define readdir(str) __readdir (str)
+#endif
+
 #if !(defined STDC_HEADERS || defined __GNU_LIBRARY__)
 # undef	size_t
 # define size_t	unsigned int
diff --git a/sysdeps/generic/prof-freq.c b/sysdeps/generic/prof-freq.c
index ff085145b5..2755c1f9a2 100644
--- a/sysdeps/generic/prof-freq.c
+++ b/sysdeps/generic/prof-freq.c
@@ -49,8 +49,8 @@ __profile_frequency (void)
   tim.it_interval.tv_usec = 1;
   tim.it_value.tv_sec = 0;
   tim.it_value.tv_usec = 0;
-  setitimer(ITIMER_REAL, &tim, 0);
-  setitimer(ITIMER_REAL, 0, &tim);
+  __setitimer(ITIMER_REAL, &tim, 0);
+  __setitimer(ITIMER_REAL, 0, &tim);
   if (tim.it_interval.tv_usec < 2)
     return 0;
   return (1000000 / tim.it_interval.tv_usec);
diff --git a/sysdeps/generic/putenv.c b/sysdeps/generic/putenv.c
index d059c2f78c..3fcd5f93a8 100644
--- a/sysdeps/generic/putenv.c
+++ b/sysdeps/generic/putenv.c
@@ -45,9 +45,6 @@
 extern char *alloca ();
 #  endif /* __GNUC__ */
 # endif /* HAVE_ALLOCA_H */
-
-# define setenv __setenv
-# define unsetenv __unsetenv
 #endif /* _LIBC */
 
 
@@ -67,9 +64,9 @@ putenv (string)
       memcpy (name, string, name_end - string);
       name[name_end - string] = '\0';
 #endif
-      return setenv (name, name_end + 1, 1);
+      return __setenv (name, name_end + 1, 1);
     }
 
-  unsetenv (string);
+  __unsetenv (string);
   return 0;
 }
diff --git a/sysdeps/generic/statfs64.c b/sysdeps/generic/statfs64.c
index 050c05d659..01640e3c4e 100644
--- a/sysdeps/generic/statfs64.c
+++ b/sysdeps/generic/statfs64.c
@@ -1,5 +1,5 @@
 /* Return information about the filesystem on which FILE resides.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,7 +27,7 @@ statfs64 (const char *file, struct statfs64 *buf)
 {
   struct statfs buf32;
 
-  if (statfs (file, &buf32) < 0)
+  if (__statfs (file, &buf32) < 0)
     return -1;
 
   buf->f_type = buf32.f_type;
diff --git a/sysdeps/generic/ttyname_r.c b/sysdeps/generic/ttyname_r.c
index 6e8a9d6179..2a09b685d1 100644
--- a/sysdeps/generic/ttyname_r.c
+++ b/sysdeps/generic/ttyname_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,7 +23,7 @@
 /* Store at most BUFLEN characters the pathname of the terminal FD is
    open on in BUF.  Return 0 on success,  otherwise an error number.  */
 int
-ttyname_r (fd, buf, buflen)
+__ttyname_r (fd, buf, buflen)
      int fd;
      char *buf;
      size_t buflen;
@@ -31,7 +31,7 @@ ttyname_r (fd, buf, buflen)
   __set_errno (ENOSYS);
   return ENOSYS;
 }
-
+weak_alias (__ttyname_r, ttyname_r)
 
 stub_warning (ttyname_r)
 #include <stub-tag.h>
diff --git a/sysdeps/generic/utmp_file.c b/sysdeps/generic/utmp_file.c
index 1f7abb088b..ddf49467ef 100644
--- a/sysdeps/generic/utmp_file.c
+++ b/sysdeps/generic/utmp_file.c
@@ -59,23 +59,23 @@ static void timeout_handler (int signum) {};
   action.sa_handler = timeout_handler;                                  \
   sigemptyset (&action.sa_mask);                                        \
   action.sa_flags = 0;                                                  \
-  sigaction (SIGALRM, &action, &old_action);                            \
+  __sigaction (SIGALRM, &action, &old_action);                          \
                                                                         \
   alarm (TIMEOUT);                                                      \
                                                                         \
   /* Try to get the lock.  */                                           \
   memset (&fl, '\0', sizeof (struct flock));                            \
-  fl.l_type = (type);                                                 \
+  fl.l_type = (type);                                                   \
   fl.l_whence = SEEK_SET;                                               \
-  fcntl ((fd), F_SETLKW, &fl)
+  __fcntl ((fd), F_SETLKW, &fl)
 
 #define UNLOCK_FILE(fd) \
   /* Unlock the file.  */                                               \
   fl.l_type = F_UNLCK;                                                  \
-  fcntl ((fd), F_SETLKW, &fl);                                          \
+  __fcntl ((fd), F_SETLKW, &fl);                                        \
                                                                         \
   /* Reset the signal handler and alarm.  */                            \
-  sigaction (SIGALRM, &old_action, NULL);                               \
+  __sigaction (SIGALRM, &old_action, NULL);                             \
   alarm (old_timeout);                                                  \
 } while (0)
 
@@ -117,17 +117,17 @@ setutent_file (void)
 
       file_name = TRANSFORM_UTMP_FILE_NAME (__libc_utmp_file_name);
 
-      file_fd = open (file_name, O_RDWR);
+      file_fd = __open (file_name, O_RDWR);
       if (file_fd == -1)
 	{
 	  /* Hhm, read-write access did not work.  Try read-only.  */
-	  file_fd = open (file_name, O_RDONLY);
+	  file_fd = __open (file_name, O_RDONLY);
 	  if (file_fd == -1)
 	    return 0;
 	}
     }
 
-  lseek (file_fd, 0, SEEK_SET);
+  __lseek (file_fd, 0, SEEK_SET);
   file_offset = 0;
 
 #if _HAVE_UT_TYPE - 0
@@ -156,7 +156,7 @@ getutent_r_file (struct utmp *buffer, struct utmp **result)
   LOCK_FILE (file_fd, F_RDLCK);
 
   /* Read the next entry.  */
-  nbytes = read (file_fd, &last_entry, sizeof (struct utmp));
+  nbytes = __read (file_fd, &last_entry, sizeof (struct utmp));
 
   UNLOCK_FILE (file_fd);
 
@@ -221,7 +221,7 @@ internal_getut_r (const struct utmp *id, struct utmp *buffer)
       while (1)
 	{
 	  /* Read the next entry.  */
-	  if (read (file_fd, buffer, sizeof (struct utmp))
+	  if (__read (file_fd, buffer, sizeof (struct utmp))
 	      != sizeof (struct utmp))
 	    {
 	      __set_errno (ESRCH);
@@ -243,7 +243,7 @@ internal_getut_r (const struct utmp *id, struct utmp *buffer)
       while (1)
 	{
 	  /* Read the next entry.  */
-	  if (read (file_fd, buffer, sizeof (struct utmp))
+	  if (__read (file_fd, buffer, sizeof (struct utmp))
 	      != sizeof (struct utmp))
 	    {
 	      __set_errno (ESRCH);
@@ -312,7 +312,7 @@ getutline_r_file (const struct utmp *line, struct utmp *buffer,
   while (1)
     {
       /* Read the next entry.  */
-      if (read (file_fd, &last_entry, sizeof (struct utmp))
+      if (__read (file_fd, &last_entry, sizeof (struct utmp))
 	  != sizeof (struct utmp))
 	{
 	  __set_errno (ESRCH);
@@ -373,13 +373,13 @@ pututline_file (const struct utmp *data)
   if (found < 0)
     {
       /* We append the next entry.  */
-      file_offset = lseek (file_fd, 0, SEEK_END);
+      file_offset = __lseek (file_fd, 0, SEEK_END);
       if (file_offset % sizeof (struct utmp) != 0)
 	{
 	  file_offset -= file_offset % sizeof (struct utmp);
 	  __ftruncate (file_fd, file_offset);
 
-	  if (lseek (file_fd, 0, SEEK_END) < 0)
+	  if (__lseek (file_fd, 0, SEEK_END) < 0)
 	    {
 	      pbuf = NULL;
 	      goto unlock_return;
@@ -390,11 +390,11 @@ pututline_file (const struct utmp *data)
     {
       /* We replace the just read entry.  */
       file_offset -= sizeof (struct utmp);
-      lseek (file_fd, file_offset, SEEK_SET);
+      __lseek (file_fd, file_offset, SEEK_SET);
     }
 
   /* Write the new data.  */
-  if (write (file_fd, data, sizeof (struct utmp)) != sizeof (struct utmp))
+  if (__write (file_fd, data, sizeof (struct utmp)) != sizeof (struct utmp))
     {
       /* If we appended a new record this is only partially written.
 	 Remove it.  */
@@ -420,7 +420,7 @@ endutent_file (void)
 {
   assert (file_fd >= 0);
 
-  close (file_fd);
+  __close (file_fd);
   file_fd = -1;
 }
 
@@ -433,27 +433,27 @@ updwtmp_file (const char *file, const struct utmp *utmp)
   int fd;
 
   /* Open WTMP file.  */
-  fd = open (file, O_WRONLY);
+  fd = __open (file, O_WRONLY);
   if (fd < 0)
     return -1;
 
   LOCK_FILE (fd, F_WRLCK);
 
   /* Remember original size of log file.  */
-  offset = lseek (fd, 0, SEEK_END);
+  offset = __lseek (fd, 0, SEEK_END);
   if (offset % sizeof (struct utmp) != 0)
     {
       offset -= offset % sizeof (struct utmp);
       __ftruncate (fd, offset);
 
-      if (lseek (fd, 0, SEEK_END) < 0)
+      if (__lseek (fd, 0, SEEK_END) < 0)
 	goto unlock_return;
     }
 
   /* Write the entry.  If we can't write all the bytes, reset the file
      size back to the original size.  That way, no partial entries
      will remain.  */
-  if (write (fd, utmp, sizeof (struct utmp)) != sizeof (struct utmp))
+  if (__write (fd, utmp, sizeof (struct utmp)) != sizeof (struct utmp))
     {
       __ftruncate (fd, offset);
       goto unlock_return;
@@ -465,7 +465,7 @@ unlock_return:
   UNLOCK_FILE (fd);
 
   /* Close WTMP file.  */
-  close (fd);
+  __close (fd);
 
   return result;
 }
diff --git a/sysdeps/generic/vlimit.c b/sysdeps/generic/vlimit.c
index 5654be1205..68addbce7a 100644
--- a/sysdeps/generic/vlimit.c
+++ b/sysdeps/generic/vlimit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -39,7 +39,7 @@ vlimit (resource, value)
 	(enum __rlimit_resource) ((int) resource - 1);
       struct rlimit lims;
 
-      if (getrlimit (rlimit_res, &lims) < 0)
+      if (__getrlimit (rlimit_res, &lims) < 0)
 	return -1;
 
       lims.rlim_cur = value;
diff --git a/sysdeps/generic/vtimes.c b/sysdeps/generic/vtimes.c
index e448da6de1..0af59ca342 100644
--- a/sysdeps/generic/vtimes.c
+++ b/sysdeps/generic/vtimes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -35,7 +35,7 @@ vtimes_one (struct vtimes *vt, enum __rusage_who who)
     {
       struct rusage usage;
 
-      if (getrusage (who, &usage) < 0)
+      if (__getrusage (who, &usage) < 0)
 	return -1;
 
       vt->vm_utime = TIMEVAL_TO_VTIMES (usage.ru_utime);
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index 465592c764..b188026cdb 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -307,7 +307,7 @@ __sincosl (long double __x, long double *__sinx, long double *__cosx)
   __asm __volatile__							      \
     ("fldl2e			# e^x - 1 = 2^(x * log2(e)) - 1\n\t"	      \
      "fmul	%%st(1)		# x * log2(e)\n\t"			      \
-     "fstl	%%st(1)\n\t"						      \
+     "fst	%%st(1)\n\t"						      \
      "frndint			# int(x * log2(e))\n\t"			      \
      "fxch\n\t"								      \
      "fsub	%%st(1)		# fract(x * log2(e))\n\t"		      \
@@ -328,7 +328,7 @@ __inline_mathcode_ (long double, __expm1l, __x, __expm1_code)
   __asm __volatile__							      \
     ("fldl2e			# e^x = 2^(x * log2(e))\n\t"		      \
      "fmul	%%st(1)		# x * log2(e)\n\t"			      \
-     "fstl	%%st(1)\n\t"						      \
+     "fst	%%st(1)\n\t"						      \
      "frndint			# int(x * log2(e))\n\t"			      \
      "fxch\n\t"								      \
      "fsub	%%st(1)		# fract(x * log2(e))\n\t"		      \
diff --git a/sysdeps/i386/memchr.S b/sysdeps/i386/memchr.S
index c4dcef1a6c..1750aa8e26 100644
--- a/sysdeps/i386/memchr.S
+++ b/sysdeps/i386/memchr.S
@@ -1,7 +1,7 @@
 /* memchr (str, ch, n) -- Return pointer to first occurrence of CH in STR less
    than N.
    For Intel 80x86, x>=3.
-   Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
    Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@@ -70,7 +70,7 @@ ENTRY (memchr)
 	   So process first bytes one by one until boundary is
 	   reached. Don't use a loop for better performance.  */
 
-	testb $3, %eax		/* correctly aligned ? */
+	testb $3, %al		/* correctly aligned ? */
 	je L(2)			/* yes => begin loop */
 	cmpb %dl, (%eax)	/* compare byte */
 	je L(9)			/* target found => return */
@@ -78,7 +78,7 @@ ENTRY (memchr)
 	decl %esi		/* decrement length counter */
 	je L(4)			/* len==0 => return NULL */
 
-	testb $3, %eax		/* correctly aligned ? */
+	testb $3, %al		/* correctly aligned ? */
 	je L(2)			/* yes => begin loop */
 	cmpb %dl, (%eax)	/* compare byte */
 	je L(9)			/* target found => return */
@@ -86,7 +86,7 @@ ENTRY (memchr)
 	decl %esi		/* decrement length counter */
 	je L(4)			/* len==0 => return NULL */
 
-	testb $3, %eax		/* correctly aligned ? */
+	testb $3, %al		/* correctly aligned ? */
 	je L(2)			/* yes => begin loop */
 	cmpb %dl, (%eax)	/* compare byte */
 	je L(9)			/* target found => return */
diff --git a/sysdeps/libm-i387/i686/s_fdim.S b/sysdeps/libm-i387/i686/s_fdim.S
index 3f9f61b57d..6f722c5b07 100644
--- a/sysdeps/libm-i387/i686/s_fdim.S
+++ b/sysdeps/libm-i387/i686/s_fdim.S
@@ -28,7 +28,7 @@ ENTRY(__fdim)
 	fucomi	%st(1), %st
 	jp	1f
 
-	fsubp	%st(1), %st
+	fsubrp	%st, %st(1)
 	fldz
 	fcomi	%st(1), %st
 	fcmovb	%st(1), %st
diff --git a/sysdeps/libm-i387/i686/s_fdimf.S b/sysdeps/libm-i387/i686/s_fdimf.S
index 8b5cec6a3b..1bcaf0012e 100644
--- a/sysdeps/libm-i387/i686/s_fdimf.S
+++ b/sysdeps/libm-i387/i686/s_fdimf.S
@@ -28,7 +28,7 @@ ENTRY(__fdimf)
 	fucomi	%st(1), %st
 	jp	1f
 
-	fsubp	%st(1), %st
+	fsubrp	%st, %st(1)
 	fldz
 	fcomi	%st(1), %st
 	fcmovb	%st(1), %st
diff --git a/sysdeps/libm-i387/i686/s_fdiml.S b/sysdeps/libm-i387/i686/s_fdiml.S
index e9f0535a3a..9e909ba60e 100644
--- a/sysdeps/libm-i387/i686/s_fdiml.S
+++ b/sysdeps/libm-i387/i686/s_fdiml.S
@@ -28,7 +28,7 @@ ENTRY(__fdiml)
 	fucomi	%st(1), %st
 	jp	1f
 
-	fsubp	%st(1), %st
+	fsubrp	%st, %st(1)
 	fldz
 	fcomi	%st(1), %st
 	fcmovb	%st(1), %st
diff --git a/sysdeps/posix/cuserid.c b/sysdeps/posix/cuserid.c
index 3108a46c21..68de92ae64 100644
--- a/sysdeps/posix/cuserid.c
+++ b/sysdeps/posix/cuserid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -34,7 +34,7 @@ cuserid (s)
   struct passwd pwent;
   struct passwd *pwptr;
 
-  if (__getpwuid_r (geteuid (), &pwent, buf, sizeof (buf), &pwptr))
+  if (__getpwuid_r (__geteuid (), &pwent, buf, sizeof (buf), &pwptr))
     {
       if (s != NULL)
 	s[0] = '\0';
diff --git a/sysdeps/posix/euidaccess.c b/sysdeps/posix/euidaccess.c
index ed59582154..d38e7cc71b 100644
--- a/sysdeps/posix/euidaccess.c
+++ b/sysdeps/posix/euidaccess.c
@@ -1,5 +1,5 @@
 /* Check if effective user id can access file
-   Copyright (C) 1990, 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1990, 91, 95, 96, 97, 98 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -139,7 +139,7 @@ euidaccess (path, mode)
 #ifdef	_LIBC
   if (! __libc_enable_secure)
     /* If we are not set-uid or set-gid, access does the same.  */
-    return access (path, mode);
+    return __access (path, mode);
 #else
   if (have_ids == 0)
     {
@@ -171,8 +171,8 @@ euidaccess (path, mode)
   if (have_ids == 0)
     {
       have_ids = 1;
-      euid = geteuid ();
-      egid = getegid ();
+      euid = __geteuid ();
+      egid = __getegid ();
     }
 #endif
 
diff --git a/sysdeps/posix/mkstemp.c b/sysdeps/posix/mkstemp.c
index 2c9c96bdcc..d380935c42 100644
--- a/sysdeps/posix/mkstemp.c
+++ b/sysdeps/posix/mkstemp.c
@@ -53,7 +53,7 @@ mkstemp (template)
 
   /* Get some more or less random data.  */
   __gettimeofday (&tv, NULL);
-  value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
+  value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ __getpid ();
 
   for (count = 0; count < TMP_MAX; ++count)
     {
@@ -73,7 +73,7 @@ mkstemp (template)
       v /= 62;
       XXXXXX[5] = letters[v % 62];
 
-      fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600);
+      fd = __open (template, O_RDWR|O_CREAT|O_EXCL, 0600);
       if (fd >= 0)
 	/* The file does not exist.  */
 	return fd;
diff --git a/sysdeps/posix/mktemp.c b/sysdeps/posix/mktemp.c
index ad5cb1daf5..e9a576c16f 100644
--- a/sysdeps/posix/mktemp.c
+++ b/sysdeps/posix/mktemp.c
@@ -53,7 +53,7 @@ mktemp (template)
 
   /* Get some more or less random data.  */
   __gettimeofday (&tv, NULL);
-  value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
+  value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ __getpid ();
 
   for (count = 0; count < TMP_MAX; ++count)
     {
diff --git a/sysdeps/posix/pread.c b/sysdeps/posix/pread.c
index 22b8ca82bd..5ad5acbd2a 100644
--- a/sysdeps/posix/pread.c
+++ b/sysdeps/posix/pread.c
@@ -1,6 +1,6 @@
 /* Read block from given position in file without changing file pointer.
    POSIX version.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -29,22 +29,22 @@ __pread (int fd, void *buf, size_t nbyte, off_t offset)
      we can restore it later.  */
   int save_errno;
   ssize_t result;
-  off_t old_offset = lseek (fd, 0, SEEK_CUR);
+  off_t old_offset = __lseek (fd, 0, SEEK_CUR);
   if (old_offset == (off_t) -1)
     return -1;
 
   /* Set to wanted position.  */
-  if (lseek (fd, offset, SEEK_SET) == (off_t) -1)
+  if (__lseek (fd, offset, SEEK_SET) == (off_t) -1)
     return -1;
 
   /* Write out the data.  */
-  result = read (fd, buf, nbyte);
+  result = __read (fd, buf, nbyte);
 
   /* Now we have to restore the position.  If this fails we have to
      return this as an error.  But if the writing also failed we
      return this error.  */
   save_errno = errno;
-  if (lseek (fd, old_offset, SEEK_SET) == (off_t) -1)
+  if (__lseek (fd, old_offset, SEEK_SET) == (off_t) -1)
     {
       if (result == -1)
 	__set_errno (save_errno);
diff --git a/sysdeps/posix/pread64.c b/sysdeps/posix/pread64.c
index 00b1f33bf2..16fb3df142 100644
--- a/sysdeps/posix/pread64.c
+++ b/sysdeps/posix/pread64.c
@@ -1,6 +1,6 @@
 /* Read block from given position in file without changing file pointer.
    POSIX version.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -29,22 +29,22 @@ __pread64 (int fd, void *buf, size_t nbyte, off64_t offset)
      we can restore it later.  */
   int save_errno;
   ssize_t result;
-  off64_t old_offset = lseek64 (fd, 0, SEEK_CUR);
+  off64_t old_offset = __lseek64 (fd, 0, SEEK_CUR);
   if (old_offset == (off64_t) -1)
     return -1;
 
   /* Set to wanted position.  */
-  if (lseek64 (fd, offset, SEEK_SET) == (off64_t) -1)
+  if (__lseek64 (fd, offset, SEEK_SET) == (off64_t) -1)
     return -1;
 
   /* Write out the data.  */
-  result = read (fd, buf, nbyte);
+  result = __read (fd, buf, nbyte);
 
   /* Now we have to restore the position.  If this fails we have to
      return this as an error.  But if the writing also failed we
      return this error.  */
   save_errno = errno;
-  if (lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1)
+  if (__lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1)
     {
       if (result == -1)
 	__set_errno (save_errno);
diff --git a/sysdeps/posix/profil.c b/sysdeps/posix/profil.c
index 30481465fb..beb5ae47cd 100644
--- a/sysdeps/posix/profil.c
+++ b/sysdeps/posix/profil.c
@@ -74,7 +74,7 @@ __profil (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
 	/* Wasn't turned on.  */
 	return 0;
 
-      if (setitimer (ITIMER_PROF, &otimer, NULL) < 0)
+      if (__setitimer (ITIMER_PROF, &otimer, NULL) < 0)
 	return -1;
       samples = NULL;
       return sigaction (SIGPROF, &oact, NULL);
@@ -84,7 +84,7 @@ __profil (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
     {
       /* Was already turned on.  Restore old timer and signal handler
 	 first.  */
-      if (setitimer (ITIMER_PROF, &otimer, NULL) < 0
+      if (__setitimer (ITIMER_PROF, &otimer, NULL) < 0
 	  || sigaction (SIGPROF, &oact, NULL) < 0)
 	return -1;
     }
@@ -103,7 +103,7 @@ __profil (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
   timer.it_value.tv_sec = 0;
   timer.it_value.tv_usec = 1;
   timer.it_interval = timer.it_value;
-  return setitimer (ITIMER_PROF, &timer, &otimer);
+  return __setitimer (ITIMER_PROF, &timer, &otimer);
 }
 weak_alias (__profil, profil)
 
diff --git a/sysdeps/posix/pwrite.c b/sysdeps/posix/pwrite.c
index ef4a021881..6558eb5c9d 100644
--- a/sysdeps/posix/pwrite.c
+++ b/sysdeps/posix/pwrite.c
@@ -1,6 +1,6 @@
 /* Write block to given position in file without changing file pointer.
    POSIX version.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -29,22 +29,22 @@ __pwrite (int fd, const void *buf, size_t nbyte, off_t offset)
      we can restore it later.  */
   int save_errno;
   ssize_t result;
-  off_t old_offset = lseek (fd, 0, SEEK_CUR);
+  off_t old_offset = __lseek (fd, 0, SEEK_CUR);
   if (old_offset == (off_t) -1)
     return -1;
 
   /* Set to wanted position.  */
-  if (lseek (fd, offset, SEEK_SET) == (off_t) -1)
+  if (__lseek (fd, offset, SEEK_SET) == (off_t) -1)
     return -1;
 
   /* Write out the data.  */
-  result = write (fd, buf, nbyte);
+  result = __write (fd, buf, nbyte);
 
   /* Now we have to restore the position.  If this fails we have to
      return this as an error.  But if the writing also failed we
      return this error.  */
   save_errno = errno;
-  if (lseek (fd, old_offset, SEEK_SET) == (off_t) -1)
+  if (__lseek (fd, old_offset, SEEK_SET) == (off_t) -1)
     {
       if (result == -1)
 	__set_errno (save_errno);
diff --git a/sysdeps/posix/pwrite64.c b/sysdeps/posix/pwrite64.c
index 4045ed4344..89ec261b76 100644
--- a/sysdeps/posix/pwrite64.c
+++ b/sysdeps/posix/pwrite64.c
@@ -1,6 +1,6 @@
 /* Write block to given position in file without changing file pointer.
    POSIX version.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -29,22 +29,22 @@ __pwrite64 (int fd, const void *buf, size_t nbyte, off64_t offset)
      we can restore it later.  */
   int save_errno;
   ssize_t result;
-  off64_t old_offset = lseek64 (fd, 0, SEEK_CUR);
+  off64_t old_offset = __lseek64 (fd, 0, SEEK_CUR);
   if (old_offset == (off64_t) -1)
     return -1;
 
   /* Set to wanted position.  */
-  if (lseek64 (fd, offset, SEEK_SET) == (off64_t) -1)
+  if (__lseek64 (fd, offset, SEEK_SET) == (off64_t) -1)
     return -1;
 
   /* Write out the data.  */
-  result = write (fd, buf, nbyte);
+  result = __write (fd, buf, nbyte);
 
   /* Now we have to restore the position.  If this fails we have to
      return this as an error.  But if the writing also failed we
      return this error.  */
   save_errno = errno;
-  if (lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1)
+  if (__lseek64 (fd, old_offset, SEEK_SET) == (off64_t) -1)
     {
       if (result == -1)
 	__set_errno (save_errno);
diff --git a/sysdeps/posix/sigblock.c b/sysdeps/posix/sigblock.c
index efc559dcbc..b652cf7c31 100644
--- a/sysdeps/posix/sigblock.c
+++ b/sysdeps/posix/sigblock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -39,7 +39,7 @@ __sigblock (mask)
       if ((mask & sigmask (sig)) && __sigaddset (&set, sig) < 0)
 	return -1;
 
-  if (sigprocmask (SIG_BLOCK, &set, &oset) < 0)
+  if (__sigprocmask (SIG_BLOCK, &set, &oset) < 0)
     return -1;
 
   if (sizeof (mask) == sizeof (oset))
diff --git a/sysdeps/posix/sigpause.c b/sysdeps/posix/sigpause.c
index d954125ee4..eced47e42a 100644
--- a/sysdeps/posix/sigpause.c
+++ b/sysdeps/posix/sigpause.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -33,7 +33,7 @@ __sigpause (sig_or_mask, is_sig)
   if (is_sig != 0)
     {
       /* The modern X/Open implementation is requested.  */
-      if (sigprocmask (0, NULL, &set) < 0
+      if (__sigprocmask (0, NULL, &set) < 0
 	  /* Yes, we call `sigdelset' and not `__sigdelset'.  */
 	  || sigdelset (&set, sig_or_mask) < 0)
 	return -1;
@@ -53,7 +53,7 @@ __sigpause (sig_or_mask, is_sig)
 	    return -1;
     }
 
-  return sigsuspend (&set);
+  return __sigsuspend (&set);
 }
 
 
diff --git a/sysdeps/posix/ttyname.c b/sysdeps/posix/ttyname.c
index 5ad45ae2a6..a865ded9f5 100644
--- a/sysdeps/posix/ttyname.c
+++ b/sysdeps/posix/ttyname.c
@@ -47,14 +47,14 @@ getttyname (fd, mydev, myino, save, dostat)
   DIR *dirstream;
   struct dirent *d;
 
-  dirstream = opendir (dev);
+  dirstream = __opendir (dev);
   if (dirstream == NULL)
     {
       *dostat = -1;
       return NULL;
     }
 
-  while ((d = readdir (dirstream)) != NULL)
+  while ((d = __readdir (dirstream)) != NULL)
     if (((ino_t) d->d_fileno == myino || *dostat)
 	&& strcmp (d->d_name, "stdin")
 	&& strcmp (d->d_name, "stdout")
@@ -70,7 +70,7 @@ getttyname (fd, mydev, myino, save, dostat)
 	      {
 		*dostat = -1;
 		/* Perhaps it helps to free the directory stream buffer.  */
-		(void) closedir (dirstream);
+		(void) __closedir (dirstream);
 		return NULL;
 	      }
 	    *((char *) __mempcpy (name, dev, sizeof (dev) - 1)) = '/';
@@ -84,14 +84,14 @@ getttyname (fd, mydev, myino, save, dostat)
 #endif
 	   )
 	  {
-	    (void) closedir (dirstream);
+	    (void) __closedir (dirstream);
 	    __ttyname = name;
 	    __set_errno (save);
 	    return name;
 	  }
       }
 
-  (void) closedir (dirstream);
+  (void) __closedir (dirstream);
   __set_errno (save);
   return NULL;
 }
diff --git a/sysdeps/posix/ttyname_r.c b/sysdeps/posix/ttyname_r.c
index ae427f1aef..d4c6e0468a 100644
--- a/sysdeps/posix/ttyname_r.c
+++ b/sysdeps/posix/ttyname_r.c
@@ -51,14 +51,14 @@ getttyname_r (fd, buf, buflen, mydev, myino, save, dostat)
   DIR *dirstream;
   struct dirent *d;
 
-  dirstream = opendir (dev);
+  dirstream = __opendir (dev);
   if (dirstream == NULL)
     {
       *dostat = -1;
       return errno;
     }
 
-  while ((d = readdir (dirstream)) != NULL)
+  while ((d = __readdir (dirstream)) != NULL)
     if (((ino_t) d->d_fileno == myino || *dostat)
 	&& strcmp (d->d_name, "stdin")
 	&& strcmp (d->d_name, "stdout")
@@ -70,7 +70,7 @@ getttyname_r (fd, buf, buflen, mydev, myino, save, dostat)
 	if (needed > buflen)
 	  {
 	    *dostat = -1;
-	    (void) closedir (dirstream);
+	    (void) __closedir (dirstream);
 	    __set_errno (ERANGE);
 	    return ERANGE;
 	  }
@@ -86,13 +86,13 @@ getttyname_r (fd, buf, buflen, mydev, myino, save, dostat)
 #endif
 	   )
 	  {
-	    (void) closedir (dirstream);
+	    (void) __closedir (dirstream);
 	    __set_errno (save);
 	    return 0;
 	  }
       }
 
-  (void) closedir (dirstream);
+  (void) __closedir (dirstream);
   __set_errno (save);
   /* It is not clear what to return in this case.  `isatty' says FD
      refers to a TTY but no entry in /dev has this inode.  */
diff --git a/sysdeps/posix/waitid.c b/sysdeps/posix/waitid.c
index fa9021115f..7bb3bbeb47 100644
--- a/sysdeps/posix/waitid.c
+++ b/sysdeps/posix/waitid.c
@@ -69,7 +69,7 @@ waitid (idtype, id, infop, options)
       return -1;
     }
 
-  child = waitpid (pid, &status, options);
+  child = __waitpid (pid, &status, options);
 
   if (child == -1)
     /* `waitpid' set `errno' for us.  */
diff --git a/sysdeps/unix/getlogin_r.c b/sysdeps/unix/getlogin_r.c
index 8ec2fae754..cb0545e08a 100644
--- a/sysdeps/unix/getlogin_r.c
+++ b/sysdeps/unix/getlogin_r.c
@@ -1,5 +1,5 @@
 /* Reentrant function to return the current login name.  Unix version.
-   Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -45,8 +45,8 @@ getlogin_r (name, name_len)
     if (d < 0)
       return errno;
 
-    result = ttyname_r (d, real_tty_path, sizeof (tty_pathname));
-    (void) close (d);
+    result = __ttyname_r (d, real_tty_path, sizeof (tty_pathname));
+    (void) __close (d);
 
     if (result != 0)
       {
diff --git a/sysdeps/unix/grantpt.c b/sysdeps/unix/grantpt.c
index 24f0e17792..5d33a515f1 100644
--- a/sysdeps/unix/grantpt.c
+++ b/sysdeps/unix/grantpt.c
@@ -52,12 +52,12 @@ grantpt (fd)
   if (__xstat (_STAT_VER, namebuf, &st) != 0)
     return -1;
 
-  if (st.st_uid == getuid ())
+  if (st.st_uid == __getuid ())
     return 0;
 
   /* We have to do it in user space.  */
 
-  pid = fork ();
+  pid = __fork ();
   if (pid == -1)
     return -1;
   else if (pid == 0)
@@ -68,15 +68,15 @@ grantpt (fd)
 
       /* The helper does its thing on fd PTY_FD.  */
       if (fd != PTY_FD)
-	if (dup2 (fd, PTY_FD) == -1)
+	if (__dup2 (fd, PTY_FD) == -1)
 	  _exit (FAIL_EBADF);
 
-      execve (helper, (char *const *) argv, 0);
+      __execve (helper, (char *const *) argv, 0);
       _exit (FAIL_EXEC);
     }
   else
     {
-      if (waitpid (pid, &w, 0) == -1)
+      if (__waitpid (pid, &w, 0) == -1)
 	return -1;
       if (!WIFEXITED (w))
 	{
diff --git a/sysdeps/unix/rewinddir.c b/sysdeps/unix/rewinddir.c
index 07be1c6543..ded449410f 100644
--- a/sysdeps/unix/rewinddir.c
+++ b/sysdeps/unix/rewinddir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -29,7 +29,7 @@ rewinddir (dirp)
      DIR *dirp;
 {
   __libc_lock_lock (dirp->lock);
-  (void) lseek (dirp->fd, (off_t) 0, SEEK_SET);
+  (void) __lseek (dirp->fd, (off_t) 0, SEEK_SET);
   dirp->offset = 0;
   dirp->size = 0;
   __libc_lock_unlock (dirp->lock);
diff --git a/sysdeps/unix/sysv/linux/accept.S b/sysdeps/unix/sysv/linux/accept.S
index 196634d46a..431dec0324 100644
--- a/sysdeps/unix/sysv/linux/accept.S
+++ b/sysdeps/unix/sysv/linux/accept.S
@@ -2,4 +2,3 @@
 #define	__socket __libc_accept
 #define	NARGS	3
 #include <socket.S>
-weak_alias (__libc_accept, __accept)
diff --git a/sysdeps/unix/sysv/linux/bind.S b/sysdeps/unix/sysv/linux/bind.S
index 61fb5ebff8..25ff7ecbfd 100644
--- a/sysdeps/unix/sysv/linux/bind.S
+++ b/sysdeps/unix/sysv/linux/bind.S
@@ -1,3 +1,4 @@
 #define	socket	bind
 #define	NARGS	3
+#define NO_WEAK_ALIAS	1
 #include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c
index 67e64208b3..f8a3b80481 100644
--- a/sysdeps/unix/sysv/linux/gethostid.c
+++ b/sysdeps/unix/sysv/linux/gethostid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
@@ -81,7 +81,7 @@ gethostid ()
 
   /* Getting from the file was not successful.  An intelligent guess for
      a unique number of a host is its IP address.  Return this.  */
-  if (gethostname (hostname, MAXHOSTNAMELEN) < 0 || hostname[0] == '\0')
+  if (__gethostname (hostname, MAXHOSTNAMELEN) < 0 || hostname[0] == '\0')
     /* This also fails.  Return and arbitrary value.  */
     return 0;
 
diff --git a/sysdeps/unix/sysv/linux/getpt.c b/sysdeps/unix/sysv/linux/getpt.c
index 3c0b7a9399..0f5949d1bc 100644
--- a/sysdeps/unix/sysv/linux/getpt.c
+++ b/sysdeps/unix/sysv/linux/getpt.c
@@ -43,7 +43,7 @@ __getpt ()
   /* The new way:  */
   if (have_dev_ptmx)
     {
-      fd = open ("/dev/ptmx", O_RDWR);
+      fd = __open ("/dev/ptmx", O_RDWR);
       if (fd != -1)
 	return fd;
       else
@@ -64,7 +64,7 @@ __getpt ()
       for (j = __ptyname2; *j; ++j)
         {
 	  namebuf[9] = *j;
-	  fd = open (namebuf, O_RDWR);
+	  fd = __open (namebuf, O_RDWR);
 	  if (fd != -1)
 	    return fd;
 	  if (errno != EIO)
diff --git a/sysdeps/unix/sysv/linux/getsockname.S b/sysdeps/unix/sysv/linux/getsockname.S
index c138be9da5..31d37a4f0a 100644
--- a/sysdeps/unix/sysv/linux/getsockname.S
+++ b/sysdeps/unix/sysv/linux/getsockname.S
@@ -1,3 +1,4 @@
 #define	socket	getsockname
 #define	NARGS	3
+#define NO_WEAK_ALIAS	1
 #include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/i386/socket.S b/sysdeps/unix/sysv/linux/i386/socket.S
index 245d37a17f..c25b5b82cc 100644
--- a/sysdeps/unix/sysv/linux/i386/socket.S
+++ b/sysdeps/unix/sysv/linux/i386/socket.S
@@ -32,7 +32,11 @@
    The .S files for the other calls just #define socket and #include this.  */
 
 #ifndef __socket
+#ifndef NO_WEAK_ALIAS
 #define __socket P(__,socket)
+#else
+#define __socket socket
+#endif
 #endif
 
 .globl __socket
@@ -63,4 +67,6 @@ L(pseudo_end):
 
 PSEUDO_END (__socket)
 
+#ifndef NO_WEAK_ALIAS
 weak_alias (__socket, socket)
+#endif
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index de66b5cb21..aa89a38e69 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -40,7 +40,7 @@ opensock (void)
 
   if (sock_af != -1)
     {
-      fd = socket (sock_af, SOCK_DGRAM, 0);
+      fd = __socket (sock_af, SOCK_DGRAM, 0);
       if (fd != -1)
         return fd;
     }
@@ -48,19 +48,19 @@ opensock (void)
   __libc_lock_lock (lock);
 
   if (sock_af != -1)
-    fd = socket (sock_af, SOCK_DGRAM, 0);
+    fd = __socket (sock_af, SOCK_DGRAM, 0);
 
   if (fd == -1)
     {
-      fd = socket (sock_af = AF_INET6, SOCK_DGRAM, 0);
+      fd = __socket (sock_af = AF_INET6, SOCK_DGRAM, 0);
       if (fd < 0)
-	fd = socket (sock_af = AF_INET, SOCK_DGRAM, 0);
+	fd = __socket (sock_af = AF_INET, SOCK_DGRAM, 0);
       if (fd < 0)
-	fd = socket (sock_af = AF_IPX, SOCK_DGRAM, 0);
+	fd = __socket (sock_af = AF_IPX, SOCK_DGRAM, 0);
       if (fd < 0)
-	fd = socket (sock_af = AF_AX25, SOCK_DGRAM, 0);
+	fd = __socket (sock_af = AF_AX25, SOCK_DGRAM, 0);
       if (fd < 0)
-	fd = socket (sock_af = AF_APPLETALK, SOCK_DGRAM, 0);
+	fd = __socket (sock_af = AF_APPLETALK, SOCK_DGRAM, 0);
     }
 
   __libc_lock_unlock (lock);
@@ -82,15 +82,15 @@ if_nametoindex (const char *ifname)
     return 0;
 
   strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
-  if (ioctl (fd, SIOGIFINDEX, &ifr) < 0)
+  if (__ioctl (fd, SIOGIFINDEX, &ifr) < 0)
     {
       int saved_errno = errno;
-      close (fd);
+      __close (fd);
       if (saved_errno == EINVAL)
 	__set_errno (ENOSYS);
       return 0;
     }
-  close (fd);
+  __close (fd);
   return ifr.ifr_ifindex;
 #endif
 }
@@ -134,7 +134,7 @@ if_nameindex (void)
     {
       ifc.ifc_buf = NULL;
       ifc.ifc_len = 0;
-      if (ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0)
+      if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0)
 	{
 	  new_siocgifconf = 0;
 	  rq_len = RQ_IFS * sizeof (struct ifreq);
@@ -149,9 +149,9 @@ if_nameindex (void)
   do
     {
       ifc.ifc_buf = alloca (ifc.ifc_len = rq_len);
-      if ((ifc.ifc_buf == NULL) || (ioctl (fd, SIOCGIFCONF, &ifc) < 0))
+      if (ifc.ifc_buf == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0)
 	{
-	  close (fd);
+	  __close (fd);
 	  return NULL;
 	}
       rq_len *= 2;
@@ -163,7 +163,7 @@ if_nameindex (void)
   idx = malloc ((nifs + 1) * sizeof (struct if_nameindex));
   if (idx == NULL)
     {
-      close (fd);
+      __close (fd);
       return NULL;
     }
 
@@ -172,7 +172,7 @@ if_nameindex (void)
       struct ifreq *ifr = &ifc.ifc_req[i];
       idx[i].if_name = __strdup (ifr->ifr_name);
       if (idx[i].if_name == NULL
-	  || ioctl (fd, SIOGIFINDEX, ifr) < 0)
+	  || __ioctl (fd, SIOGIFINDEX, ifr) < 0)
 	{
 	  int saved_errno = errno;
 	  unsigned int j;
@@ -180,7 +180,7 @@ if_nameindex (void)
 	  for (j =  0; j < i; ++j)
 	    free (idx[j].if_name);
 	  free (idx);
-	  close (fd);
+	  __close (fd);
 	  if (saved_errno == EINVAL)
 	    __set_errno (ENOSYS);
 	  return NULL;
@@ -191,7 +191,7 @@ if_nameindex (void)
   idx[i].if_index = 0;
   idx[i].if_name = NULL;
 
-  close (fd);
+  __close (fd);
   return idx;
 #endif
 }
@@ -224,18 +224,18 @@ if_indextoname (unsigned int ifindex, char *ifname)
 	return NULL;
 
       ifr.ifr_ifindex = ifindex;
-      if (ioctl (fd, SIOGIFNAME, &ifr) < 0)
+      if (__ioctl (fd, SIOGIFNAME, &ifr) < 0)
 	{
 	  if (errno == EINVAL)
 	    siogifname_works = 0;   /* Don't make the same mistake twice. */
 	}
       else
 	{
-	  close (fd);
+	  __close (fd);
 	  return strncpy (ifname, ifr.ifr_name, IFNAMSIZ);
 	}
 
-      close (fd);
+      __close (fd);
 
       __set_errno (serrno);
     }
diff --git a/sysdeps/unix/sysv/linux/listen.S b/sysdeps/unix/sysv/linux/listen.S
index 4c7e435196..115bf2b2d0 100644
--- a/sysdeps/unix/sysv/linux/listen.S
+++ b/sysdeps/unix/sysv/linux/listen.S
@@ -1,3 +1,4 @@
 #define	socket	listen
 #define	NARGS	2
+#define NO_WEAK_ALIAS	1
 #include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/ptsname.c b/sysdeps/unix/sysv/linux/ptsname.c
index 2db8f8d08a..052516c7ac 100644
--- a/sysdeps/unix/sysv/linux/ptsname.c
+++ b/sysdeps/unix/sysv/linux/ptsname.c
@@ -75,7 +75,7 @@ __ptsname_r (fd, buf, buflen)
 #ifdef TIOCGPTN
   if (tiocgptn_works)
     {
-      if (ioctl (fd, TIOCGPTN, &ptyno) == 0)
+      if (__ioctl (fd, TIOCGPTN, &ptyno) == 0)
 	goto gotit;
       else
 	{
diff --git a/sysdeps/unix/sysv/linux/recvfrom.S b/sysdeps/unix/sysv/linux/recvfrom.S
index 93a3110d0a..7d0e2b0ea8 100644
--- a/sysdeps/unix/sysv/linux/recvfrom.S
+++ b/sysdeps/unix/sysv/linux/recvfrom.S
@@ -2,4 +2,3 @@
 #define	__socket __libc_recvfrom
 #define	NARGS	6
 #include <socket.S>
-weak_alias (__libc_recvfrom, __recvfrom)
diff --git a/sysdeps/unix/sysv/linux/sendmsg.c b/sysdeps/unix/sysv/linux/sendmsg.c
index 273add903e..16774c48b1 100644
--- a/sysdeps/unix/sysv/linux/sendmsg.c
+++ b/sysdeps/unix/sysv/linux/sendmsg.c
@@ -63,12 +63,12 @@ __libc_sendmsg (int fd, const struct msghdr *message, int flags)
 	     You can send real, effective, or set- uid and gid.
 	     If the user hasn't filled in the buffer, we default to
 	     real uid and gid. */
-	  pid = getpid ();
+	  pid = __getpid ();
 	  if (cc->cmcred_pid != pid)
 	  {
 	      u->pid = pid;
-	      u->uid = getuid ();
-	      u->gid = getgid ();
+	      u->uid = __getuid ();
+	      u->gid = __getgid ();
 	  }
 	  else
 	  {
diff --git a/sysdeps/unix/sysv/linux/sendto.S b/sysdeps/unix/sysv/linux/sendto.S
index 8717b2bac1..f0acb88465 100644
--- a/sysdeps/unix/sysv/linux/sendto.S
+++ b/sysdeps/unix/sysv/linux/sendto.S
@@ -2,4 +2,3 @@
 #define	__socket __libc_sendto
 #define	NARGS	6
 #include <socket.S>
-weak_alias (__libc_sendto, __sendto)
diff --git a/sysdeps/unix/sysv/linux/setsockopt.S b/sysdeps/unix/sysv/linux/setsockopt.S
index 01b2799ae8..09d9109be2 100644
--- a/sysdeps/unix/sysv/linux/setsockopt.S
+++ b/sysdeps/unix/sysv/linux/setsockopt.S
@@ -1,3 +1,4 @@
 #define	socket	setsockopt
 #define	NARGS	5
+#define NO_WEAK_ALIAS	1
 #include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/statvfs.c b/sysdeps/unix/sysv/linux/statvfs.c
index c3df2e6a49..74c4985fe1 100644
--- a/sysdeps/unix/sysv/linux/statvfs.c
+++ b/sysdeps/unix/sysv/linux/statvfs.c
@@ -30,7 +30,7 @@ statvfs (const char *file, struct statvfs *buf)
   int retval;
   int fd;
 
-  fd = open (file, O_RDONLY);
+  fd = __open (file, O_RDONLY);
   if (fd < 0)
     return -1;
 
@@ -39,7 +39,7 @@ statvfs (const char *file, struct statvfs *buf)
 
   /* Close the file while preserving the error number.  */
   save_errno = errno;
-  close (fd);
+  __close (fd);
   __set_errno (save_errno);
 
   return retval;
diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c
index 7f276b6130..91f0d7a40f 100644
--- a/sysdeps/unix/sysv/linux/ttyname.c
+++ b/sysdeps/unix/sysv/linux/ttyname.c
@@ -72,7 +72,7 @@ getttyname (dev, fd, mydev, myino, save, dostat)
 	      {
 		*dostat = -1;
 		/* Perhaps it helps to free the directory stream buffer.  */
-		(void) closedir (dirstream);
+		(void) __closedir (dirstream);
 		return NULL;
 	      }
 	    *((char *) __mempcpy (name, dev, devlen - 1)) = '/';
@@ -86,14 +86,14 @@ getttyname (dev, fd, mydev, myino, save, dostat)
 #endif
 	   )
 	  {
-	    (void) closedir (dirstream);
+	    (void) __closedir (dirstream);
 	    __ttyname = name;
 	    __set_errno (save);
 	    return name;
 	  }
       }
 
-  (void) closedir (dirstream);
+  (void) __closedir (dirstream);
   __set_errno (save);
   return NULL;
 }
diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c
index 9f22f71f31..9c859caa25 100644
--- a/sysdeps/unix/sysv/linux/ttyname_r.c
+++ b/sysdeps/unix/sysv/linux/ttyname_r.c
@@ -46,14 +46,14 @@ getttyname_r (fd, buf, buflen, mydev, myino, save, dostat)
   struct dirent *d;
   size_t devlen = strlen (buf);
 
-  dirstream = opendir (buf);
+  dirstream = __opendir (buf);
   if (dirstream == NULL)
     {
       *dostat = -1;
       return errno;
     }
 
-  while ((d = readdir (dirstream)) != NULL)
+  while ((d = __readdir (dirstream)) != NULL)
     if (((ino_t) d->d_fileno == myino || *dostat)
 	&& strcmp (d->d_name, "stdin")
 	&& strcmp (d->d_name, "stdout")
@@ -65,7 +65,7 @@ getttyname_r (fd, buf, buflen, mydev, myino, save, dostat)
 	if (needed > buflen)
 	  {
 	    *dostat = -1;
-	    (void) closedir (dirstream);
+	    (void) __closedir (dirstream);
 	    __set_errno (ERANGE);
 	    return ERANGE;
 	  }
@@ -81,13 +81,13 @@ getttyname_r (fd, buf, buflen, mydev, myino, save, dostat)
 #endif
 	   )
 	  {
-	    (void) closedir (dirstream);
+	    (void) __closedir (dirstream);
 	    __set_errno (save);
 	    return 0;
 	  }
       }
 
-  (void) closedir (dirstream);
+  (void) __closedir (dirstream);
   __set_errno (save);
   /* It is not clear what to return in this case.  `isatty' says FD
      refers to a TTY but no entry in /dev has this inode.  */
diff --git a/sysdeps/unix/sysv/linux/ulimit.c b/sysdeps/unix/sysv/linux/ulimit.c
index 2d9e86a63a..ec0337428d 100644
--- a/sysdeps/unix/sysv/linux/ulimit.c
+++ b/sysdeps/unix/sysv/linux/ulimit.c
@@ -45,7 +45,7 @@ __ulimit (int cmd, ...)
     {
     case UL_GETFSIZE:
       /* Get limit on file size.  */
-      if (getrlimit (RLIMIT_FSIZE, &limit) == 0)
+      if (__getrlimit (RLIMIT_FSIZE, &limit) == 0)
 	/* Convert from bytes to 512 byte units.  */
 	result =  limit.rlim_cur / 512;
       break;
@@ -63,7 +63,7 @@ __ulimit (int cmd, ...)
       break;
 
     case __UL_GETOPENMAX:
-      result = sysconf (_SC_OPEN_MAX);
+      result = __sysconf (_SC_OPEN_MAX);
       break;
 
     default:
diff --git a/sysdeps/unix/sysv/linux/unlockpt.c b/sysdeps/unix/sysv/linux/unlockpt.c
index a5f0b2a484..e20545fe80 100644
--- a/sysdeps/unix/sysv/linux/unlockpt.c
+++ b/sysdeps/unix/sysv/linux/unlockpt.c
@@ -33,7 +33,7 @@ unlockpt (fd)
   int serrno = errno;
   int unlock = 0;
 
-  if (ioctl (fd, TIOCSPTLCK, &unlock))
+  if (__ioctl (fd, TIOCSPTLCK, &unlock))
     {
       if (errno == EINVAL)
 	{
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h
index 1530ff64d5..a21672b115 100644
--- a/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h
+++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Brendan Kehoe (brendan@zen.org).
 
@@ -51,4 +51,6 @@
 #define	r1		%o1
 #define	MOVE(x,y)	mov x, y
 
+#define LOC(name)	.##L##name
+
 #endif	/* __ASSEMBLER__ */