summaryrefslogtreecommitdiff
path: root/glibc/process.mdwn
blob: c8a1ce7982e4230aafc9e4a1c6b1d45fa27d03e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
[[!meta copyright="Copyright © 2009, 2010, 2013 Free Software Foundation,
Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]

The GNU Hurd uses a similar concept to [[UNIX processes|unix/process]].

As a [[Mach task|microkernel/mach/task]] only implements a part of a UNIX
process, there is additional work to be done, for example for [[signal]]s,
[[environment_variable]]s, [[file_descriptor]]s, [[hurd/authentication]].


# Startup

[[!taglink 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 [[open_issues/glibc]] for commit 288f7d79fe2dcc8e62c539f57b25d7662a2cd5ff.


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

  * Initialize `hurd_startup_data` based on
    [[hurd/interface/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.