1 --- daemon.c.orig 2007-09-29 23:58:54.000000000 -0700
2 +++ daemon.c 2007-09-30 00:46:19.000000000 -0700
5 __FBSDID("$FreeBSD: src/lib/libc/gen/daemon.c,v 1.6 2003/11/10 22:01:42 ghelmer Exp $");
7 +#ifndef VARIANT_PRE1050
8 +#include <mach/mach.h>
9 +#include <servers/bootstrap.h>
10 +#endif /* !VARIANT_PRE1050 */
11 #include "namespace.h"
16 #include "un-namespace.h"
18 +#ifndef VARIANT_PRE1050
20 +move_to_root_bootstrap(void)
22 + mach_port_t parent_port = 0;
23 + mach_port_t previous_port = 0;
26 + if (previous_port) {
27 + mach_port_deallocate(mach_task_self(), previous_port);
28 + previous_port = parent_port;
30 + previous_port = bootstrap_port;
33 + if (bootstrap_parent(previous_port, &parent_port) != 0) {
36 + } while (parent_port != previous_port);
38 + task_set_bootstrap_port(mach_task_self(), parent_port);
39 + bootstrap_port = parent_port;
41 +#endif /* !VARIANT_PRE1050 */
43 +int daemon(int, int) __DARWIN_1050(daemon);
46 daemon(nochdir, noclose)
49 sa.sa_handler = SIG_IGN;
51 osa_ok = _sigaction(SIGHUP, &sa, &osa);
53 +#ifndef VARIANT_PRE1050
54 + move_to_root_bootstrap();
55 +#endif /* !VARIANT_PRE1050 */