android - Access data from proc file within kernel module -
i need access proc files in module on android kernel. need info shown in cat command, cat /proc/uptime
. need programmatically.
i tried work proc_fs
functions, little fuzzy me, examples create proc file read , it. need use data proc files.
i tred fopen
, not seems work on modules.
how can that? i'm newbie on this. i'm working on goldfish android kernel.
thanks.
procfs in-memory file system. interface userspace fetch info , put (config) info kernel data structures. in other words, procfs enables userspace interact , kernel data structures way exist during runtime.
hence, file inside /proc not meant read inside kernel or kernel module. , why 1 want that? in monolithic kernel linux, can access data structures of 1 subsystem in kernel through directly or through pre-defined function.
the following function call might help:
struct timespec uptime; do_posix_clock_monotonic_gettime(&uptime);
you can refer /proc/uptime implementation @ link below, seq_file
.
Comments
Post a Comment