linux: getting umask of an already running process?

后端 未结 5 851
广开言路
广开言路 2021-02-01 17:04

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

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

5条回答
  •  悲&欢浪女
    2021-02-01 17:34

    A colleague just showed me a command line pattern for this. I always have emacs running, so that's in the example below. The perl is my contribution:

    sudo gdb --pid=$(pgrep emacs) --batch -ex 'call/o umask(0)' -ex 'call umask($1)' 2> /dev/null | perl -ne 'print("$1\n")if(/^\$1 = (\d+)$/)'
    

提交回复
热议问题