From: Nikanth Karthikesan <knikanth@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Alexey Dobriyan <adobriyan@gmail.com>, Al Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH] Document /proc/TGID /proc/TID readdir weirdness
Date: Tue, 14 Jul 2009 14:18:12 +0530 [thread overview]
Message-ID: <200907141418.12484.knikanth@suse.de> (raw)
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:
reply other threads:[~2009-07-14 8:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200907141418.12484.knikanth@suse.de \
--to=knikanth@suse.de \
--cc=adobriyan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.