免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3273 | 回复: 1
打印 上一主题 下一主题

system执行别的程序,coredown返回值问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-11-10 09:37 |只看该作者 |倒序浏览
我的机器是HP的6600,操作系统是HP-UX B.11.23
我的测试程序如下:
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
using namespace std;
int main(int argc, char ** argv)
{
        int status = system(argv[1]);
        printf(\"status=0x%x\\n\", status);
        if (WIFEXITED(status))               
        printf(\"normal termination, exit status = %d\\n\",       
                WEXITSTATUS(status));       
        else if (WIFSIGNALED(status))               
        printf(\"abnormal termination, signal number = %d%s\\n\",       
                WTERMSIG(status),
#ifdef        WCOREDUMP                               
                WCOREDUMP(status) ? \" (core file generated)\" : \"\");
#else                               
        \"\");
#endif       
        else if (WIFSTOPPED(status))               
        printf(\"child stopped, signal number = %d\\n\",                               
                WSTOPSIG(status));
}
然后执行一些coredown的程序,测试结果如下:
1.浮点异常
***********> ./systest ./cored
sh: 6331 浮点异常(coredump)
status=0x8800
normal termination, exit status = 136      
2.内存错误
***********> ./systest ./cored1
sh: 9202 内存错误(coredump)
status=0x8b00
normal termination, exit status = 139
大家帮忙看看,按照HP-UX的(man system) 的结果,这两个结果都应该是 (core file generated)的。
为啥我的coredown程序却没有 (core file generated)呢?到底coredown返回值是个什么样的结果呢?

论坛徽章:
0
2 [报告]
发表于 2008-11-10 10:50 |只看该作者
刚又测试了一个,结果如下:
3.assert错误
***********> ./systest ./cored3
Assertion failed: 1 == 0, file cored3.c, line 6
sh: 16682 中止(coredump)
status=0x8600
normal termination, exit status = 134
现在看来应该是0x8000是coredown位,可是这和HP上man的描述不一致啊。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP