fork 进程?sprintf函数?WIFEXITED/WEXITSTATUS/WIFSIGNALED

电脑杂谈  发布时间:2016-07-21 01:01:17  来源:网络整理

你是否正在寻找关于wifexited的内容?让我把最趣味的东西奉献给你:

wifexited_fork 进程_sprintf函数

wifexited/WEXITSTATUS/WIFSIGNALED 2009-07-25 10:12:17

分类: LINUX

If the exit status value (*note Program Termination::) of the child
process is zero, then the status value reported by `waitpid' or `wait'
is also zero. You can test for other kinds of information encoded in
the returned status value using the following macros. These macros are
defined in the header file `sys/wait.h'.

-- Macro: int wifexited (int STATUS)
This macro returns a nonzero value if the child process terminated
normally with `exit' or `_exit'.

-- Macro: int WEXITSTATUS (int STATUS)
If `wifexited' is true of STATUS, this macro returns the low-order
8 bits of the exit status value from the child process. *Note
Exit Status::.

-- Macro: int WIFSIGNALED (int STATUS)
This macro returns a nonzero value if the child process terminated
because it received a signal that was not handled. *Note Signal
Handling::.

子进程的结束状态返回后存于status,底下有几个宏可判别结束情况
wifexited(status)如进程正常结束则为非0值。
WEXITSTATUS(status)取得子进程exit()返回的结束代码,一般会先用wifexited 来判断是否正常结束才能使用此宏。
WIFSIGNALED(status)如进程是因为信号而结束则此宏值为真
WTERMSIG(status)取得子进程因信号而中止的信号代码,一般会先用WIFSIGNALED 来判断后才使用此宏。
WIFSTOPPED(status)如进程处于暂停执行情况则此宏值为真,。一般只有使用WUNTRACED 时才会有此情况。
WSTOPSIG(status)取得引发子进程暂停的信号代码,

阅读(4075) | 评论(0) | 转发(3) |

1

上一篇:exit() 和 _exit() 的区别

下一篇:系统调用wait、waitpid和exec函数

相关热门文章

以上就是关于wifexited的全部内容,相信你一定会非常满意。


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-13003-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      • 臧佳佳
        臧佳佳

        易烊千玺真是好看极了

      • 袁发松
        袁发松

        请不起灯光师

      • 田悼子
        田悼子

        但是网站不停改收益的条件也是显而易见的

      热点图片
      拼命载入中...