栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Linux:kernel:神秘返回值139

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Linux:kernel:神秘返回值139

[root@10 test]# ./a.out
abc=abc, temp=abc, remain=def
Segmentation fault (core dumped)
[root@10 test]# echo $?
139
这里的139 是sig 11 处理产生coredump之后,在11这个基础上或了一个0x80,为什么要或这个值呢;
static void coredump_finish(struct mm_struct *mm, bool core_dumped)
{
struct core_thread *curr, *next;
struct task_struct *task;
spin_lock_irq(¤t->sighand->siglock);
if (core_dumped && !__fatal_signal_pending(current))
current->signal->group_exit_code |= 0x80; 这里如果原有signal是11,返回的是139

commit b9daa0066d792983da59154af3ae486eff9b9aa1
Author: Ingo Molnar mingo@elte.hu
Date: Sat Dec 14 19:44:20 2002 -0800

[PATCH] threaded coredumps, tcore-fixes-2.5.51-A0

This fixes one more threaded-coredumps detail reported by the glibc
people: all threads taken down by the coredump code should report the
proper exit code.  We can do this rather easily via the group_exit
mechanism.  'Other' threads used to report SIGKILL, which was highly
confusing as the shell often displayed the 'Killed' message instead of a
'Segmentation fault' message.

Another missing bit was the 0x80 bit set in the exit status for all
threads, if the coredump was successful.  (it's safe to set this bit in
->sig->group_exit_code in an unlocked way because all threads are
artificially descheduled by the coredump code.)

还没找到0x80这个bit是什么含义;
这也就是为什么静态检查工具为什么不让用magic number的原因。

		infop->cause = (status & 0x80) ? CLD_DUMPED : CLD_KILLED;

通过这个推测,可能是已经产生core文件。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/885076.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号