linux: getting umask of an already running process?

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

(gdb) attach <your pid>
...
(gdb) call umask(0)
[Switching to Thread -1217489200 (LWP 11037)]
$1 = 18 # this is the umask
(gdb) call umask(18) # reset umask
$2 = 0
(gdb) 

(note: 18 corresponds to a umask of O22 in this example)

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

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)