lkml.org 
[lkml]   [2008]   [Nov]   [18]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 18 Nov 2008 15:22:59 -0500
From"Michael Kerrisk" <>
SubjectRe: [patch] Fix type errors in inotify interfaces
I hope Robert doesn't mind if I drop a piece from our old offlist mail
conversation into this thread, for some background.

-------- Original Message --------
Subject: Re: Use of uint32_t in inotify APIs
Date: Tue, 20 Jun 2006 09:07:17 -0400
From: Robert Love <rlove@rlove.org>
On 6/20/06, Michael Kerrisk wrote:

Hi,

> The use of uint32_t seems a little strange in at least some of the
> above.  In particular, the watch descriptor returned by
> inotify_add_watch() is an "int", as is the "wd" field of the
> "inotify_event" structure, but in the prototype for inotify_rm_watch(),
> "wd" is uint32_t.  Is there a reason for this, or is it just cruft?

The unsigned parameter in inotify_rm_watch() is wrong.  I cannot think
we that should be the case.  But the problem lies not with glibc --
the function definition in the kernel is wrong, too.  It should be
fixed; everywhere else a watch descriptor is an __s32.

> Following on from this, is it really necessary that "mask" is uint32_t
> in the prototype for inotify_rm_watch()?  In most other glibc
> interfaces, bit masks are simply "int".

I think masks should be unsigned.  This definitely makes sense.

In the kernel, most of the inotify data types are __u32.

[...]

Also the 'wd' in the event structure should be 'int32_t' -- the kernel
uses the type '__s32' -- but perhaps glibc developers prefer to use a
straight 'int' since the types are identical.

In that case, inotify_rm_watch()'s 'wd' should be changed to '__s32'
in the kernel and 'int' in glibc.  Otherwise, '__s32' in the kernel
and 'int32_t' in glibc.  Since this change will affect ABI, it needs
to be made cautiously, but I don't see any issues.

     Robert Love


\
 
 \ /
  Last update: 2008-11-18 21:27    [from the cache]
©2003-2008