"cat /proc/20502/wchan" vs strace vs man page

From: Johan Walles
Date: Mon Sep 24 2007 - 03:54:47 EST


Try this:
1. At one prompt, do "cat".
Now, switch to another prompt and...
2. Do "pstree -p|grep cat" to find out the PID of your cat command. I
get 20502.
3. Do "cat /proc/20502/wchan". I get "0" here.
4. Do "strace -p 20502". I get "read(0, <unfinished ...>" here.

So wchan says cat is waiting for "0". Strace says cat is waiting for
read (which sounds much more probable to me).

Is "0" the correct contents of /proc/20502/wchan? I expected it to
say something about "read".

According to "man proc", wchan "is the "channel" in which the process
is waiting. It is the address of a system call". "0" doesn't seem to
fit that description. Is "0" or the man page wrong?

I'm on Ubuntu 7.04 Feisty, i686, have manpages "2.39-1", kernel "Linux
version 2.6.20-16-generic (root@terranova) (gcc version 4.1.2 (Ubuntu
4.1.2-0ubuntu4)) #2 SMP Fri Aug 31 00:55:27 UTC 2007".

I'm not subscribed to the list, please CC me on replies.

Cheers //Johan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/