On Thu, Nov 29, 2012 at 11:07 AM, Pietro Paolini <P.Paolini@xxxxxxxxxxxxxxxxx> wrote: > Hello! > > Thanks for your reply, the fact is that I am not writing a device driver but just an user-space program and I would like implement a technique like /proc/ under a normal directory. > > Like /tmp/blahblah > > I have a program which take count about some statistics and I want read them "on demand" doing a cat of /tmp/blahblah, I investigate a bit and : > > 1) FIFO can be a solution but if I am not wrong I need two FIFO, one for say "I want read stats" and another one where write them > > 2) I could use inotify and write on a file the stats when file under monitoring is opened for read. > > In both cases I need two file, I would like instead use one, how can I do that ? > > Many many thanks, > Pietro. > > I guess what you want is an asynchronous way to react to a request. A simpler way may be to install a signal handler for SIGUSR1 or SIGUSR2 and dump the stats in known place. Or if you really wanna use a pipe you can do a asynchronous read on the pipe and do the stats dumping in the callback. Regards, Victor. _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies