Skip to main content
Home
badllama.com
  • Search
  • Log In

Umask of Running Process

bchavet's picture

Wed, 01/09/2013 - 09:06 by bchavet

Use gdb to find the umask of a running process.

gdb program-name pid

For example:

~ # gdb nginx 21155
[...]
(gdb) call umask(0)
$1 = 18
(gdb) call umask(18)
$2 = 0
(gdb) quit

The first call sets the umask to 0000, and outputs the previous umask value in decimal. The second call restores the original umask.

Convert the decimal 18 to octal 0022, and there you have it.

Powered by Backdrop CMS