Date: Thu, 05 Aug 2004 13:02:00 +0530 From: ravi <ravi.nanjundappa@ap.sony.com> To: Dan Nelson <dnelson@allantgroup.com> Cc: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> Subject: Regarding writing to /proc entries Message-ID: <1091691119.4724.19.camel@ravin> In-Reply-To: <20040804050142.GB85344@dan.emsphone.com> References: <20040804050142.GB85344@dan.emsphone.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi,
I've created my own /proc entries using linprocfs.c with read and write
permissions like this
" pfs_create_file(root,"EXAMPLE",&myfunc,NULL,NULL,PFS_RDWR); "
and I've associated my own filler function as follows .
static int myfunc(PFS_FILL_ARGS)
{
printf(" in myfunc() .....\n");
if(uio->uio_rw ==UIO_WRITE)
printf(" write request \n");
else
printf(" read request \n");
sbuf_printf(sb, " myfunc function called\n");
printf(" exiting from myfunc() .....\n");
return 0;
}
Please read the above statements .
When I run "cat /proc/EXAMPLE" I'll get the follwing o/p on the screen .
OUTPUT:
in myfunc() .....
read request
exiting from myfunc() .....
myfunc function called
in myfunc() .....
read request
exiting from myfunc() .....
Even though I'm checking the operation that is requested with the
conditional statements if (uio->uiorw==UIO_WRITE) and when I run
"echo 0 > /proc/EXAMPLE " I'm getting the following error
ERROR:
/proc/EXAMPLE : Operation not supported
The same error is coming even for process related " ctl " files as well
when I run
"echo attach /proc/12/ctl "
Please tell me the reason and solution for this .
Regards,
N Ravi
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1091691119.4724.19.camel>
