hurd: Make _exit work during early boot-up
commit41aac872341fbf70f3b7006ef266eb02a354a993
authorSergey Bugaev <bugaevc@gmail.com>
Sat, 29 Apr 2023 13:13:51 +0000 (29 16:13 +0300)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 29 Apr 2023 14:53:47 +0000 (29 16:53 +0200)
tree295d9bd4b7ca177d0e4a4022a6f076b5b63fdfbd
parenta9fb57105e9abd7919478226ee802270d1b3b9df
hurd: Make _exit work during early boot-up

If any of the early boot-up tasks calls exit () or returns from main (),
terminate it properly instead of crashing on trying to dereference
_hurd_ports and getting forcibly terminated by the kernel.

We sadly cannot make the __USEPORT macro do the check for _hurd_ports
being unset, because it evaluates to the value of the expression
provided as the second argument, and that can be of any type; so there
is no single suitable fallback value for the macro to evaluate to in
case _hurd_ports is unset. Instead, each use site that wants to care for
this case will have to do its own checking.

Checked on x86_64-gnu.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230429131354.2507443-4-bugaevc@gmail.com>
sysdeps/mach/hurd/_exit.c