about summary refs log tree commit diff
path: root/sysdeps/generic
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic')
-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
14 files changed, 122 insertions, 91 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);