poll of filesystem
timr at probo.com
Sun Jul 3 00:37:55 CEST 2011
Belisko Marek <marek.belisko at gmail.com> wrote:
>just want to use poll method to get data from /proc file system. Use
>simple code for it. Problem is it seems poll return POLLIN flag but
>when I try to read data it's always empty. Could be a problem changes
>are so fast that print can't print it?
Poll doesn't make sense here. The data in /proc/loadavg data is not text
data that gets updated periodically. There is no file on disk somewhere
called /proc/loadavg. Instead, reading /proc/loadavg causes a call into a
kernel driver, and reads data directly from variables stored in the kernel.
The data is ALWAYS available.
If you want the data once a second, just do it the easy way:
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list