From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) by sourceware.org (Postfix) with ESMTPS id 2C8DC39551E8 for ; Tue, 13 Apr 2021 21:04:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2C8DC39551E8 Received: by mail-qk1-x729.google.com with SMTP id d15so6392319qkc.9 for ; Tue, 13 Apr 2021 14:04:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pVgMEo0FaQwmhh6UbtmCyGL/zXpm+6JnXIod55/QXUc=; b=t6nx6soiOiAu8SkGrNsH9WjuRFluRr6l3FT+iugJicO/KP4NCsVY0Ep9yJHv9R42vY AVq99M0J6yXMqfE37DW1zjO9oNl7EK/uBU0rVZbYU8HeOBP+B/J2QgAX/MdFttVmV5W0 ktAyRDMaleJn2GnqfQEO73+qwjhS01V/g6v/rD8C9B44gBAQUm4LxZ1C5rOkCgZPif1g 1qa+6wkuRpHRnIg5dRTDi1mETDfg/6xhY8mDExL5xAt97y2o+sCaSdSgBWolYzT6L0La mQwYXG1vl8GXFT/5sfAkGGPNKNXEtwtNOcXrBgQ1phvZVJmWAlX532v7tpkSKPeTH9X8 WpZw== X-Gm-Message-State: AOAM533HXArruNXikW7CQ3m0wJ5nctwaRplnW0hjMPv60xQ3aCJ1v28V MlFNzl7JBhl2bqmsGplwDTcTzML7ll0g9Woi X-Google-Smtp-Source: ABdhPJwDA7jjgIAhMVfFF5xhY5iaG4ceZcnYW5THqnjKYOMI8A+gtdjQLiBXkAsJ4FCx/wLmEK/0lA== X-Received: by 2002:a05:620a:6a9:: with SMTP id i9mr33153260qkh.344.1618347853615; Tue, 13 Apr 2021 14:04:13 -0700 (PDT) Received: from localhost.localdomain ([177.194.41.149]) by smtp.googlemail.com with ESMTPSA id g8sm10003383qtm.29.2021.04.13.14.04.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 14:04:13 -0700 (PDT) From: Adhemerval Zanella To: libc-stable@sourceware.org Subject: [PATCH 2.33 COMMITTED 4/6] libsupport: Add support_select_normalizes_timeout Date: Tue, 13 Apr 2021 18:04:03 -0300 Message-Id: <20210413210405.913196-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210413210405.913196-1-adhemerval.zanella@linaro.org> References: <20210413210405.913196-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-stable@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-stable mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Apr 2021 21:04:15 -0000 It will be used on a select() test. (cherry-pick from commit 49a40ba18e2cb948259771317fe6ff6f5eb68683) --- 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 4fd76b0e5e..fc5d9d4c79 100644 --- a/support/Makefile +++ b/support/Makefile @@ -68,6 +68,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 9c9612644a..8c7890e0a6 100644 --- a/support/support.h +++ b/support/support.h @@ -134,6 +134,10 @@ extern ssize_t support_copy_file_range (int, off64_t *, int, off64_t *, 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..987f9b035e --- /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 + . */ + +#include + +bool +support_select_normalizes_timeout (void) +{ +#ifdef __linux__ + return true; +#else + return false; +#endif +} -- 2.27.0