您的位置:首页 > Web前端

8_5 print exit status

2015-10-20 15:13 399 查看
WIFEXITED

WIFSIGNALED

WCOREDUMP

WIFSTOPPED

  1 #include "apue.h"

  2 #include <sys/wait.h>

  3

  4 void pr_exit(int status)

  5 {

  6         if( WIFEIXTED(status) )

  7                 printf("normal termination,exit status = %d\n",WEXITSTATUS(status));

  8         else if (WIFSIGNALED(status))

  9                 printf("abnormal termination, signal number = %d%s\n",WTERMSIG(status),

 10 #ifdef WCOREDUMP

 11         WCOREDUMP(status) ? " (core file generated)" : "");

 12 #else

 13         "");

 14 #endif

 15         else if (WIFSTOPPED(status))

 16                 printf("child stopped, signal number = %d\n", WSTOPSIG(status));

 17 }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息