tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: The <signal.h> header shall define the timespec structure as described in <time.h>



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 12.07.2015 19:37, David Holland wrote:
> On Sun, Jul 12, 2015 at 01:12:00PM +0200, Joerg Sonnenberger
> wrote:
>>> What's your alternative? The change is inspired by OpenBSD.
>> 
>> The alternative is to just define timespec in both headers, like
>> we do for a variety of types already (e.g. size_t).
> 
> That or put it in its own header; the current layout of includes
> would make that awkward but it's the best solution in the long
> run.
> 

I'm attaching the patch adding struct timespec to <signal.h>.

Are there any objections to commit it?

It's verified to work.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJVukPZAAoJEEuzCOmwLnZs80EQAITvQDOYPztDvK8G9m+8TZXE
vvSN/amysKVXyaAADU/BPgKTWItcJkaB7jvwigvi/B9TRpogZBlH3PyRGEWdak6a
BXmG+5S4fnVhb2CeZa+/Dk+2EmUQkKl4Z9JVuIOis1bDFJGADavoWbD4PfMTPXk2
1z5HXAhgP11eUVdA6dNrlXF9dINSSO5moR/Qbb/9dpDG5Y+DCWRMjpeBjnaBTUnx
vIoaGcK2yqiuofKSjEVj2ickRb6FqgiXrBzr6UZYKJ+uYdEZGVGVVowI6yh2NqcK
Dtmj34mDYjLIzBptICR7dtOMIIHZHQNtlLfkKPydiFAm5zBw11s+CRW7cUzw/Zb1
jfZnejHKd6FL8+ImH/9vZWQCWQLA3eQ0BezfwCok7lA/JJ7nqI51yx2FdP73OMdS
pfWnllPZ8F8v6VRueLk3uSEmGIXAObZYcH7+NLDbrez/kn32uerf54q7b2lpUaHs
xCwkRhqWGwJwdDIpTHnnNOvzO/dbqnXox5onkL9dfYCcx9VVmMoLo+u+qUcQQSsh
JjBiEu+aYBtWUfRaeB8H2x8rDQcGx4zPCdh7cm9hC0vN4FWnYaqdajlohM3Iu9ik
LfmWc3AnQwofcHaR9Fl7G5CICq978+F40tNbiH9xQWeqEhMZ1jTmtKtuuLQgUr+S
RD91tzlsOOQFsjQMrvM0
=532T
-----END PGP SIGNATURE-----
Index: include/signal.h
===================================================================
RCS file: /public/netbsd-rsync/src/include/signal.h,v
retrieving revision 1.54
diff -u -r1.54 signal.h
--- include/signal.h	27 Aug 2010 08:40:38 -0000	1.54
+++ include/signal.h	30 Jul 2015 14:32:27 -0000
@@ -183,7 +183,22 @@
 void	psiginfo(const siginfo_t *, const char *);
 
 #ifndef __LIBC12_SOURCE__
-struct timespec;
+/*
+ * Structure defined by POSIX.1b to be like a timeval.
+ * 
+ * 'The <signal.h> header shall define the timespec structure as described in
+ * <time.h>.'
+ * The Open Group Base Specifications Issue 7
+ * IEEE Std 1003.1, 2013 Edition
+ */
+#ifndef __timespec_is_defined
+#define __timespec_is_defined
+struct timespec {
+        time_t  tv_sec;         /* seconds */
+        long    tv_nsec;        /* and nanoseconds */
+};
+#endif
+
 int	sigtimedwait(const sigset_t * __restrict,
     siginfo_t * __restrict, const struct timespec * __restrict)
     __RENAME(__sigtimedwait50);
Index: sys/sys/time.h
===================================================================
RCS file: /public/netbsd-rsync/src/sys/sys/time.h,v
retrieving revision 1.69
diff -u -r1.69 time.h
--- sys/sys/time.h	19 May 2015 23:35:11 -0000	1.69
+++ sys/sys/time.h	30 Jul 2015 14:33:01 -0000
@@ -49,10 +49,13 @@
 /*
  * Structure defined by POSIX.1b to be like a timeval.
  */
+#ifndef __timespec_is_defined
+#define __timespec_is_defined
 struct timespec {
 	time_t	tv_sec;		/* seconds */
 	long	tv_nsec;	/* and nanoseconds */
 };
+#endif
 
 #if defined(_NETBSD_SOURCE)
 #define	TIMEVAL_TO_TIMESPEC(tv, ts) do {				\


Home | Main Index | Thread Index | Old Index