c - where will be the output of the user from kernel using procfs? -


ssize_t dev_read(struct file *filp,char *buf,size_t count,loff_t *offset) {     int len = count >= strlen(chr_arr.array) ? strlen(chr_arr.array) : count;     *offset += len;      if (*offset >= strlen(chr_arr.array))         return 0;      if (copy_to_user(buf,chr_arr.array,len))         return -efault;      return len; } 

i want read value kernel , use in user application, using procfs api read kernel , use in user space.

the above read function read kernel , store in user buffer(buf). if want read output user application value read kernel stored in user space ?? me in ??

if value exposed in procfs, user application needs open procfs node file , read other file. fancy stuff's done in kernel.

if you're trying write kernel component exposes procfs, you'll need similar code quoted handle read() calls procfs node.


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -