]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update from 2.1.x branch.
authorUlrich Drepper <drepper@redhat.com>
Wed, 19 Mar 1997 03:10:36 +0000 (03:10 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 19 Mar 1997 03:10:36 +0000 (03:10 +0000)
17 files changed:
hurd/fchroot.c
hurd/getdport.c
hurd/hurd/threadvar.h
hurd/hurdfault.c
hurd/hurdinit.c
hurd/hurdsig.c
hurd/hurdstartup.c
hurd/report-wait.c
malloc/thread-m.h
sysdeps/mach/hurd/accept.c
sysdeps/mach/hurd/chroot.c
sysdeps/mach/hurd/defs.c
sysdeps/mach/hurd/dl-sysdep.c
sysdeps/mach/hurd/i386/init-first.c
sysdeps/mach/hurd/readlink.c
sysdeps/posix/defs.c
sysdeps/stub/defs.c

index 8c8a3b839b947c29440271cc3ff14da25ca1a989..143ea2380733a72693746dd8a9e5926498889d45 100644 (file)
@@ -1,22 +1,21 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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 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.
+   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., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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 <ansidecl.h>
 #include <unistd.h>
 #include <hurd.h>
 #include <hurd/fd.h>
@@ -24,7 +23,7 @@ Cambridge, MA 02139, USA.  */
 
 /* Change the current root directory to FD.  */
 int
-DEFUN(fchroot, (fd), int fd)
+fchroot (int fd)
 {
   error_t err;
   file_t dir;
@@ -36,7 +35,13 @@ DEFUN(fchroot, (fd), int fd)
                        }));
 
   if (! err)
-    _hurd_port_set (&_hurd_ports[INIT_PORT_CRDIR], dir);
+    {
+      file_t root;
+      err = __file_reparent (dir, MACH_PORT_NULL, &root);
+      __mach_port_deallocate (__mach_task_self (), dir);
+      if (! err)
+       _hurd_port_set (&_hurd_ports[INIT_PORT_CRDIR], root);
+    }
 
   return err ? __hurd_fail (err) : 0;
 }
index 2204db2ce3fad69bf29c77ce4eae142dc0310a36..b58832dbe4b5ed27973137dea66318ae258c5294 100644 (file)
@@ -1,26 +1,27 @@
-/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1992, 1994, 1995, 1997 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 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.
+   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., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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 <hurd.h>
 
 /* This is initialized in dtable.c when that gets linked in.
    If dtable.c is not linked in, it will be zero.  */
-file_t (*_hurd_getdport_fn) (int fd);
+static file_t (*_default_hurd_getdport_fn) (int fd) = 0;
+weak_alias (_default_hurd_getdport_fn, _hurd_getdport_fn)
 
 file_t
 __getdport (int fd)
@@ -43,7 +44,7 @@ __getdport (int fd)
       errno = EBADF;
       return MACH_PORT_NULL;
     }
-  else      
+  else
     {
       __mach_port_mod_refs (__mach_task_self (), _hurd_init_dtable[fd],
                            MACH_PORT_RIGHT_SEND, 1);
index 3d5feaba9308687aa9fdaa78d0f4a3541412cf5c..b10efe9ada65296b8c256fe67769a7989e8b40aa 100644 (file)
@@ -1,21 +1,21 @@
 /* Internal per-thread variables for the Hurd.
-Copyright (C) 1994, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1994, 1995, 1997 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 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.
+   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., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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.  */
 
 #ifndef _HURD_THREADVAR_H
 #define        _HURD_THREADVAR_H
@@ -33,7 +33,7 @@ Cambridge, MA 02139, USA.  */
    stack pointer is ignored; and __hurd_threadvar_stack_offset gives the
    address of a small allocated region which contains the variables for the
    single thread.  */
-   
+
 extern unsigned long int __hurd_threadvar_stack_mask;
 extern unsigned long int __hurd_threadvar_stack_offset;
 
@@ -60,6 +60,7 @@ enum __hurd_threadvar_index
     _HURD_THREADVAR_ERRNO,     /* `errno' value for this thread.  */
     _HURD_THREADVAR_SIGSTATE,  /* This thread's `struct hurd_sigstate'.  */
     _HURD_THREADVAR_DYNAMIC_USER, /* Dynamically-assigned user variables. */
+    _HURD_THREADVAR_MALLOC,    /* For use of malloc. */
     _HURD_THREADVAR_MAX                /* Default value for __hurd_threadvar_max.  */
   };
 
