guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile hangs on /sys file read.


From: Neil Jerram
Subject: Re: Guile hangs on /sys file read.
Date: Sun, 26 Nov 2006 13:33:42 +0000
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Rob Browning <address@hidden> writes:

> Given:
>
>   $ ls -l /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
>   -r--r--r-- 1 root root 4096 Nov 24 10:07
>     /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
>
>   $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
>   1862000
>
> This hangs:
>
>   $ guile -c '(call-with-input-file 
> "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq" read)'
>
> Strace shows that the process is hanging in a select.  The same thing
> works fine for /proc/loadavg.
>
> I haven't investigated further yet.

It looks like this is a characteristic of the sysfs filesystem.  See
from line 355 onwards here:
http://www.gelato.unsw.edu.au/lxr/source/fs/sysfs/file.c.

Perhaps we could optimize Guile to skip the select when we know we're
reading from a file (or more generally, from any fd for which data is
either already there or will never be there)?

Regards,
     Neil





reply via email to

[Prev in Thread] Current Thread [Next in Thread]