Skip to content

rtl/linux: Definition of inotify_event in rtl/linux/linux.pp is wrong

Original C-style definition in <sys/inotify.h> as follows

struct inotify_event {
	__s32		wd;		/* watch descriptor */
	__u32		mask;		/* watch mask */
	__u32		cookie;		/* cookie to synchronize two events */
	__u32		len;		/* length (including nulls) of name */
	char		name[];	/* stub for possible name */
}; 

usage of flexible array member name does not affect the structure size.

sizeof(inotify_event) = 16

FPC definition

inotify_event = record
    wd     : cint;
    mask   : cuint32;
    cookie : cuint32;
    len    : cuint32;
    name   : AnsiChar;
  end; 

has real member name which makes sizeof(inotify_event) = 17

Reading the events requires usage sizeof(inotify_event), then depending on the field len - reading the filename.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information