wugj03 发表于 2015-01-17 11:00

每个进程的终止都会调用exit系统调用吗?

从<<Linux内核源代码情景分析>>中看到,进程终止的最后一步都会调用系统调用sys_exit,但是我编写一个劫持系统调用exit的模块,就看不到有什么进程结束了,只能看到唯一的一个:/usr/sbin/automount周期性的调用sys_exit。
这是为什么?

gaojl0728 发表于 2015-01-19 16:30

进程退出调用的是sys_exit_group, not sys_exit

Tinnal 发表于 2015-01-19 20:11

exit_group(2) - Linux man page

Name

exit_group - exit all threads in a process
Synopsis

#include <linux/unistd.h>
void exit_group(int status);
Description

This system call is equivalent to exit(2) except that it terminates not only the calling thread, but all threads in the calling process's thread group.
Return Value

This system call does not return.
Versions

This call is present since Linux 2.5.35.
Conforming to

This call is Linux-specific.
Notes

Since glibc 2.3, this is the system call invoked when the exit(2) wrapper function is called.
See Also

exit(2)
Referenced By

ptrace(2)

wugj03 发表于 2015-01-26 18:53

回复 2# gaojl0728


    Got it, THX

wugj03 发表于 2015-01-26 18:53

回复 3# Tinnal


    后来也发现了,学习了,哈哈
页: [1]
查看完整版本: 每个进程的终止都会调用exit系统调用吗?