Wednesday, December 10, 2008

What is the SigQ field of /proc/PID/status in Linux?

I had to read kernel source to figure this out, and when I did I learned the value isn't at all what I thought, so I thought I'd let everyone else know.

From fs/proc/array.c:


qsize = atomic_read(&p->user->sigpending);
...
buffer += sprintf(buffer, "SigQ:\t%lu/%lu\n", qsize, qlim);


where p is a struct task_struct p. From include/linux/sched.h:


struct task_struct {
...
/* process credentials */
...
struct user_struct *user;


and


/*
* Some day this will be a full-fledged user tracking system..
*/
struct user_struct {
...
atomic_t sigpending; /* How many pending signals does this user have? */


So the SigQ value in each process's status file is the total number of signals pending delivery across all processes owned by the UID of the process (or maybe the UID which started the process, I don't know how the user field of task_structs interacts with setuid).

Pretty far from what I've been assuming it meant, the number of signals pending delivery for each individual process. :/

No comments:

Post a Comment