From: Tanaka Akira <akr@m17n.org>
To: linux-kernel@vger.kernel.org
Subject: 2.6 select doesn't notify readablity of /proc/loadavg.
Date: Fri, 05 Aug 2005 14:47:59 +0900 [thread overview]
Message-ID: <87ll3hszmi.fsf@m17n.org> (raw)
Hi. select in Linux 2.6.12.3 doesn't notify readability of
/proc/loadavg and several other files under /proc.
It is reproducible as follows. The sample program follow blocks
because select doesn't notify readability.
% uname -a
Linux debiansarge 2.6.12.3 #1 Thu Aug 4 20:23:16 JST 2005 i686 GNU/Linux
% cat /proc/version
Linux version 2.6.12.3 (akr@debiansarge) (gcc version 3.3.5 (Debian 1:3.3.5-13)) #1 Thu Aug 4 20:23:16 JST 2005
% cat t.c
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/select.h>
int main(int argc, char **argv)
{
int fd, ret;
fd_set readfds;
fd = open(argv[1], O_RDONLY);
if (fd == -1) { perror("open"); exit(1); }
FD_ZERO(&readfds);
FD_SET(fd, &readfds);
ret = select(fd+1, &readfds, NULL, NULL, NULL);
printf("select returns %d\n", ret);
return 0;
}
% gcc t.c
% ./a.out /proc/loadavg
This program blocks here.
/proc/loadavg can be read by cat.
% ./a.out /proc/loadavg
^C
% cat /proc/loadavg
0.00 0.00 0.00 2/36 2597
Also, /proc/cmdline, /proc/devices, /proc/execdomains, /proc/fb,
/proc/filesystems, /proc/locks, /proc/meminfo, /proc/uptime and
/proc/version are blocks too.
Is this behaviour intentional?
The output of ver_linux is follows.
% sh scripts/ver_linux
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.
Linux debiansarge 2.6.12.3 #1 Thu Aug 4 20:23:16 JST 2005 i686 GNU/Linux
Gnu C 3.3.5
Gnu make 3.80
binutils 2.15
util-linux 2.12p
mount 2.12p
module-init-tools 3.2-pre1
e2fsprogs 1.37
reiserfsprogs line
reiser4progs line
nfs-utils 1.0.6
Linux C Library 2.3.2
Dynamic linker (ldd) 2.3.2
Procps 3.2.1
Net-tools 1.60
Console-tools 0.2.3
Sh-utils 5.2.1
Modules Loaded md5 ipv6 evdev ehci_hcd usbcore shpchp pci_hotplug intel_agp piix pcnet32 mii crc32 agpgart ide_disk ide_cd cdrom ide_core rtc unix
Note that select notify readability of /proc/loadavg on Linux 2.4.20.
% uname -a
Linux serein 2.4.20-686 #1 Mon Jan 13 22:22:30 EST 2003 i686 GNU/Linux
% ./a.out /proc/loadavg
select returns 1
--
Tanaka Akira
next reply other threads:[~2005-08-05 5:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-05 5:47 Tanaka Akira [this message]
2005-08-08 14:42 ` 2.6 select doesn't notify readablity of /proc/loadavg Alan Cox
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=87ll3hszmi.fsf@m17n.org \
--to=akr@m17n.org \
--cc=linux-kernel@vger.kernel.org \
/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.