This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Make sys/timerfd.h usable without __USE_POSIX199309
- From: Josh Triplett <josh at joshtriplett dot org>
- To: Jonathan Nieder <jrnieder at gmail dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 13 Sep 2011 22:52:59 -0700
- Subject: Re: [PATCH] Make sys/timerfd.h usable without __USE_POSIX199309
- References: <20110914033839.4277.94420.reportbug@leaf><20110914050207.GA2884@elie>
On Wed, Sep 14, 2011 at 12:02:07AM -0500, Jonathan Nieder wrote:
> Josh Triplett wrote[1]:
>
> > /tmp$ cat timerfdtest.c
> > #include <sys/timerfd.h>
> > /tmp$ gcc -std=c99 -c timerfdtest.c -o /dev/null
> > In file included from timerfdtest.c:1:0:
> > /usr/include/x86_64-linux-gnu/sys/timerfd.h:46:28: error: unknown type name âclockid_tâ
> >
> > Compiles fine without -std=c99.
>
> When compiling without -std=anything, features.h falls back to a
> reasonably recent version of POSIX which provides clockid_t in time.h.
> Another way to hide the problem is to include sys/types.h before
> sys/timerfd.h in application code.
I see; that makes sense.
> How about this patch?
>
> 2011-09-13 Jonathan Nieder <jrnieder@gmail.com>
>
> * sysdeps/unix/sysv/linux/sys/timerfd.h (timerfd_create): Use
> __clockid_t instead of clockid_t.
> * sysdeps/unix/sysv/linux/sparc/sys/timerfd.h (timerfd_create):
> Likewise.
Your patch looks reasonable; since most people won't actually need to
declare a variable of type clockid_t, it should suffice for most
programs.
Thanks,
Josh Triplett