In article <op.swzfm2axs1a91r / localhost>, MiG <mig / 1984.cz> writes: > I have a problem with opening a file under /proc in a thread. > > This works fine: > File.open('/proc/locks').readlines > > But this hangs on open: > t = Thread.new { File.open('/proc/locks').readlines } > t.join > > It happens on Linux 2.6, Linux 2.4 seems ok. > > It looks the same as > http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/3798 > > Is there any workaround (other than `cat`) ? Upgrade the Linux kernel to 2.6.13. http://kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.13 | commit e334016fc1735e491385e14157a0360cd85c321b | Author: Luke Kosewski <lkosewsk / nit.ca> | Date: Wed Jun 1 02:39:28 2005 -0500 | | Input: do not corrupt system-wide procfs fops. | | entry->proc_fops is a pointer to struct file_operations. When we | call create_proc_entry(...), it pointis to proc_file_operations, | deep in fs/proc/generic.c. By adding a 'poll' member to this struct | we effectively force the 'poll' member on every file in /proc, | which is wrong (they all fail select(...) calls). | | This patch changes a copy of entry->proc_fops and reassigns it rather | than changing the original member. | | Signed-off-by: Dmitry Torokhov <dtor / mail.ru> -- Tanaka Akira