wc -l" in both systems, I use it only for test.

问题描述 投票:0回答:1

truss script.sh
.....

fork()                                          = 382
      6 
    Received signal #18, SIGCLD, in waitsys() [default]
      siginfo: SIGCLD CLD_EXITED pid=382 uid=0 status=0x0000

.....

On old SystemV Unix using the "truss" program(is similar to strace) truss script.sh ..... fork() = 382 6 Received signal #18, SIGCLD, in waitsys() ...

Current versions of Linux provide a system call named

strace -e fork sh script.sh

(see

strace -f sh script.sh

https:

strace -f -e fork sh script.sh

在旧的SystemV Unix上使用 "truss "程序(类似于strace)
strace truss
1个回答
1
投票

clone(2)但我看不到fork().Linux和Old SystemV当然是不同的操作系统,可能Unix使用fork()的方式和Linux不同,但问题是:如何使用strace看到fork()的输出?当然script.sh包含相同的命令 "ls/linux.die.netman2clone 并向下滚动到描述 sys_clone),这是一个用于创建新任务的通用系统调用。 有一些选项可以确定新的任务到底应该与它的父任务共享什么资源(内存、文件描述符等),因此系统调用可以用来创建新的进程或新的线程或任何介于两者之间的东西。 尽管内核仍然提供了一个 fork 系统调用的向后兼容性,当前版本的glibc实现了 fork() 就...而言 clone(2) 而不是。

因此,尽管你可能会看到一个电话,以 fork() 的源码中 sh的输出。strace 会显示 clone 系统调用。 所以你应该找这个而不是 fork.

© www.soinside.com 2019 - 2024. All rights reserved.