linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux/inotify.h: do not include <linux/fcntl.h> in userspace
@ 2008-09-16 12:22 Kirill A. Shutemov
  2008-09-16 12:58 ` Adrian Bunk
  0 siblings, 1 reply; 10+ messages in thread
From: Kirill A. Shutemov @ 2008-09-16 12:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Kirill A. Shutemov, Ulrich Drepper, Davide Libenzi,
	David Woodhouse, Andrew Morton

<linux/fcntl.h> conflicts with glibc's <fcntl.h>.

It breaks building kdelibs, kdepim and pinot. It's regression itroduced
by commit 4006553.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Ulrich Drepper <drepper@redhat.com>
Cc: Davide Libenzi <davidel@xmailserver.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 include/linux/inotify.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index bd57857..792b6f0 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -7,8 +7,10 @@
 #ifndef _LINUX_INOTIFY_H
 #define _LINUX_INOTIFY_H
 
+#ifdef __KERNEL__
 /* For O_CLOEXEC and O_NONBLOCK */
 #include <linux/fcntl.h>
+#endif
 #include <linux/types.h>
 
 /*
-- 
1.5.6.5.GIT


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux/inotify.h: do not include <linux/fcntl.h> in userspace
  2008-09-16 12:22 [PATCH] linux/inotify.h: do not include <linux/fcntl.h> in userspace Kirill A. Shutemov
@ 2008-09-16 12:58 ` Adrian Bunk
  2008-09-16 13:02   ` Kirill A. Shutemov
  0 siblings, 1 reply; 10+ messages in thread
From: Adrian Bunk @ 2008-09-16 12:58 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: linux-kernel, Ulrich Drepper, Davide Libenzi, David Woodhouse,
	Andrew Morton

On Tue, Sep 16, 2008 at 03:22:43PM +0300, Kirill A. Shutemov wrote:
> <linux/fcntl.h> conflicts with glibc's <fcntl.h>.
> 
> It breaks building kdelibs, kdepim and pinot.

We should rather fix the actual bug.

What is the error message?

>...
> --- a/include/linux/inotify.h
> +++ b/include/linux/inotify.h
> @@ -7,8 +7,10 @@
>  #ifndef _LINUX_INOTIFY_H
>  #define _LINUX_INOTIFY_H
>  
> +#ifdef __KERNEL__
>  /* For O_CLOEXEC and O_NONBLOCK */
>  #include <linux/fcntl.h>
> +#endif
>...  

This breaks the header for users of IN_CLOEXEC/IN_NONBLOCK.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux/inotify.h: do not include <linux/fcntl.h> in userspace
  2008-09-16 12:58 ` Adrian Bunk
@ 2008-09-16 13:02   ` Kirill A. Shutemov
  2008-09-16 13:31     ` Adrian Bunk
  2008-09-16 14:10     ` Ulrich Drepper
  0 siblings, 2 replies; 10+ messages in thread
From: Kirill A. Shutemov @ 2008-09-16 13:02 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: linux-kernel, Ulrich Drepper, Davide Libenzi, David Woodhouse,
	Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 1394 bytes --]

On Tue, Sep 16, 2008 at 03:58:02PM +0300, Adrian Bunk wrote:
> On Tue, Sep 16, 2008 at 03:22:43PM +0300, Kirill A. Shutemov wrote:
> > <linux/fcntl.h> conflicts with glibc's <fcntl.h>.
> > 
> > It breaks building kdelibs, kdepim and pinot.
> 
> We should rather fix the actual bug.
> 
> What is the error message?

/usr/include/asm-generic/fcntl.h:117: error: redefinition of 'struct
flock'
/usr/include/bits/fcntl.h:142: error: previous definition of 'struct
flock'
/usr/include/asm-generic/fcntl.h:140: error: redefinition of 'struct
flock64'
/usr/include/bits/fcntl.h:157: error: previous definition of 'struct
flock64'

> 
> >...
> > --- a/include/linux/inotify.h
> > +++ b/include/linux/inotify.h
> > @@ -7,8 +7,10 @@
> >  #ifndef _LINUX_INOTIFY_H
> >  #define _LINUX_INOTIFY_H
> >  
> > +#ifdef __KERNEL__
> >  /* For O_CLOEXEC and O_NONBLOCK */
> >  #include <linux/fcntl.h>
> > +#endif
> >...  
> 
> This breaks the header for users of IN_CLOEXEC/IN_NONBLOCK.
> 
> cu
> Adrian
> 
> -- 
> 
>        "Is there not promise of rain?" Ling Tan asked suddenly out
>         of the darkness. There had been need of rain for many days.
>        "Only a promise," Lao Er said.
>                                        Pearl S. Buck - Dragon Seed
> 

-- 
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.com/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux/inotify.h: do not include <linux/fcntl.h> in userspace
  2008-09-16 13:02   ` Kirill A. Shutemov
