]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/mach/hurd/dl-sysdep.c
Fix typos.
[thirdparty/glibc.git] / sysdeps / mach / hurd / dl-sysdep.c
index 5e2a6f1c4f6724cb82685d992aeaf0921abb2b2f..1788ede94e262bf3ac36bd1ccef27f182058e189 100644 (file)
@@ -1,6 +1,5 @@
 /* Operating system support for run-time dynamic linker.  Hurd version.
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
-       Free Software Foundation, Inc.
+   Copyright (C) 1995-2013 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
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* In the static library, this is all handled by dl-support.c
+   or by the vanilla definitions in the rest of the C library.  */
+#ifdef SHARED
 
 #include <hurd.h>
 #include <link.h>
@@ -52,7 +54,7 @@ int __libc_enable_secure = 0;
 INTVARDEF(__libc_enable_secure)
 int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion
                                   of init-first.  */
-/* This variable containts the lowest stack address ever used.  */
+/* This variable contains the lowest stack address ever used.  */
 void *__libc_stack_end;
 
 #if HP_TIMING_AVAIL
@@ -116,11 +118,11 @@ static void fmh(void) {
 ElfW(Addr)
 _dl_sysdep_start (void **start_argptr,
                  void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phent,
-                                  ElfW(Addr) *user_entry))
+                                  ElfW(Addr) *user_entry,
+                                  ElfW(auxv_t) *auxv))
 {
   void go (intptr_t *argdata)
     {
-      extern unsigned int _dl_skip_args; /* rtld.c */
       char **p;
 
       /* Cache the information in various global variables.  */
@@ -197,7 +199,7 @@ unfmh();                    /* XXX */
         up and leave us to transfer control to USER_ENTRY.  */
       (*dl_main) ((const ElfW(Phdr) *) _dl_hurd_data->phdr,
                  _dl_hurd_data->phdrsz / sizeof (ElfW(Phdr)),
-                 &_dl_hurd_data->user_entry);
+                 &_dl_hurd_data->user_entry, NULL);
 
       /* The call above might screw a few things up.
 
@@ -252,7 +254,7 @@ unfmh();                    /* XXX */
   __mach_init ();
 
   /* Initialize frequently used global variable.  */
-  GL(dl_pagesize) = __getpagesize ();
+  GLRO(dl_pagesize) = __getpagesize ();
 
 #if HP_TIMING_AVAIL
   HP_TIMING_NOW (_dl_cpuclock_offset);
@@ -315,7 +317,7 @@ open_file (const char *file_name, int flags,
       return MACH_PORT_NULL;
     }
 
-  assert (!(flags & ~O_READ));
+  assert (!(flags & ~(O_READ | O_CLOEXEC)));
 
   startdir = _dl_hurd_data->portarray[file_name[0] == '/' ?
                                      INIT_PORT_CRDIR : INIT_PORT_CWDIR];
@@ -367,6 +369,7 @@ __libc_read (int fd, void *buf, size_t nbytes)
   mach_msg_type_number_t nread;
 
   data = buf;
+  nread = nbytes;
   err = __io_read ((mach_port_t) fd, &data, &nread, -1, nbytes);
   if (err)
     return __hurd_fail (err);
@@ -401,13 +404,17 @@ libc_hidden_weak (__libc_write)
 __ssize_t weak_function
 __writev (int fd, const struct iovec *iov, int niov)
 {
+  if (fd >= _hurd_init_dtablesize)
+    {
+      errno = EBADF;
+      return -1;
+    }
+
   int i;
   size_t total = 0;
   for (i = 0; i < niov; ++i)
     total += iov[i].iov_len;
 
-  assert (fd < _hurd_init_dtablesize);
-
   if (total != 0)
     {
       char buf[total], *bufp = buf;
@@ -546,7 +553,7 @@ __access (const char *file, int type)
 }
 
 pid_t weak_function
-__getpid ()
+__getpid (void)
 {
   pid_t pid, ppid;
   int orphaned;
@@ -638,29 +645,10 @@ _dl_show_auxv (void)
 }
 
 
-/* Return an array of useful/necessary hardware capability names.  */
-const struct r_strlenpair *
-internal_function
-_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
-                     size_t *max_capstrlen)
-{
-  struct r_strlenpair *result;
-
-  /* Return an empty array.  Hurd has no hardware capabilities.  */
-  result = (struct r_strlenpair *) malloc (sizeof (*result));
-  if (result == NULL)
-    INTUSE (_dl_signal_error) (ENOMEM, NULL, NULL,
-                              "cannot create capability list");
-
-  result[0].str = (char *) result;     /* Does not really matter.  */
-  result[0].len = 0;
-
-  *sz = 1;
-  return result;
-}
-
 void weak_function
 _dl_init_first (int argc, ...)
 {
   /* This no-op definition only gets used if libc is not linked in.  */
 }
+
+#endif /* SHARED */