how to find proc mounted or not using C libraries
Hi Friends,
I want to know how to find whether proc or sys is mounted using C libraries. I came across this file in kernel source tree[1] which showed me some idea. But i dont know from where the CONFIG_ACPI_PROCFS_POWER or CONFIG_ACPI_SYSFS_POWER defined. I like to use them in my project[2] for finding whether proc is mounted or not because my project totally depends on proc. [1] http://git.kernel.org/?p=linux/kerne...9efbb7;hb=HEAD [2] http://webattery.sf.net Thanks, Alagunambi Welkin |
Why don't you just try to open the files in the proc or sys filesystem? That will tell you if they are there and readable. The open will fail with ENOENT if the file doesn't exist.
|
Hi,
Thanks for your reply. I can do what you told, but in some distributions they are using sysfs insted of procfs so inorder to find which file system is used I need solution. Alagunambi Welkin |
For those of us unacquainted with the differences, perhaps you could briefly explain them, and also how you would distinguish between them in some other context, such as with commandline tools, etc. This sounds like something that changed across kernel versions; maybe just checking the kernel version would suffice.
--- rod. |
Quote:
|
Quote:
|
As of 2.6.29, both /proc and /sys are available in the kernel. I do not know if any distros turn one or the other off; I suppose that is possible in the kernel compilation but if true it seems it would break a lot of things.
|
Quote:
|
Quote:
http://git.kernel.org/?p=linux/kerne...9efbb7;hb=HEAD Here kernel developer clearly mentioned what are the headers to use when procfs has hardware details, or sysfs has hardware details. Thanks every one for your kind information. Alagunambi Welkin |
Quote:
|
Quote:
|
Quote:
But i still didnt get the answer how to find hardware details are in procfs or in sysfs |
All times are GMT -5. The time now is 04:37 PM. |