[DRBD-cvs] drbd by phil; [by LGE] * reparent_to_init() is exporte...
drbd-user@lists.linbit.com
drbd-user@lists.linbit.com
Tue, 9 Mar 2004 17:28:47 +0100 (CET)
DRBD CVS committal
Author : phil
Module : drbd
Dir : drbd/drbd
Modified Files:
Tag: rel-0_7-branch
drbd_main.c
Log Message:
[by LGE]
* reparent_to_init() is exported by Linux-2.4.x
* reparent_to_init() is not exported by Linux-2.6.x but is done by
2.6's daemonize function.
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_main.c,v
retrieving revision 1.73.2.143
retrieving revision 1.73.2.144
diff -u -3 -r1.73.2.143 -r1.73.2.144
--- drbd_main.c 8 Mar 2004 07:38:01 -0000 1.73.2.143
+++ drbd_main.c 9 Mar 2004 16:28:42 -0000 1.73.2.144
@@ -351,6 +351,7 @@
daemonize("drbd_thread");
#else
daemonize();
+ reparent_to_init();
#endif
}
@@ -374,36 +375,11 @@
}
}
-/* If reparent_to_init() would be exported, we could use the kernel's
- version .... so we have to maintain our own copy of it.
- */
-STATIC void drbd_reparent_to_init(void)
-{
- struct task_struct *child_reaper;
-
- child_reaper = find_task_by_pid(1);
-
- write_lock_irq(&tasklist_lock);
-
- REMOVE_LINKS(current);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
- current->parent = child_reaper;
- current->real_parent = child_reaper;
-#else
- current->p_pptr = child_reaper;
- current->p_opptr = child_reaper;
-#endif
- SET_LINKS(current);
- current->exit_signal = SIGCHLD;
- write_unlock_irq(&tasklist_lock);
-}
-
STATIC int drbd_thread_setup(void* arg)
{
struct Drbd_thread *thi = (struct Drbd_thread *) arg;
int retval;
- drbd_reparent_to_init();
drbd_daemonize();
down(&thi->mutex); //ensures that thi->task is set.