Skip to content
Advertisement

SigCgt value is not getting updated in /proc//status file?

I have read about the signal handling in linux processes. I am using centOS 7.1 (kernel 3.10+). I am registering handler only for SIGTERM in my c++ program. As per my knowledge(not sure if my assumptions are correct). We can check all the signals a process is listening to in /proc/$pid/status file by using SigCgt field mask. My process’s /proc/$pid/status shows SigCgt field as below :-

SigCgt: 0000000184000200 ==> BitMask for this  ‭‭0001 1000 0000 0000 0000 0100 0010 0000 0000

As per my knowledge each bit corresponds to a signal. since 15th bit which corresponds to SIGTERM is 1 in above mask. It indicates that signal handler for SIGTERM is registered.

My question is, SigCgt field value remains same even if I am not registering any signal handlers. Then how come few bits are set including 15th bit(which is for SIGTERM) in SigCgt bitmask?

Any help is very much appreciated. I have already done enough googling but could not find any appropriate explanation. Moreover It would be a great help If anyone can point me at right documentation or links.

Thanks in advance.

Advertisement

Answer

You are mistaken about the SIGTERM bit. The first 16 bits of 0000000184000200 are given by 0200 which is 0000 0010 0000 0000. The 15th bit (with lsb being bit #1) is 0. The only bit on is #10 aka SIGUSR1.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement