本文介绍了Linux:获取已经运行的进程的umask?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查当前正在运行的程序的umask?

How can I check the umask of a program which is currently running?

[更新:另一个进程,而不是当前进程.]

[update: another process, not the current process.]

推荐答案

您可以将gdb附加到正在运行的进程,然后在调试器中调用umask:

You can attach gdb to a running process and then call umask in the debugger:

(gdb) call umask(0)
[Switching to Thread -1217489200 (LWP 11037)]
$1 = 18
(gdb) call umask(18)
$2 = 0
(gdb) 

(注:18 = O22)

(note: 18 = O22)

这表明使用ptrace获取umask可能是一种非常丑陋的方法.

This suggests that there may be a really ugly way to get the umask using ptrace.

这篇关于Linux:获取已经运行的进程的umask?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 14:40