The GNU Hurd uses a similar concept to UNIX processes.

As a Mach task only implements a part of a UNIX process, there is additional work to be done, for example for signals, environment variables, file descriptors, authentication.

Startup

open issue glibc, open issue hurd: Enumerate all the different cases. Add tests to glibc to make sure all these work.

hurd/hurdstartup.h:hurd_startup_data

Lives on the stack after arguments and environment.

The phdr and phdrsz members are only used in sysdeps/mach/hurd/dl-sysdep.c:_dl_sysdep_start (for [SHARED]) and sysdeps/mach/hurd/i386/init-first.c:init1 (for [!SHARED]). See comments in glibc for commit 288f7d79fe2dcc8e62c539f57b25d7662a2cd5ff.

hurd/hurdstartup.c:`hurdstartup (void *argptr, void (main) (intptr_t

*data))`

  • Initialize hurd_startup_data based on exec startup get info if we have a bootstrap port, or else manually.

  • Call main, which is either sysdeps/mach/hurd/dl-sysdep.c:_dl_sysdep_start:go if called from sysdeps/mach/hurd/dl-sysdep.c:_dl_sysdep_start (for [SHARED] only), or sysdeps/mach/hurd/i386/init-first.c:_hurd_stack_setup:doinit if called from sysdeps/mach/hurd/i386/init-first.c:_hurd_stack_setup (for [!SHARED] only).

Controlling TTY

Hurd controlling tty behavior is generally consistent with BSD's, including TIOCSCTTY. Linux also has TIOCSCTTY and it is harmless to use it there. But BSD and Hurd never do an implicit TIOCSCTTY (hence our O_NOCTTY is zero).

C.f. http://lists.gnu.org/archive/html/bug-hurd/2009-10/msg00030.html and the following messages.