This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Make sys/timerfd.h usable without __USE_POSIX199309


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]