I'm working on a notifyfs, which is to be a filesystem change monitor.
Apart from setting watches using inotify on behalv of client apps, it can also
send a message to a client fs ("forward a watch"). This client fs is
typically a fs
where inotify is not enough to monitor, and additional methods (which
suit the backend)
have to be used, like a FUSE overlay fs's, cifs and nfs.
Now the communication between notifyfs and the client fs is done using
sendmsg and recvmsg. This works ok, but when receiving a message, sometimes
the receiving site reads 2 (or more) messages a time. This is done
when the buffer is large enough to hold multiple messages.
I've tried using MSG_PEEK, to inspect the just arrived message before
actual reading it, to look at the size, and create buffers exact large
enough to hold the message, and than read it, but that does not work
Anyone a clue??
Thanks in advance,
2012/4/20 Stef Bon <stefbon@...>:
> I'm working on a notifyfs, which is to be a filesystem change monitor.
> I've tried using MSG_PEEK, to inspect the just arrived message before
> actual reading it, to look at the size, and create buffers exact large
> enough to hold the message, and than read it, but that does not work
> as expected.
I've solved this issue.
The first part of the data vector (msg->msg_iov.iov_base) contains
information of fixed size. I've added two integers to it about the
of the two other data vectors (msg_iov.iov_base and
msg_iov.iov_base) . By using the MSG_PEEK the first data block is
read, and the sizes of the two other data can be determined.
Get latest updates about Open Source Projects, Conferences and News.