mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michael Kerrisk" <mtk.manpages@googlemail.com>
To: "Andrew Morton" <akpm@linux-foundation.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	"Robert Love" <rlove@google.com>,
	"Vegard Nossum" <vegard.nossum@gmail.com>,
	"Ulrich Drepper" <drepper@redhat.com>,
	"Michael Kerrisk" <mtk.manpages@gmail.com>
Subject: Re: [patch] Fix type errors in inotify interfaces
Date: Tue, 18 Nov 2008 15:22:59 -0500	[thread overview]
Message-ID: <cfd18e0f0811181222y4cba081m18fc5cf86512b85f@mail.gmail.com> (raw)
In-Reply-To: <4923230D.8090301@gmail.com>

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

  reply	other threads:[~2008-11-18 20:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-18 20:18 Michael Kerrisk
2008-11-18 20:22 ` Michael Kerrisk [this message]
2008-11-18 20:39   ` Michael Kerrisk
2008-11-19  8:03 ` Andrew Morton
2008-11-19 19:10   ` Michael Kerrisk
2008-11-19 19:13     ` Robert Love
2008-11-19 19:24     ` John McCutchan

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=cfd18e0f0811181222y4cba081m18fc5cf86512b85f@mail.gmail.com \
    --to=mtk.manpages@googlemail.com \
    --cc=akpm@linux-foundation.org \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=rlove@google.com \
    --cc=vegard.nossum@gmail.com \
    /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

all inboxes | Powered by JetHome®