public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sys/types.h: Define new types: [s]nseconds_t
@ 2021-12-07 11:19 Alejandro Colomar
  2021-12-07 12:36 ` Andreas Schwab
                   ` (7 more replies)
  0 siblings, 8 replies; 46+ messages in thread
From: Alejandro Colomar @ 2021-12-07 11:19 UTC (permalink / raw)
  To: libc-alpha
  Cc: Alejandro Colomar, наб,
	Jakub Wilk, Zack Weinberg, Stefan Puiu, Michael Kerrisk

For symmetry with the existing [s]useconds_t types.

The timespec(3) structure uses long for tv_nsec,
except if __x86_64__ && __ILP32__,
in which case it uses long long.
Let's define a stable type that can be relied upon by users,
for example for creating pointers.

Cc: наб <nabijaczleweli@nabijaczleweli.xyz>
Cc: Jakub Wilk <jwilk@jwilk.net>
Cc: Zack Weinberg <zackw@panix.com>
Cc: Stefan Puiu <stefan.puiu@gmail.com>
Cc: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 posix/sys/types.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/posix/sys/types.h b/posix/sys/types.h
index 477a45f4af..147e2d3500 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -140,6 +140,14 @@ typedef __suseconds_t suseconds_t;
 # endif
 #endif
 
+#if defined __x86_64__ && defined __ILP32__
+typedef unsigned long long nseconds_t;
+typedef long long snseconds_t;
+#else
+typedef unsigned long nseconds_t;
+typedef long snseconds_t;
+#endif
+
 #define	__need_size_t
 #include <stddef.h>
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2021-12-09 20:40 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 11:19 [PATCH] sys/types.h: Define new types: [s]nseconds_t Alejandro Colomar
2021-12-07 12:36 ` Andreas Schwab
2021-12-07 13:17 ` наб
2021-12-07 18:20   ` Alejandro Colomar (man-pages)
2021-12-07 21:48     ` наб
2021-12-07 19:10   ` Joseph Myers
2021-12-07 15:50 ` Zack Weinberg
2021-12-07 18:24   ` Alejandro Colomar (man-pages)
2021-12-07 21:48 ` [RFC v2 1/2] sys/types.h: Define new type: snseconds_t Alejandro Colomar
2021-12-07 23:56   ` Joseph Myers
2021-12-08  0:17     ` Paul Eggert
2021-12-08  0:29   ` Rich Felker
2021-12-08  2:26     ` Zack Weinberg
2021-12-08  3:05       ` Rich Felker
2021-12-08 14:34         ` Zack Weinberg
2021-12-08 17:38           ` Rich Felker
2021-12-08 19:52             ` Zack Weinberg
2021-12-08 18:15           ` Adhemerval Zanella
2021-12-08 21:41           ` Joseph Myers
2021-12-07 22:05 ` [RFC v2 2/2] sys/types.h: struct timespec: Use snseconds_t for tv_nsec Alejandro Colomar
2021-12-08 14:47 ` [RFC v3 1/3] bits/types[izes].h: Define new internal type: __snseconds_t Alejandro Colomar
2021-12-08 14:47 ` [RFC v3 2/3] sys/types.h: struct timespec: Use __snseconds_t for tv_nsec Alejandro Colomar
2021-12-08 14:53   ` Zack Weinberg
2021-12-08 15:17     ` Alejandro Colomar (man-pages)
2021-12-08 15:24     ` Joseph Myers
2021-12-08 15:47       ` Alejandro Colomar (man-pages)
2021-12-08 15:59       ` Zack Weinberg
2021-12-08 17:44         ` Rich Felker
2021-12-08 14:48 ` [RFC v3 3/3] sys/types.h: Make snseconds_t user visible Alejandro Colomar
2021-12-08 14:55   ` Zack Weinberg
2021-12-08 15:15     ` Alejandro Colomar (man-pages)
2021-12-08 18:12   ` Paul Eggert
2021-12-08 18:25     ` Rich Felker
2021-12-08 20:10       ` Zack Weinberg
2021-12-08 20:34         ` Rich Felker
2021-12-08 21:12         ` Adhemerval Zanella
2021-12-08 21:53           ` Alejandro Colomar (man-pages)
2021-12-09 19:20             ` Adhemerval Zanella
2021-12-09 19:42           ` Paul Eggert
2021-12-09 19:52             ` Adhemerval Zanella
2021-12-09 20:13             ` Joseph Myers
2021-12-09 20:17               ` Rich Felker
2021-12-09 20:23             ` Alejandro Colomar (man-pages)
2021-12-09 20:29               ` Joseph Myers
2021-12-09 20:34                 ` Alejandro Colomar (man-pages)
2021-12-09 20:40                   ` Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).