@ 2008-09-16 13:31     ` Adrian Bunk
  2008-09-16 14:10     ` Ulrich Drepper
  1 sibling, 0 replies; 10+ messages in thread
From: Adrian Bunk @ 2008-09-16 13:31 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: linux-kernel, Ulrich Drepper, Davide Libenzi, David Woodhouse,
	Andrew Morton

On Tue, Sep 16, 2008 at 04:02:36PM +0300, Kirill A. Shutemov wrote:
> On Tue, Sep 16, 2008 at 03:58:02PM +0300, Adrian Bunk wrote:
> > On Tue, Sep 16, 2008 at 03:22:43PM +0300, Kirill A. Shutemov wrote:
> > > <linux/fcntl.h> conflicts with glibc's <fcntl.h>.
> > > 
> > > It breaks building kdelibs, kdepim and pinot.
> > 
> > We should rather fix the actual bug.
> > 
> > What is the error message?
> 
> /usr/include/asm-generic/fcntl.h:117: error: redefinition of 'struct
> flock'
> /usr/include/bits/fcntl.h:142: error: previous definition of 'struct
> flock'
> /usr/include/asm-generic/fcntl.h:140: error: redefinition of 'struct
> flock64'
> /usr/include/bits/fcntl.h:157: error: previous definition of 'struct
> flock64'
>...

Kernel headers and glibc headers are an own story, Ulrich might know 
best about that.


But I'm wondering, why is kdelibs doing

<--  snip  -->

...
#include <fcntl.h>
#include <sys/syscall.h>
#include <linux/types.h>
// Linux kernel headers are documented to not compile
#define _S390_BITOPS_H
#include <linux/inotify.h>

static inline int inotify_init (void)
{
  return syscall (__NR_inotify_init);
}
...

<--  snip  -->


pinot even contains a file with the inotify syscall numbers for all 
architectures.


inotify_init(2) already documents the following usage:

<--   snip  -->

...
#include <sys/inotify.h>

int inotify_init(void);
...

<--  snip  -->


Unless someone knows a good reason against that (and no matter how the 
kernel situation will change) I'll send patches to get KDE fixed in this 
respect.


cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux/inotify.h: do not include <linux/fcntl.h> in userspace
  2008-09-16 13:02   ` Kirill A. Shutemov
  2008-09-16 13:31     ` Adrian Bunk
@ 2008-09-16 14:10     ` Ulrich Drepper
  2008-09-16 14:43       ` Kirill A. Shutemov
  2008-09-16 16:09       ` Adrian Bunk
  1 sibling, 2 replies; 10+ messages in thread
From: Ulrich Drepper @ 2008-09-16 14:10 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: Adrian Bunk, linux-kernel, Davide Libenzi, David Woodhouse,
	Andrew Morton

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kirill A. Shutemov wrote:
>> What is the error message?
> 
> /usr/include/asm-generic/fcntl.h:117: error: redefinition of 'struct
> flock'

And?  None of these programs should use <linux/inotify.h>.  There has
for the longest time been a <sys/inotify.h> header which doesn't need
any kernel headers.  In fact, <linux/inotify.h> should not be exported.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkjPvlEACgkQ2ijCOnn/RHTO0ACfR2NrTZ97pK34xZKM5pzlRbL6
Nb4AoJ27y9MU+Udr50GZVfZZXjg3ENWg
=7Pol
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux/inotify.h: do not include <linux/fcntl.h> in userspace
  2008-09-16 14:10     ` Ulrich Drepper
@ 2008-09-16 14:43       ` Kirill A. Shutemov
  2008-09-16 16:09       ` Adrian Bunk
  1 sibling, 0 replies; 10+ messages in thread
From: Kirill A. Shutemov @ 2008-09-16 14:43 UTC (permalink / raw)
  To: Ulrich Drepper
  Cc: Adrian Bunk, linux-kernel, Davide Libenzi, David Woodhouse,
	Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 1854 bytes --]

On Tue, Sep 16, 2008 at 07:10:25AM -0700, Ulrich Drepper wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Kirill A. Shutemov wrote:
> >> What is the error message?
> > 
> > /usr/include/asm-generic/fcntl.h:117: error: redefinition of 'struct
> > flock'
> 
> And?  None of these programs should use <linux/inotify.h>.  There has
> for the longest time been a <sys/inotify.h> header which doesn't need
> any kernel headers.  In fact, <linux/inotify.h> should not be exported.

