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]

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


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.

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.
---
[1] http://bugs.debian.org/641512

 sysdeps/unix/sysv/linux/sparc/sys/timerfd.h |    4 ++--
 sysdeps/unix/sysv/linux/sys/timerfd.h       |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/sparc/sys/timerfd.h b/sysdeps/unix/sysv/linux/sparc/sys/timerfd.h
index 833d050f..e49d79a5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sys/timerfd.h
+++ b/sysdeps/unix/sysv/linux/sparc/sys/timerfd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2008, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -43,7 +43,7 @@ enum
 __BEGIN_DECLS
 
 /* Return file descriptor for new interval timer source.  */
-extern int timerfd_create (clockid_t __clock_id, int __flags) __THROW;
+extern int timerfd_create (__clockid_t __clock_id, int __flags) __THROW;
 
 /* Set next expiration time of interval timer source UFD to UTMR.  If
    FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is
diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h b/sysdeps/unix/sysv/linux/sys/timerfd.h
index c1bb06f5..3a567ff1 100644
--- a/sysdeps/unix/sysv/linux/sys/timerfd.h
+++ b/sysdeps/unix/sysv/linux/sys/timerfd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2008, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -43,7 +43,7 @@ enum
 __BEGIN_DECLS
 
 /* Return file descriptor for new interval timer source.  */
-extern int timerfd_create (clockid_t __clock_id, int __flags) __THROW;
+extern int timerfd_create (__clockid_t __clock_id, int __flags) __THROW;
 
 /* Set next expiration time of interval timer source UFD to UTMR.  If
    FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is
-- 
1.7.6


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