Bug 11014
Summary: | Weird select(2) behaviour with certain files in sysfs | ||
---|---|---|---|
Product: | File System | Reporter: | Julian Stecklina (der_julian) |
Component: | SysFS | Assignee: | Greg Kroah-Hartman (greg) |
Status: | REJECTED DOCUMENTED | ||
Severity: | normal | CC: | js, randy.dunlap |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 2.6.25.4 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: | Small program to demonstrate this bug. |
Description
Julian Stecklina
2008-06-30 15:22:06 UTC
Created attachment 16664 [details] Small program to demonstrate this bug. This is the same as the program at http://www1.inf.tu-dresden.de/~s1054849/kernbug.c . I attached it in case it disappears on my webspace. select/poll is not allowed on all sysfs files, only specific ones. It is weird that lisp has such a strange file io implementation. I'll play around with your sample application to see if I can get a simple fix for this... In looking at this further, it's just not going to work, sorry. The majority of sysfs files do not support poll/select, and we can't tell userspace this either (select/poll don't let us return an error message). So, for sysfs files, this isn't going to be able to work properly, and it has never worked before, sorry. According to stat the files in question are regular files. Reading man 3p select: "The pselect() and select() functions shall support regular files, terminal and pseudo-terminal devices, STREAMS-based files, FIFOs, pipes, and sockets." Perhaps I sound pedantic, but it still looks like a bug which forces applications to jump through hoops to determine whether a file has b0rken select semantics... :-/ Yes, but the sysfs files are "virtual files", not "regular files" or any of the other things the man page states. This is the way that sysfs has always worked. Also, there are other virtual files that the kernel exports that also operate the same way. /proc/bus/usb/devices is one example that also fails your test program here. If you know of a way that we can easily fix this within the kernel to make your application work, for all ram-based virtual file systems in the kernel, I would love to see it, but as of right now, I really don't know of a way to solve this, sorry. You marked this bug as DOCUMENTED. May I asked, where it's documented? Shouldn't it be in the BUGS section of the select and poll man pages? Wow, over a year since the last response, that's a long time :) Anyway, this should probably be documented somewhere, how about sending the man pages maintainer a patch for them? |