index 2865ff7d3415c306a0d82e847c550db701ffb88d..671f8cb21a557b4d2a268996aedf61752f0bbc5e 100644 (file)
@@ -1,5 +1,5 @@
 /* Handle faults in the signal thread.
-   Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997 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,9 @@
 jmp_buf _hurdsig_fault_env;
 struct hurd_signal_preemptor _hurdsig_fault_preemptor;
 
+/* XXX temporary to deal with spelling fix */
+weak_alias (_hurdsig_fault_preemptor, _hurdsig_fault_preempter)
+
 static mach_port_t forward_sigexc;
 
 kern_return_t
index 1704fa8879d4edd8fb05fd759b6aed7ec8ee64ae..0d0f4b4ea9b19a4edb80e502506e321672e18d71 100644 (file)
@@ -1,20 +1,20 @@
-/* Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1992, 93, 94, 95, 96, 97 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 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.
+   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., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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 <sys/stat.h>
 #include <stdlib.h>
@@ -31,7 +31,9 @@ struct hurd_port *_hurd_ports;
 unsigned int _hurd_nports;
 mode_t _hurd_umask;
 sigset_t _hurdsig_traced;
+
 char **__libc_argv;
+int __libc_argc;
 
 
 error_t
index b30134ca5bf3166c31bae1ec7ef1a34ab929319b..6ebd7bed14a548699063c3323ea23a3b5e2e5989 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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,6 +39,11 @@ thread_t _hurd_msgport_thread;
 /* Thread which receives task-global signals.  */
 thread_t _hurd_sigthread;
 
+/* These are set up by _hurdsig_init.  */
+unsigned long int __hurd_sigthread_stack_base;
+unsigned long int __hurd_sigthread_stack_end;
+unsigned long int *__hurd_sigthread_variables;
+
 /* Linked-list of per-thread signal state.  */
 struct hurd_sigstate *_hurd_sigstates;
 
@@ -424,6 +429,9 @@ abort_all_rpcs (int signo, struct machine_thread_all_state *state, int live)
 struct hurd_signal_preemptor *_hurdsig_preemptors;
 sigset_t _hurdsig_preempted_set;
 
+/* XXX temporary to deal with spelling fix */
+weak_alias (_hurdsig_preemptors, _hurdsig_preempters)
+
 /* Mask of stop signals.  */
 #define STOPSIGS (sigmask (SIGTTIN) | sigmask (SIGTTOU) | \
                  sigmask (SIGSTOP) | sigmask (SIGTSTP))
index cd6922fd2aa7ceae0d657252d05a5346354888cc..543d135120fdd6c48e484a13e93e1dcae54b4e64 100644 (file)
@@ -1,21 +1,21 @@
 /* Initial program startup for running under the GNU Hurd.
-Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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 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.
+   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., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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 <errno.h>
 #include <stdlib.h>
@@ -35,15 +35,6 @@ Cambridge, MA 02139, USA.  */
 mach_port_t *_hurd_init_dtable;
 mach_msg_type_number_t _hurd_init_dtablesize;
 
