lkml.org 
[lkml]   [2004]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectIs it possible to access sysfs from within the kernel?
Why? Lets see.
Sysfs describes the system with all its devices etc but is also an
interface to access kernel internal data.
Sysfs data could easily be put into a hierarchical tree. (I think it
even is, but it's not so obvious, because it's done using the fs code
(inodes, dentries), maybe the kobjects do play a big role here, too).
To access sysfs from an application, you have to use extensively open()
and close() for each file (attributes) and readdir for directories... or
use libsysfs which does these things for you.
While the current design is good for users (cat /sys/.../.../attribute),
it's not very efficient for applications (due to the many syscalls).
IMO it would be much better (for the applications) to have a device node
in /dev which could be used to access the sysfs tree. No ioctl but using
simple packets.
Besides the simple query/result things, you could register for recieving
events (now hotplug), with the difference that the current hotplug
(AFAIK) can inform (execute) only one application (/sbin/hotplug).
Or even make it possible to recieve events only from certain
classes/devices/subsystems etc.

tom
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.080 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site