summary refs log tree commit diff
path: root/hurd/hurdstartup.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-05-20 00:13:43 +0000
committerRoland McGrath <roland@gnu.org>1995-05-20 00:13:43 +0000
commita2fe9c76a9d7645c63288eda807e01a6b1901d29 (patch)
tree68882cda9fe373eda0ecaa70503d34812186138d /hurd/hurdstartup.c
parent2b83a2a4d978012cdf78b648337c31091e20526d (diff)
downloadglibc-a2fe9c76a9d7645c63288eda807e01a6b1901d29.tar.gz
glibc-a2fe9c76a9d7645c63288eda807e01a6b1901d29.tar.xz
glibc-a2fe9c76a9d7645c63288eda807e01a6b1901d29.zip
Fri May 19 17:16:46 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
	* sysdeps/mach/hurd/i386/init-first.c: In cthreads case, handle
 	args on stack from kernel.

	* posix/Makefile, sysdeps/alpha/Makefile,
	* sysdeps/mach/hurd/Makefile, sysdeps/sparc/Makefile, Makefile,
	* Makerules, Make-dist: Fix "cvs commit" cmds in rules to not fail
	in the absence of CVS dirs.

	* hurd/hurdstartup.c: Don't call __mach_init.  Grok args from the
 	kernel on the stack properly.

	* set-init.c: Never call _init/_fini; just run __libc_subinit.

	* Makerules (LDFLAGS-c.so): Add -nostartfiles.
	* mach/Machrules (LDFLAGS-$(interface.so)): Likewise.

	* configure.in: Move defaulting of --with-elf and --with-gnu-*
 	based on host os outside the AC_CACHE_VAL for the sysdirs
 	calculation.

	* Makeconfig (localedir, nlsdir): New variables.

	* values.h: New file.
	* Makefile (headers): Add values.h.

	* locale/Makefile (distribute): Add error.h.
	* locale/localedef.c: Include "error.h".
	(main): Use error_message_count instead of warning_cntr.
Diffstat (limited to 'hurd/hurdstartup.c')
-rw-r--r--hurd/hurdstartup.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/hurd/hurdstartup.c b/hurd/hurdstartup.c
index 0347234397..416cddb62b 100644
--- a/hurd/hurdstartup.c
+++ b/hurd/hurdstartup.c
@@ -78,9 +78,6 @@ _hurd_startup (void **argptr, void (*main) (int *data))
   int argc, envc;
   int *argcptr;
 
-  /* Basic Mach initialization, must be done before RPCs can be done.  */
-  __mach_init ();
-
   if (err = __task_get_special_port (__mach_task_self (), TASK_BOOTSTRAP_PORT,
 				     &in_bootstrap))
     LOSE;
@@ -104,21 +101,19 @@ _hurd_startup (void **argptr, void (*main) (int *data))
 
   if (err || in_bootstrap == MACH_PORT_NULL)
     {
-#if 0
       /* Either we have no bootstrap port, or the RPC to the exec server
 	 failed.  Try to snarf the args in the canonical Mach way.
 	 Hopefully either they will be on the stack as expected, or the
 	 stack will be zeros so we don't crash.  Set all our other
 	 variables to have empty information.  */
 
-      ENTRY_SP (argptr);
-      /* SNARF_ARGS (ARGPTR, ARGC, ARGV, ENVP) snarfs the arguments and
-	 environment from the stack, assuming they were put there by the
-	 microkernel.  */
-XXX XXX XXX
-      
-      SNARF_ARGS (argptr, argc, argv, envp);
-#endif
+      argcptr = (int *) argptr;
+      argc = argcptr[0];
+      argv = (char **) &argcptr[1];
+      envp = &argv[argc + 1];
+      envc = 0;
+      while (envp[envc])
+	++envc;
 
       data.flags = 0;
       args = env = NULL;
@@ -137,8 +132,6 @@ XXX XXX XXX
   /* Turn the block of null-separated strings we were passed for the
      arguments and environment into vectors of pointers to strings.  */
 
-
-  
   if (! argv)
     {
       /* Count up the arguments so we can allocate ARGV.  */
@@ -184,12 +177,15 @@ extern void _start();
     vm_address_t user_entry = 0;
 #endif
 
-    *d = data;
-    _hurd_init_dtable = d->dtable;
-    _hurd_init_dtablesize = d->dtablesize;
-    d->phdr = phdr;
-    d->phdrsz = phdrsz;
-    d->user_entry = user_entry;
+    if ((void *) d != argv[0])
+      {
+	*d = data;
+	_hurd_init_dtable = d->dtable;
+	_hurd_init_dtablesize = d->dtablesize;
+	d->phdr = phdr;
+	d->phdrsz = phdrsz;
+	d->user_entry = user_entry;
+      }
 
     (*main) (argcptr);
   }