Chinaunix首页 | 论坛 | 博客
  • 博客访问: 124877
  • 博文数量: 31
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 85
  • 用 户 组: 普通用户
  • 注册时间: 2014-12-18 15:18
文章分类
文章存档

2017年(1)

2016年(1)

2015年(26)

2014年(3)

我的朋友

分类: C/C++

2014-12-24 17:50:02

原文地址:prctl用法 作者:jiuniu110

给线程命名
http://www.cppblog.com/beautykingdom/archive/2009/11/08/100419.aspx

设置coredump标记。


  1. #if HAVE_PRCTL && defined(PR_SET_DUMPABLE)
  2.     /* Set Linux DUMPABLE flag */
  3.     if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) != 0)
  4.         debug(50, 2) ("prctl: %s\n", xstrerror());
  5. #endif

man中对PR_SET_DUMPABLE的解释,注意橙色部分,会导致core出不来,所以要显示的设置下。

  1. PR_SET_DUMPABLE (since Linux 2.3.20)
  2. Set the state of the flag determining whether core dumps are produced for this process upon delivery of a signal whose default behavior is to produce a core
  3. dump. (Normally this flag is set for a process by default, but it is cleared when a set-user-ID or set-group-ID program is executed and also by various sys-
  4. tem calls that manipulate process UIDs and GIDs). In kernels up to and including 2.6.12, arg2 must be either 0 (process is not dumpable) or 1 (process is
  5. dumpable). Between kernels 2.6.13 and 2.6.17, the value 2 was also permitted, which caused any binary which normally would not be dumped to be dumped read-
  6. able by root only; for security reasons, this feature has been removed. (See also the description of /proc/sys/fs/suid_dumpable in proc(5).)

阅读(1551) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~