Ok. Let's unexport <linux/inotify.h>.

diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index b68ec09..dbb8107 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -240,7 +240,6 @@ unifdef-y += igmp.h
 unifdef-y += inet_diag.h
 unifdef-y += in.h
 unifdef-y += in6.h
-unifdef-y += inotify.h
 unifdef-y += input.h
 unifdef-y += ip.h
 unifdef-y += ipc.h
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index bd57857..0188b6a 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -10,6 +10,8 @@
 /* For O_CLOEXEC and O_NONBLOCK */
 #include <linux/fcntl.h>
 #include <linux/types.h>
+#include <linux/dcache.h>
+#include <linux/fs.h>
 
 /*
  * struct inotify_event - structure read from the inotify device for each event
@@ -69,11 +71,6 @@ struct inotify_event {
 #define IN_CLOEXEC O_CLOEXEC
 #define IN_NONBLOCK O_NONBLOCK
 
-#ifdef __KERNEL__
-
-#include <linux/dcache.h>
-#include <linux/fs.h>
-
 /*
  * struct inotify_watch - represents a watch request on a specific inode
  *
@@ -230,6 +227,4 @@ static inline void put_inotify_watch(struct inotify_watch *watch)
 
 #endif	/* CONFIG_INOTIFY */
 
-#endif	/* __KERNEL __ */
-
 #endif	/* _LINUX_INOTIFY_H */

-- 
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.com/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux/inotify.h: do not include <linux/fcntl.h> in userspace
  2008-09-16 14:10     ` Ulrich Drepper
  2008-09-16 14:43       ` Kirill A. Shutemov
@ 2008-09-16 16:09       ` Adrian Bunk
  2008-09-17  9:32         ` Kirill A. Shutemov
  1 sibling, 1 reply; 10+ messages in thread
From: Adrian Bunk @ 2008-09-16 16:09 UTC (permalink / raw)
  To: Ulrich Drepper
  Cc: Kirill A. Shutemov, linux-kernel, Davide Libenzi,
	David Woodhouse, Andrew Morton

On Tue, Sep 16, 2008 at 07:10:25AM -0700, Ulrich Drepper wrote:
> Kirill A. Shutemov wrote:
> >> What is the error message?
> > 
> > /usr/include/asm-generic/fcntl.h:117: error: redefinition of 'struct
> > flock'
> 
> And?  None of these programs should use <linux/inotify.h>.  There has
> for the longest time been a <sys/inotify.h> header which doesn't need
> any kernel headers.  In fact, <linux/inotify.h> should not be exported.

Even if userspace applications shouldn't use it directly this doesn't 
sound right:

We shouldn't force all libc implementations to copy the contents into a 
private header.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux/inotify.h: do not include <linux/fcntl.h> in userspace
  2008-09-16 16:09       ` Adrian Bunk
@ 2008-09-17  9:32         ` Kirill A. Shutemov
  2008-09-17 10:04           ` Kirill A. Shutemov
  0 siblings, 1 reply; 10+ messages in thread
From: Kirill A. Shutemov @ 2008-09-17  9:32 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: Ulrich Drepper, linux-kernel, Davide Libenzi, David Woodhouse,
	Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 960 bytes --]

On Tue, Sep 16, 2008 at 07:09:02PM +0300, Adrian Bunk wrote:
> On Tue, Sep 16, 2008 at 07:10:25AM -0700, Ulrich Drepper wrote:
> > Kirill A. Shutemov wrote:
> > >> What is the error message?
> > > 
> > > /usr/include/asm-generic/fcntl.h:117: error: redefinition of 'struct
> > > flock'
> > 
> > And?  None of these programs should use <linux/inotify.h>.  There has
> > for the longest time been a <sys/inotify.h> header which doesn't need
> > any kernel headers.  In fact, <linux/inotify.h> should not be exported.
> 
> Even if userspace applications shouldn't use it directly this doesn't 
> sound right:
> 
> We shouldn't force all libc implementations to copy the contents into a 
> private header.

glibc and dietlibc provide <sys/inotify.h>. newlib and uclibc don't. klibc
provides <sys/inotify.h> but it depends on <linux/inotify.h>

-- 
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.com/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux/inotify.h: do not include <linux/fcntl.h> in userspace
  2008-09-17  9:32         ` Kirill A. Shutemov
