This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
[PATCH glibc-ports] Make sys/timerfd.h usable without __USE_POSIX199309
- From: Jonathan Nieder <jrnieder at gmail dot com>
- To: libc-ports at sourceware dot org
- Cc: Josh Triplett <josh at joshtriplett dot org>, Joseph Myers <joseph at codesourcery dot com>
- Date: Wed, 14 Sep 2011 12:57:21 -0500
- Subject: [PATCH glibc-ports] Make sys/timerfd.h usable without __USE_POSIX199309
- References: <20110914033839.4277.94420.reportbug@leaf> <20110914050207.GA2884@elie>
Josh Triplett noticed that when compiling with -std=c99, the clockid_t
type is unavailable, provoking compilation failures when sys/timerfd.h
is included without including sys/types.h first:
$ cat timerfdtest.c
#include <sys/timerfd.h>
$ 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â
Fix it by using __clockid_t in prototypes.
Probably this wasn't caught before because when compiling without
-std=anything, features.h falls back to a reasonably recent version of
POSIX that provides clockid_t in time.h,
This patch only affects the alpha and mips ports. A separate patch
would fix the default timerfd.h header on Linux in the main glibc
repo.
---
Jonathan Nieder wrote[1]:
> How about this patch?
Here's the corresponding patch for glibc-ports. Thoughts of all kinds
welcome, of course.
Thanks,
Jonathan
[1] http://thread.gmane.org/gmane.comp.lib.glibc.alpha/16687
ChangeLog.alpha | 5 +++++
ChangeLog.mips | 5 +++++
sysdeps/unix/sysv/linux/alpha/sys/timerfd.h | 4 ++--
sysdeps/unix/sysv/linux/mips/sys/timerfd.h | 4 ++--
4 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/ChangeLog.alpha b/ChangeLog.alpha
index 55f87689..e2afcf45 100644
--- a/ChangeLog.alpha
+++ b/ChangeLog.alpha
@@ -1,3 +1,8 @@
+2011-09-14 Jonathan Nieder <jrnieder@gmail.com>
+
+ * sysdeps/unix/sysv/linux/alpha/sys/timerfd.h (timerfd_create): Use
+ __clockid_t instead of clockid_t.
+
2011-03-28 Aurelien Jarno <aurelien@aurel32.net>
* sysdeps/unix/sysv/linux/alpha/____longjmp_chk.S(____longjmp_chk):
diff --git a/ChangeLog.mips b/ChangeLog.mips
index 8da2af2f..c6a6d355 100644
--- a/ChangeLog.mips
+++ b/ChangeLog.mips
@@ -1,3 +1,8 @@
+2011-09-14 Jonathan Nieder <jrnieder@gmail.com>
+
+ * sysdeps/unix/sysv/linux/mips/sys/timerfd.h (timerfd_create): Use
+ __clockid_t instead of clockid_t.
+
2011-09-13 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/mips/bits/socket.h (__cmsg_nxthdr): Cast
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h b/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h
index 09d6ccf6..dfc6a1e0 100644
--- a/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h
+++ b/sysdeps/unix/sysv/linux/alpha/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/mips/sys/timerfd.h b/sysdeps/unix/sysv/linux/mips/sys/timerfd.h
index ebd37ff4..4ffed0ee 100644
--- a/sysdeps/unix/sysv/linux/mips/sys/timerfd.h
+++ b/sysdeps/unix/sysv/linux/mips/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