From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Subject: [PATCH v3 2/4] libsupport: Add support_select_normalizes_timeout
Date: Fri, 9 Apr 2021 12:53:44 -0300 [thread overview]
Message-ID: <20210409155346.1357023-2-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20210409155346.1357023-1-adhemerval.zanella@linaro.org>
It will be used on a select() test.
---
support/Makefile | 1 +
support/support.h | 4 +++
support/support_select_normalizes_timeout.c | 29 +++++++++++++++++++++
3 files changed, 34 insertions(+)
create mode 100644 support/support_select_normalizes_timeout.c
diff --git a/support/Makefile b/support/Makefile
index 91457d8613..da6dc58d37 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -69,6 +69,7 @@ libsupport-routines = \
support_record_failure \
support_run_diff \
support_select_modifies_timeout \
+ support_select_normalizes_timeout \
support_set_small_thread_stack_size \
support_shared_allocate \
support_small_stack_thread_attribute \
diff --git a/support/support.h b/support/support.h
index f730611841..db264e3db7 100644
--- a/support/support.h
+++ b/support/support.h
@@ -148,6 +148,10 @@ extern bool support_stat_nanoseconds (const char *path);
no slept. */
extern bool support_select_modifies_timeout (void);
+/* Return true if select normalize the timeout input by taking in account
+ tv_usec larger than 1000000. */
+extern bool support_select_normalizes_timeout (void);
+
__END_DECLS
#endif /* SUPPORT_H */
diff --git a/support/support_select_normalizes_timeout.c b/support/support_select_normalizes_timeout.c
new file mode 100644
index 0000000000..5dcf5dcbfc
--- /dev/null
+++ b/support/support_select_normalizes_timeout.c
@@ -0,0 +1,29 @@
+/* Return whether select normalizes the timeout.
+ Copyright (C) 2021 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdbool.h>
+
+bool
+support_select_normalizes_timeout (void)
+{
+#ifdef __linux__
+ return true;
+#else
+ return false;
+#endif
+}
--
2.27.0
next prev parent reply other threads:[~2021-04-09 15:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-09 15:53 [PATCH v3 1/4] libsupport: Add support_select_modifies_timeout Adhemerval Zanella
2021-04-09 15:53 ` Adhemerval Zanella [this message]
2021-04-09 16:24 ` [PATCH v3 2/4] libsupport: Add support_select_normalizes_timeout Florian Weimer
2021-04-09 15:53 ` [PATCH v3 3/4] linux: Normalize and return timeout on select (BZ #27651) Adhemerval Zanella
2021-04-12 8:28 ` Andreas Schwab
2021-04-12 12:20 ` Adhemerval Zanella
2021-04-12 18:26 ` Adhemerval Zanella
2021-04-12 19:20 ` Andreas Schwab
2021-04-09 15:53 ` [PATCH v3 4/4] linux: always update select timeout (BZ #27706) Adhemerval Zanella
2021-04-09 16:23 ` [PATCH v3 1/4] libsupport: Add support_select_modifies_timeout Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210409155346.1357023-2-adhemerval.zanella@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).