linux 中的 strace init 进程 (PID 1)
strace init process (PID 1) in linux
strace manpage 说:
On Linux, exciting as it would be, tracing the init process is
forbidden.
我检查了一样,它不允许:
$ strace -p 1
attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted
为什么不可能?甚至 ptrace 联机帮助页也对跟踪 init 进程说了同样的话。这些工具不安全,或者只是 init 进程被认为太特殊以至于没有其他进程 (strace/ptrace) 可以向它发出信号。
strace manpage 说:
On Linux, exciting as it would be, tracing the init process is forbidden.
我检查了一样,它不允许:
$ strace -p 1
attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted
为什么不可能?甚至 ptrace 联机帮助页也对跟踪 init 进程说了同样的话。这些工具不安全,或者只是 init 进程被认为太特殊以至于没有其他进程 (strace/ptrace) 可以向它发出信号。