-unsigned int __hurd_threadvar_max;
-unsigned long int __hurd_threadvar_stack_mask;
-unsigned long int __hurd_threadvar_stack_offset;
-
-/* These are set up by _hurdsig_init.  */
-unsigned long int __hurd_sigthread_stack_base;
-unsigned long int __hurd_sigthread_stack_end;
-unsigned long int *__hurd_sigthread_variables;
-
 extern void __mach_init (void);
 
 /* Entry point.  This is the first thing in the text segment.
index 491b566d04a04bee70be8306c73d8d3070781ae6..e8f4f1af4a01b1d0205eb2854a36bbf907825384 100644 (file)
@@ -1,21 +1,21 @@
 /* Report on what a thread in our task is waiting for.
-Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1996, 1997 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 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.
+   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., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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 <hurd.h>
 #include <hurd/signal.h>
@@ -93,8 +93,15 @@ describe_port (string_t description, mach_port_t port)
 }
 
 
-/* Common defn so we don't link in the itimer code unnecessarily.  */
-thread_t _hurd_itimer_thread; /* XXX */
+/* We want _HURD_ITIMER_THREAD, but don't want to link in the itimer code
+   unnecessarily.  */
+#if 0 /* libc.so.0.0 needs this defined, so make it a weak alias for now.  */
+extern thread_t _hurd_itimer_thread; /* XXX */
+weak_extern (_hurd_itimer_thread)
+#else
+static thread_t default_hurd_itimer_thread;
+weak_alias (default_hurd_itimer_thread, _hurd_itimer_thread)
+#endif
 
 kern_return_t
 _S_msg_report_wait (mach_port_t msgport, thread_t thread,
@@ -105,7 +112,7 @@ _S_msg_report_wait (mach_port_t msgport, thread_t thread,
   if (thread == _hurd_msgport_thread)
     /* Cute.  */
     strcpy (description, "msgport");
-  else if (thread == _hurd_itimer_thread)
+  else if (&_hurd_msgport_thread && thread == _hurd_itimer_thread)
     strcpy (description, "itimer");
   else
     {
index 10da26ba32cca7e0ce8f39fcb926bdb1d2b65ba0..8307f256ff907799b3dfc1b1f67c6d2532b0a8af 100644 (file)
@@ -1,6 +1,6 @@
 /* Basic platform-independent macro definitions for mutexes and
    thread-specific data.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>, 1996.
 
@@ -66,19 +66,37 @@ static Void_t *malloc_key_data;
    (__pthread_mutex_unlock != NULL ? __pthread_mutex_unlock (m) : 0)
 
 #elif defined(MUTEX_INITIALIZER)
+/* Assume hurd, with cthreads */
 
-typedef thread_t thread_id;
+/* Cthreads `mutex_t' is a pointer to a mutex, and malloc wants just the
+   mutex itself.  */
+#undef mutex_t
+#define mutex_t struct mutex
 
-/* mutex */
-typedef mutex_t        mutex_t;
+#undef mutex_lock
+#define mutex_lock(m) (__mutex_lock(m), 0)
+
+#undef mutex_unlock
+#define mutex_unlock(m) (__mutex_unlock(m), 0)
+
+#define mutex_trylock(m) (!__mutex_trylock(m))
+
+#include <hurd/threadvar.h>
 
 /* thread specific data */
-typedef pthread_key_t tsd_key_t;
+typedef int tsd_key_t;
+
+static int tsd_keys_alloced = 0;
+
+#define tsd_key_create(key, destr) \
+  (assert (tsd_keys_alloced == 0), tsd_keys_alloced++)
+#define tsd_setspecific(key, data) \
+  (*__hurd_threadvar_location (_HURD_THREADVAR_MALLOC) = (unsigned long)(data))
+#define tsd_getspecific(key, vptr) \
+  ((vptr) = (void *)*__hurd_threadvar_location (_HURD_THREADVAR_MALLOC))
 
-#define mutex_init(m)          __mutex_init (m)
-#define mutex_lock(m)          __mutex_lock (m)
-#define mutex_trylock(m)       __mutex_trylock (m)
-#define mutex_unlock(m)                __mutex_unlock (m)
+/* No we're *not* using pthreads.  */
+#define __pthread_initialize ((void (*)(void))0)
 
 #else
 
index 528d4252fd8b08b99f4d0a3d14bd8127aafdee48..18c5f75199f88c4247199d2fbcd10bb197621b6b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1993, 1994, 1997 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
@@ -38,7 +38,7 @@ DEFUN(accept, (fd, addr, addr_len),
   socket_t new;
   addr_port_t aport;
   char *buf = (char *) addr;
-  mach_msg_type_number_t buflen = *addr_len;
+  mach_msg_type_number_t buflen;
   int type;
 
   if (err = HURD_DPORT_USE (fd, __socket_accept (port, &new, &aport)))
@@ -46,6 +46,7 @@ DEFUN(accept, (fd, addr, addr_len),
 
   if (addr != NULL)
     {
+      buflen = *addr_len;
       err = __socket_whatis_address (aport, &type, &buf, &buflen);
       if (err == EOPNOTSUPP)
        /* If the protocol server can't tell us the address, just return a
index f010c368edbdfdda6b5102c148ed0a347d455ca2..c39493e272da0df55d00943dc8dba479c4bd94c6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1997 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
@@ -28,7 +28,8 @@ Cambridge, MA 02139, USA.  */
 int
 DEFUN(chroot, (file_name), CONST char *file_name)
 {
-  file_t file, dir;
+  error_t err;
+  file_t file, dir, root;
 
   file = __file_name_lookup (file_name, O_EXEC, 0);
   if (file == MACH_PORT_NULL)
@@ -38,6 +39,12 @@ DEFUN(chroot, (file_name), CONST char *file_name)
   if (dir == MACH_PORT_NULL)
     return -1;
 
-  _hurd_port_set (&_hurd_ports[INIT_PORT_CRDIR], dir);
+  /* Prevent going through DIR's .. */
+  err = __file_reparent (dir, MACH_PORT_NULL, &root);
+  __mach_port_deallocate (__mach_task_self (), dir);
+  if (err)
+    return __hurd_fail (err);
+
+  _hurd_port_set (&_hurd_ports[INIT_PORT_CRDIR], root);
   return 0;
 }
index b2cfe7c4ff79244863848ce465bddab2cf57abca..b3b66f629660b28d838694a213cd74b2a01b270d 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions of global stdio data structures.
 
-Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+Copyright (C) 1991, 1992, 1993, 1994, 1995, 1997 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
@@ -80,6 +80,6 @@ text_set_element (_hurd_fd_subinit, init_stdio);
 void
 DEFUN_VOID(_cleanup)
 {
-  (void) fclose ((FILE *) NULL);
+  __fcloseall ();
 }
 text_set_element (__libc_atexit, _cleanup);
index bf1462a8990b3bfcc6a22ae44c288970b489c531..e8388c419146aceab42d0ff5492f070f91e8edf8 100644 (file)
@@ -52,12 +52,8 @@ unsigned int __hurd_threadvar_max = _HURD_THREADVAR_MAX;
 static unsigned long int threadvars[_HURD_THREADVAR_MAX];
 unsigned long int __hurd_threadvar_stack_offset
   = (unsigned long int) &threadvars;
-unsigned long int __hurd_sigthread_stack_base;
-unsigned long int __hurd_sigthread_stack_end;
-unsigned long int *__hurd_sigthread_variables;
 unsigned long int __hurd_threadvar_stack_mask;
 
-
 /* XXX loser kludge for vm_map kernel bug */
 static vm_address_t fmha;
 static vm_size_t fmhs;
index c9249bba4ee496b53f1f63d9e80fc5d29eebbd22..4c4f6ff6654804fb20fefc738f73227bf5dc1291 100644 (file)
@@ -30,10 +30,14 @@ extern void __libc_init (int, char **, char **);
 extern void __getopt_clean_environment (void);
 extern void __libc_global_ctors (void);
 
+unsigned int __hurd_threadvar_max;
+unsigned long int __hurd_threadvar_stack_offset;
+unsigned long int __hurd_threadvar_stack_mask;
+
 int __libc_multiple_libcs = 1;
 
-int __libc_argc;
-char **__libc_argv;
+extern int __libc_argc;
+extern char **__libc_argv;
 
 /* We often need the PID.  Cache this value.  */
 pid_t __libc_pid;
index 2f51e200b5a6df866b45aed6b7b7f15268b9ffe6..d04ae1e07aa642d3ed43f540110a826b24b4c101 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1997 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
@@ -32,45 +32,33 @@ DEFUN(__readlink, (file_name, buf, len),
 {
   error_t err;
   file_t file;
-  char mybuf[2048], *transp = mybuf;
-  mach_msg_type_number_t translen = sizeof (mybuf);
+  struct stat st;
 
-  file = __file_name_lookup (file_name, O_NOTRANS, 0);
+  file = __file_name_lookup (file_name, O_READ | O_NOLINK, 0);
   if (file == MACH_PORT_NULL)
     return -1;
 
-  err = __file_get_translator (file, &transp, &translen);
+  err = __io_stat (file, &st);
+  if (! err)
+    if (S_ISLNK (st.st_mode))
+      {
+       char *rbuf = buf;
+
+       err = __io_read (file, &rbuf, &len, 0, len);
+       if (!err && rbuf != buf)
+         {
+           memcpy (buf, rbuf, len);
+           __vm_deallocate (__mach_task_self (), (vm_address_t)rbuf, len);
+         }
+      }
+    else
+      err = EINVAL;
+
   __mach_port_deallocate (__mach_task_self (), file);
 
   if (err)
     return __hurd_fail (err);
-
-  if (translen < sizeof (_HURD_SYMLINK) ||
-      memcmp (transp, _HURD_SYMLINK, sizeof (_HURD_SYMLINK)))
-    /* The file is not actually a symlink.  */
-    err = EINVAL;
   else
-    {
-      /* This is a symlink; its translator is "/hurd/symlink\0target\0".  */
-      if (len >= translen - sizeof (_HURD_SYMLINK))
-       {
-         len = translen - sizeof (_HURD_SYMLINK);
-         if (transp[translen - 1] == '\0')
-           /* Remove the null terminator.  */
-           --len;
-       }
-      if (buf == NULL)
-       /* This call is just to find out how large a buffer is required.  */
-       len = translen - sizeof (_HURD_SYMLINK) - 1;
-      else
-       /* Copy into the user's buffer.  */
-       memcpy (buf, transp + sizeof (_HURD_SYMLINK), len);
-    }
-
-  if (transp != mybuf)
-    __vm_deallocate (__mach_task_self (), (vm_address_t) transp, translen);
-
-  return err ? __hurd_fail (err) : len;
+    return len;
 }
-
 weak_alias (__readlink, readlink)
index fcbaf16f69e60ac5c088bd1f44dc4416286c9fdc..e3e46377f0bd50c7bf2fab06fbb77a213ef41ea7 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions of global stdio data structures.
 
-Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+Copyright (C) 1991, 1993, 1997 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
@@ -67,7 +67,7 @@ FILE *__stdio_head = &stdstreams[0];
 void
 DEFUN_VOID(_cleanup)
 {
-  (void) fclose((FILE *) NULL);
+  __fcloseall ();
 }
 
 
index 66f4c4dd24b4122e716bd6fda5dce65d1b848e3d..4fd7ab3615547891a8292d068a486076a7be0b56 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions of global stdio data structures.
 
-Copyright (C) 1991, 1995 Free Software Foundation, Inc.
+Copyright (C) 1991, 1995, 1997 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
@@ -40,7 +40,7 @@ FILE *__stdio_head;
 void
 DEFUN_VOID(_cleanup)
 {
-  (void) fclose((FILE *) NULL);
+  __fcloseall ();
 }