fork()返回现有进程的pid

时间:2013-03-11 10:25:46

标签: android c linux-kernel fork init

我正在尝试修补Android的init以允许卸载Android并在已经初始化的硬件上加载Ubuntu。 here是我正在尝试的补丁。

但在杀死-USR1 1内核出现恐慌后重启后我在RAM控制台中看到了下一个内容:

[   96.671325] init: Got SIGUSR1, trying to execve /system/xbin/ubuntu.sh
[   96.680786] init: fork done, pid=1
[   96.685089] [K] Kernel panic - not syncing: Attempted to kill init!
[   96.685150] [<c010ac50>] (unwind_backtrace+0x0/0xe0) from [<c0596408>] (panic+0x6c/0x198)
[   96.685150] [<c0596408>] (panic+0x6c/0x198) from [<c017e1d0>] (do_exit+0x98/0x650)
[   96.685180] [<c017e1d0>] (do_exit+0x98/0x650) from [<c017ea34>] (do_group_exit+0x84/0xc0)
[   96.685211] [<c017ea34>] (do_group_exit+0x84/0xc0) from [<c017ea80>] (__wake_up_parent+0x0/0x18)
[   96.685241] CPU1: stopping
[   96.685333] [<c010ac50>] (unwind_backtrace+0x0/0xe0) from [<c0109e2c>] (handle_IPI+0xd4/0x140)
[   96.685424] [<c0109e2c>] (handle_IPI+0xd4/0x140) from [<c01053cc>] (__irq_svc+0x4c/0xe4)
[   96.685516] [<c01053cc>] (__irq_svc+0x4c/0xe4) from [<c01058c0>] (ret_fast_syscall+0x0/0x30)
[   96.785858] subsystem-fatal-8x60: Q6 NMI was sent.
[   96.790924] [K] Rebooting in 5 seconds..
[  101.798248] [K] Going down for restart now

fork()如何将pid == 1(子进程)返回到父进程init,它已经有pid == 1?

谢谢!

1 个答案:

答案 0 :(得分:0)

strerror在信号处理程序中不安全,所以从那里开始吧! : - )