From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: Re: Guile hangs on /sys file read. Date: Sun, 26 Nov 2006 13:33:42 +0000 Message-ID: <87lklytjrd.fsf@ossau.uklinux.net> References: <87ejrs8ulb.fsf@raven.defaultvalue.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1164548844 25750 80.91.229.2 (26 Nov 2006 13:47:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 26 Nov 2006 13:47:24 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Nov 26 14:47:20 2006 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GoKLf-0001zh-Oh for guile-devel@m.gmane.org; Sun, 26 Nov 2006 14:47:12 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GoKLf-0002jb-0m for guile-devel@m.gmane.org; Sun, 26 Nov 2006 08:47:11 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GoKLc-0002j7-JV for guile-devel@gnu.org; Sun, 26 Nov 2006 08:47:08 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GoKLa-0002ip-Ub for guile-devel@gnu.org; Sun, 26 Nov 2006 08:47:08 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GoKLa-0002ij-QH for guile-devel@gnu.org; Sun, 26 Nov 2006 08:47:06 -0500 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GoKLa-0006DM-R0 for guile-devel@gnu.org; Sun, 26 Nov 2006 08:47:07 -0500 Original-Received: from laruns (host86-145-51-69.range86-145.btcentralplus.com [86.145.51.69]) by mail3.uklinux.net (Postfix) with ESMTP id 5F3EA40A1EC; Sun, 26 Nov 2006 13:34:34 +0000 (UTC) Original-Received: from laruns (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 40F8C6F71F; Sun, 26 Nov 2006 13:33:42 +0000 (GMT) Original-To: Rob Browning In-Reply-To: <87ejrs8ulb.fsf@raven.defaultvalue.org> (Rob Browning's message of "Fri, 24 Nov 2006 12:20:48 -0800") User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:6242 Archived-At: Rob Browning 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 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel