* [PATCH] Document /proc/TGID /proc/TID readdir weirdness
@ 2009-07-14 8:48 Nikanth Karthikesan
0 siblings, 0 replies; only message in thread
From: Nikanth Karthikesan @ 2009-07-14 8:48 UTC (permalink / raw)
To: linux-kernel; +Cc: Alexey Dobriyan, Al Viro
readdir() on /proc returns only one directory per TGID, i.e., /proc/<TGID>
But if you, try to read a directory /proc/<TID>/ where there is no TGID == TID,
it would succeed.
For example,
$ ls /proc
There is no directory by name /proc/6375
$ ls /proc/6373/task
6373 6375
$ ls /proc/6375/
attr cmdline environ io maps ...
/proc/6375/ exists!
I tried changing this behaviour to disallow reads using /proc/<TID>/, but it
breaks, a lot of user-space applications and scripts that depend on this
behaviour. So let us make this a documented behaviour.
Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
---
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index fad18f9..ae79898 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -137,8 +137,14 @@ Table 1-1: Process specific entries in /proc
stack Report full stack trace, enable via CONFIG_STACKTRACE
smaps a extension based on maps, showing the memory consumption of
each mapping
+ task Contains directories for each thread in this thread group. Each
+ of those directory contain similar information specific for
+ those threads. /proc/<TGID>/task/<TID>
..............................................................................
+NOTE: Even though readdir() on /proc returns only one directory per TGID it is
+possible to open and read /proc/<TID>/ directly, using any TID as well.
+
For example, to get the status information of a process, all you have to do is
read the file /proc/PID/status:
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-07-14 8:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-14 8:48 [PATCH] Document /proc/TGID /proc/TID readdir weirdness Nikanth Karthikesan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.