Re: [RFC] ps command race fix

From: Eric W. Biederman
Date: Thu Aug 17 2006 - 23:54:38 EST

Hmm... I forgot to hit send.

KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> writes:

> At first, Thanks.
> question:
> task = get_pid_task(find_next_pid(tgid), PIDTYPE_PID);
> Does this return only "task/process" ? and never return "thread" ?

Good point. I don't think I'm filter for thread group leaders here.
That should take a couple more lines of code.

> My another concern is that newly-created-process while ps running cannot be
> catched
> by this kind of "table walking" approach (as my previous work)
> But if people say O.K, I have no complaint.

Well it can but only if the newly created processes have a higher pid.

The guarantee that POSIX readdir makes is that you will see all directory
entries that are neither added nor deleted during the readdir.

> I(we)'ll post another list-based one in the next week, anyway.
> (I can't go-ahead this week...)

Where I see what I'm doing as being superior to that is that I'm
not writing to any global data structures. Which means what I'm doing
should scale to large machines without problem.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at