@ 2008-09-17 10:04           ` Kirill A. Shutemov
  2008-09-17 10:12             ` Adrian Bunk
  0 siblings, 1 reply; 10+ messages in thread
From: Kirill A. Shutemov @ 2008-09-17 10:04 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: Ulrich Drepper, linux-kernel, Davide Libenzi, David Woodhouse,
	Andrew Morton, klibc

[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]

On Wed, Sep 17, 2008 at 12:32:40PM +0300, Kirill A. Shutemov wrote:
> On Tue, Sep 16, 2008 at 07:09:02PM +0300, Adrian Bunk wrote:
> > On Tue, Sep 16, 2008 at 07:10:25AM -0700, Ulrich Drepper wrote:
> > > Kirill A. Shutemov wrote:
> > > >> What is the error message?
> > > > 
> > > > /usr/include/asm-generic/fcntl.h:117: error: redefinition of 'struct
> > > > flock'
> > > 
> > > And?  None of these programs should use <linux/inotify.h>.  There has
> > > for the longest time been a <sys/inotify.h> header which doesn't need
> > > any kernel headers.  In fact, <linux/inotify.h> should not be exported.
> > 
> > Even if userspace applications shouldn't use it directly this doesn't 
> > sound right:
> > 
> > We shouldn't force all libc implementations to copy the contents into a 
> > private header.
> 
> glibc and dietlibc provide <sys/inotify.h>. newlib and uclibc don't. klibc
> provides <sys/inotify.h> but it depends on <linux/inotify.h>

Oh.. Sorry. uclibc provides <sys/inotify.h>.

So unexporting <linux/inotify.h> breaks only klibc.

-- 
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.com/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux/inotify.h: do not include <linux/fcntl.h> in userspace
  2008-09-17 10:04           ` Kirill A. Shutemov
@ 2008-09-17 10:12             ` Adrian Bunk
  0 siblings, 0 replies; 10+ messages in thread
From: Adrian Bunk @ 2008-09-17 10:12 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: Ulrich Drepper, linux-kernel, Davide Libenzi, David Woodhouse,
	Andrew Morton, klibc

On Wed, Sep 17, 2008 at 01:04:23PM +0300, Kirill A. Shutemov wrote:
> On Wed, Sep 17, 2008 at 12:32:40PM +0300, Kirill A. Shutemov wrote:
> > On Tue, Sep 16, 2008 at 07:09:02PM +0300, Adrian Bunk wrote:
> > > On Tue, Sep 16, 2008 at 07:10:25AM -0700, Ulrich Drepper wrote:
> > > > Kirill A. Shutemov wrote:
> > > > >> What is the error message?
> > > > > 
> > > > > /usr/include/asm-generic/fcntl.h:117: error: redefinition of 'struct
> > > > > flock'
> > > > 
> > > > And?  None of these programs should use <linux/inotify.h>.  There has
> > > > for the longest time been a <sys/inotify.h> header which doesn't need
> > > > any kernel headers.  In fact, <linux/inotify.h> should not be exported.
> > > 
> > > Even if userspace applications shouldn't use it directly this doesn't 
> > > sound right:
> > > 
> > > We shouldn't force all libc implementations to copy the contents into a 
> > > private header.
> > 
> > glibc and dietlibc provide <sys/inotify.h>. newlib and uclibc don't. klibc
> > provides <sys/inotify.h> but it depends on <linux/inotify.h>
> 
> Oh.. Sorry. uclibc provides <sys/inotify.h>.
> 
> So unexporting <linux/inotify.h> breaks only klibc.

klibc is actually doing the right thing.

The userspace kernel headers situation used to be a complete mess, and 
it is therefore understandable that some libc implementations are 
currently not using <linux/inotify.h>, but ideally in the long term all 
libc implementations should use <linux/inotify.h>.

Whether, and if yes when, libc implementations starts using 
<linux/inotify.h> is not our business, but we have to ensure that it 
works for the libc implementations that do use it.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-09-17 10:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-16 12:22 [PATCH] linux/inotify.h: do not include <linux/fcntl.h> in userspace Kirill A. Shutemov
2008-09-16 12:58 ` Adrian Bunk
2008-09-16 13:02   ` Kirill A. Shutemov
2008-09-16 13:31     ` Adrian Bunk
2008-09-16 14:10     ` Ulrich Drepper
2008-09-16 14:43       ` Kirill A. Shutemov
2008-09-16 16:09       ` Adrian Bunk
2008-09-17  9:32         ` Kirill A. Shutemov
2008-09-17 10:04           ` Kirill A. Shutemov
2008-09-17 10:12             ` Adrian Bunk

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).