+#ifndef VARIANT_PRE1050
+static void
+move_to_root_bootstrap(void)
+{
+ mach_port_t parent_port = 0;
+ mach_port_t previous_port = 0;
+
+ do {
+ if (previous_port) {
+ mach_port_deallocate(mach_task_self(), previous_port);
+ previous_port = parent_port;
+ } else {
+ previous_port = bootstrap_port;
+ }
+
+ if (bootstrap_parent(previous_port, &parent_port) != 0) {
+ return;
+ }
+ } while (parent_port != previous_port);
+
+ task_set_bootstrap_port(mach_task_self(), parent_port);
+ bootstrap_port = parent_port;
+}
+#endif /* !VARIANT_PRE1050 */
+
+int daemon(int, int) __DARWIN_1050(daemon);
+