LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* timerfd incompatibility on mips
@ 2011-01-28 0:24 Alexander Gordeev
2011-01-28 0:53 ` Davide Libenzi
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Gordeev @ 2011-01-28 0:24 UTC (permalink / raw)
To: uClibc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1091 bytes --]
Hi!
I've just found a problem with TFD_NONBLOCK flag that can be passed to
timerfd_create.
<uclibc>/libc/sysdeps/linux/common/sys/timerfd.h which is installed
to /usr/include/sys/timerfd.h defines TFD_NONBLOCK as 04000 ie 0x800.
BTW glibc/eglibc headers do the same thing.
<linux>/include/linux/timerfd.h declares it as O_NONBLOCK which is
defined in fcntl.h. Usually O_NONBLOCK is 0x800 too but some
architectures including MIPS it redefine it:
arch/mips/include/asm/fcntl.h:#define O_NONBLOCK 0x0080
arch/alpha/include/asm/fcntl.h:#define O_NONBLOCK 00004
arch/sparc/include/asm/fcntl.h:#define O_NONBLOCK 0x4000
arch/parisc/include/asm/fcntl.h:#define O_NONBLOCK 000200004
My tests show that kernel thinks that TFD_NONBLOCK is 0x80 on MIPS. I
get what I want when I pass 0x80 and EINVAL when I pass 0x800. I don't
know why there are such uncertain things in Linux. Probably the problem
should be fixed in the kernel.
Right now one cannot use timerfd_create(..., TFD_NONBLOCK) on MIPS but
can use timerfd_create(..., O_NONBLOCK) instead.
--
Alexander
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: timerfd incompatibility on mips
2011-01-28 0:24 timerfd incompatibility on mips Alexander Gordeev
@ 2011-01-28 0:53 ` Davide Libenzi
2011-01-28 1:24 ` Alexander Gordeev
0 siblings, 1 reply; 5+ messages in thread
From: Davide Libenzi @ 2011-01-28 0:53 UTC (permalink / raw)
To: Alexander Gordeev; +Cc: uClibc, Linux Kernel Mailing List
On Fri, 28 Jan 2011, Alexander Gordeev wrote:
> Hi!
>
> I've just found a problem with TFD_NONBLOCK flag that can be passed to
> timerfd_create.
>
> <uclibc>/libc/sysdeps/linux/common/sys/timerfd.h which is installed
> to /usr/include/sys/timerfd.h defines TFD_NONBLOCK as 04000 ie 0x800.
> BTW glibc/eglibc headers do the same thing.
>
> <linux>/include/linux/timerfd.h declares it as O_NONBLOCK which is
> defined in fcntl.h. Usually O_NONBLOCK is 0x800 too but some
> architectures including MIPS it redefine it:
>
> arch/mips/include/asm/fcntl.h:#define O_NONBLOCK 0x0080
> arch/alpha/include/asm/fcntl.h:#define O_NONBLOCK 00004
> arch/sparc/include/asm/fcntl.h:#define O_NONBLOCK 0x4000
> arch/parisc/include/asm/fcntl.h:#define O_NONBLOCK 000200004
>
> My tests show that kernel thinks that TFD_NONBLOCK is 0x80 on MIPS. I
> get what I want when I pass 0x80 and EINVAL when I pass 0x800. I don't
> know why there are such uncertain things in Linux. Probably the problem
> should be fixed in the kernel.
>
> Right now one cannot use timerfd_create(..., TFD_NONBLOCK) on MIPS but
> can use timerfd_create(..., O_NONBLOCK) instead.
Ther kernel definition (include/linux/timerfd.h) maps it directly to
O_NONBLOCK, but I am noticing that glibc bolt in the value.
I don't think this is a kernel fix.
- Davide
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: timerfd incompatibility on mips
2011-01-28 0:53 ` Davide Libenzi
@ 2011-01-28 1:24 ` Alexander Gordeev
2011-01-28 1:49 ` Davide Libenzi
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Gordeev @ 2011-01-28 1:24 UTC (permalink / raw)
To: Davide Libenzi; +Cc: uClibc, Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 1715 bytes --]
В Thu, 27 Jan 2011 16:53:39 -0800 (PST)
Davide Libenzi <davidel@xmailserver.org> пишет:
> On Fri, 28 Jan 2011, Alexander Gordeev wrote:
>
> > Hi!
> >
> > I've just found a problem with TFD_NONBLOCK flag that can be passed to
> > timerfd_create.
> >
> > <uclibc>/libc/sysdeps/linux/common/sys/timerfd.h which is installed
> > to /usr/include/sys/timerfd.h defines TFD_NONBLOCK as 04000 ie 0x800.
> > BTW glibc/eglibc headers do the same thing.
> >
> > <linux>/include/linux/timerfd.h declares it as O_NONBLOCK which is
> > defined in fcntl.h. Usually O_NONBLOCK is 0x800 too but some
> > architectures including MIPS it redefine it:
> >
> > arch/mips/include/asm/fcntl.h:#define O_NONBLOCK 0x0080
> > arch/alpha/include/asm/fcntl.h:#define O_NONBLOCK 00004
> > arch/sparc/include/asm/fcntl.h:#define O_NONBLOCK 0x4000
> > arch/parisc/include/asm/fcntl.h:#define O_NONBLOCK 000200004
> >
> > My tests show that kernel thinks that TFD_NONBLOCK is 0x80 on MIPS. I
> > get what I want when I pass 0x80 and EINVAL when I pass 0x800. I don't
> > know why there are such uncertain things in Linux. Probably the problem
> > should be fixed in the kernel.
> >
> > Right now one cannot use timerfd_create(..., TFD_NONBLOCK) on MIPS but
> > can use timerfd_create(..., O_NONBLOCK) instead.
>
> Ther kernel definition (include/linux/timerfd.h) maps it directly to
> O_NONBLOCK, but I am noticing that glibc bolt in the value.
> I don't think this is a kernel fix.
Yes, but linux/timerfd.h is not installed so timerfd.h from *libc
cannot include it. So adding it to include/linux/Kbuild would be a
first step to make them not hard-code the value. Right?
--
Alexander
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: timerfd incompatibility on mips
2011-01-28 1:24 ` Alexander Gordeev
@ 2011-01-28 1:49 ` Davide Libenzi
2011-01-28 10:17 ` Alexander Gordeev
0 siblings, 1 reply; 5+ messages in thread
From: Davide Libenzi @ 2011-01-28 1:49 UTC (permalink / raw)
To: Alexander Gordeev; +Cc: uClibc, Linux Kernel Mailing List
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2046 bytes --]
On Fri, 28 Jan 2011, Alexander Gordeev wrote:
> В Thu, 27 Jan 2011 16:53:39 -0800 (PST)
> Davide Libenzi <davidel@xmailserver.org> пишет:
>
> > On Fri, 28 Jan 2011, Alexander Gordeev wrote:
> >
> > > Hi!
> > >
> > > I've just found a problem with TFD_NONBLOCK flag that can be passed to
> > > timerfd_create.
> > >
> > > <uclibc>/libc/sysdeps/linux/common/sys/timerfd.h which is installed
> > > to /usr/include/sys/timerfd.h defines TFD_NONBLOCK as 04000 ie 0x800.
> > > BTW glibc/eglibc headers do the same thing.
> > >
> > > <linux>/include/linux/timerfd.h declares it as O_NONBLOCK which is
> > > defined in fcntl.h. Usually O_NONBLOCK is 0x800 too but some
> > > architectures including MIPS it redefine it:
> > >
> > > arch/mips/include/asm/fcntl.h:#define O_NONBLOCK 0x0080
> > > arch/alpha/include/asm/fcntl.h:#define O_NONBLOCK 00004
> > > arch/sparc/include/asm/fcntl.h:#define O_NONBLOCK 0x4000
> > > arch/parisc/include/asm/fcntl.h:#define O_NONBLOCK 000200004
> > >
> > > My tests show that kernel thinks that TFD_NONBLOCK is 0x80 on MIPS. I
> > > get what I want when I pass 0x80 and EINVAL when I pass 0x800. I don't
> > > know why there are such uncertain things in Linux. Probably the problem
> > > should be fixed in the kernel.
> > >
> > > Right now one cannot use timerfd_create(..., TFD_NONBLOCK) on MIPS but
> > > can use timerfd_create(..., O_NONBLOCK) instead.
> >
> > Ther kernel definition (include/linux/timerfd.h) maps it directly to
> > O_NONBLOCK, but I am noticing that glibc bolt in the value.
> > I don't think this is a kernel fix.
>
> Yes, but linux/timerfd.h is not installed so timerfd.h from *libc
> cannot include it. So adding it to include/linux/Kbuild would be a
> first step to make them not hard-code the value. Right?
Glibc seems to wrap many files with their own definition.
I am not sure why they are actually doing it, but they must have a valid
reason.
It probably makes sense to just un-bolt the values from sys/timerfd.h and
link them to O_* values from fcntl.h.
- Davide
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: timerfd incompatibility on mips
2011-01-28 1:49 ` Davide Libenzi
@ 2011-01-28 10:17 ` Alexander Gordeev
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Gordeev @ 2011-01-28 10:17 UTC (permalink / raw)
To: Davide Libenzi; +Cc: uClibc, Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 2449 bytes --]
В Thu, 27 Jan 2011 17:49:39 -0800 (PST)
Davide Libenzi <davidel@xmailserver.org> пишет:
> On Fri, 28 Jan 2011, Alexander Gordeev wrote:
>
> > В Thu, 27 Jan 2011 16:53:39 -0800 (PST)
> > Davide Libenzi <davidel@xmailserver.org> пишет:
> >
> > > On Fri, 28 Jan 2011, Alexander Gordeev wrote:
> > >
> > > > Hi!
> > > >
> > > > I've just found a problem with TFD_NONBLOCK flag that can be passed to
> > > > timerfd_create.
> > > >
> > > > <uclibc>/libc/sysdeps/linux/common/sys/timerfd.h which is installed
> > > > to /usr/include/sys/timerfd.h defines TFD_NONBLOCK as 04000 ie 0x800.
> > > > BTW glibc/eglibc headers do the same thing.
> > > >
> > > > <linux>/include/linux/timerfd.h declares it as O_NONBLOCK which is
> > > > defined in fcntl.h. Usually O_NONBLOCK is 0x800 too but some
> > > > architectures including MIPS it redefine it:
> > > >
> > > > arch/mips/include/asm/fcntl.h:#define O_NONBLOCK 0x0080
> > > > arch/alpha/include/asm/fcntl.h:#define O_NONBLOCK 00004
> > > > arch/sparc/include/asm/fcntl.h:#define O_NONBLOCK 0x4000
> > > > arch/parisc/include/asm/fcntl.h:#define O_NONBLOCK 000200004
> > > >
> > > > My tests show that kernel thinks that TFD_NONBLOCK is 0x80 on MIPS. I
> > > > get what I want when I pass 0x80 and EINVAL when I pass 0x800. I don't
> > > > know why there are such uncertain things in Linux. Probably the problem
> > > > should be fixed in the kernel.
> > > >
> > > > Right now one cannot use timerfd_create(..., TFD_NONBLOCK) on MIPS but
> > > > can use timerfd_create(..., O_NONBLOCK) instead.
> > >
> > > Ther kernel definition (include/linux/timerfd.h) maps it directly to
> > > O_NONBLOCK, but I am noticing that glibc bolt in the value.
> > > I don't think this is a kernel fix.
> >
> > Yes, but linux/timerfd.h is not installed so timerfd.h from *libc
> > cannot include it. So adding it to include/linux/Kbuild would be a
> > first step to make them not hard-code the value. Right?
>
> Glibc seems to wrap many files with their own definition.
> I am not sure why they are actually doing it, but they must have a valid
> reason.
> It probably makes sense to just un-bolt the values from sys/timerfd.h and
> link them to O_* values from fcntl.h.
Great! This is probably the simplest solution. Hope they'll use it.
However, I'm still curious why the value O_NONBLOCK value is
architecture-specific?
--
Alexander
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-01-28 10:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-28 0:24 timerfd incompatibility on mips Alexander Gordeev
2011-01-28 0:53 ` Davide Libenzi
2011-01-28 1:24 ` Alexander Gordeev
2011-01-28 1:49 ` Davide Libenzi
2011-01-28 10:17 ` Alexander Gordeev
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).