[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e9c3a7c20810211316i13610410h5ec022b55c248c6a@mail.gmail.com>
Date: Tue, 21 Oct 2008 13:16:04 -0700
From: "Dan Williams" <dan.j.williams@...el.com>
To: "Timur Tabi" <timur@...escale.com>
Cc: linux-kernel@...r.kernel.org,
"Kumar Gala" <kumar.gala@...escale.com>
Subject: Re: Best method for sending messages to user space?
On Tue, Oct 21, 2008 at 12:43 PM, Timur Tabi <timur@...escale.com> wrote:
> Dan Williams wrote:
>
>> I really like the sysfs_notify() approach that Neil Brown has put
>> together for delivering md-raid events.
>
> Is there any documentation for sysfs_notify? It doesn't appear to do anything
> whenever I call it.
>
It simply allows you to write an event loop in userspace using a sysfs
attribute file descriptor. Pseudo-example:
fd = open("/sys/block/md0/md/array_state");
do {
read(buf, fd, len);
act_on_message(buf);
select(...); /* wait for next sysfs_notify event */
lseek(fd, 0, SEEK_SET); /* seek back so we can read the new state */
} while (1);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists