From: Michael Titke <michael.tiedtke-X3bqsT2AMO4b1SvskN2V4Q@public.gmane.org>
To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: iNotify Man Page: Prefix Header + Tail Array vs C Structure
Date: Sun, 13 Dec 2015 13:09:45 +0100 [thread overview]
Message-ID: <566D6009.7050409@o2online.de> (raw)
Hello!
The current version of the manual page describing /inotify/ (as well as
the version installed with Ubuntu 15.04 frozen to Violet Indigo)
contains a descriptive C structure describing the /inotify//messages/:
struct inotify_event {
int wd; /* Watch descriptor */
uint32_t mask; /* Mask describing event */
uint32_t cookie; /* Unique cookie associating related
events (for rename(2)) */
uint32_t len; /* Size of name field */
char name[]; /* Optional null-terminated name */
};
As part of the development of VSI I translated the above structure
without much thinking into a corresponding byte structure description:
(define inotify-event-header
(byte-structure-description
(wd int)
(mask 4) ; [sic! that was an uint32]
(cookie 4)
(len 4)
;(name pointer) ; That's not a pointer but an array: NAME_MAX + 1
))
Now while the prefix (or header) of the message is described adequately
the specification of the tail array as a char name[] would in C be
interpreted as a pointer onto a char. One might insert a length
parameter like char name[NAME_MAX + 1] or exclude that tail array from
the structure and describe the message in terms of /prefix/ or /header/
and /tail array/.
struct inotify_event {
int wd; /* Watch descriptor */
uint32_t mask; /* Mask describing event */
uint32_t cookie; /* Unique cookie associating related
events (for rename(2)) */
uint32_t len; /* Size of name field */
char name[NAME_MAX + 1]; /* Optional
null-terminated name */
};
With that length parameter in the structure the size of the messages is
described adequately but the actual length of the name might be confused
with the maximum size which usually includes some (tail) padding.
I'm sorry but I don't know enough about /iNotify/ to craft a patch for
this. Is this a datagram channel where half-read messages will vanish?
Perhaps I should continue reading the manual page. :-)
Regards,
Michael
--
VSI: https://code.launchpad.net/viper-system-interface
(reason: 550 5.7.1 Content-Policy reject msg: The message contains HTML subpart, therefore we consider it SPAM or Outlook Virus. TEXT/PLAIN is accepted.! BF:<U
PS That's not really up to the standard but "... since hosts aren't
required to relay mail at all ..." someone presumes something.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2015-12-13 12:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-13 12:09 Michael Titke [this message]
[not found] ` <566D6009.7050409-X3bqsT2AMO4b1SvskN2V4Q@public.gmane.org>
2015-12-13 17:53 ` iNotify Man Page: Prefix Header + Tail Array vs C Structure walter harms
[not found] ` <566DB08E.6090305-fPG8STNUNVg@public.gmane.org>
2015-12-14 9:46 ` Michael Titke
[not found] ` <566E9009.7030703-X3bqsT2AMO4b1SvskN2V4Q@public.gmane.org>
2015-12-14 11:01 ` Michael Kerrisk (man-pages)
[not found] ` <566EA19A.8060309-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-12-14 12:48 ` Michael Titke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=566D6009.7050409@o2online.de \
--to=michael.tiedtke-x3bqst2amo4b1svskn2v4q@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).