From patchwork Fri Apr 9 15:53:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 42938 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9A241399C02A; Fri, 9 Apr 2021 15:53:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A241399C02A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1617983635; bh=tiWdFgHO3PMVgIssnSKnWz4ET9gGdjtLP4u5/9EpEWk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=gbDhEZC1z5Hvuyd8CHkDPjxTs7qgMvrGDkGenwVlyjKwg6vln4/GjbipfpS6UkkJH MOglpcauQLPsRQsNy5YvYKMNgKu9zh68AYUvJoqZZnw1JTU+hv0Xy8BOJ9GwuW4Drk H7VGr9o9w53qv2OVZJ8nzd6M42YvVNPZQH/hUOkA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by sourceware.org (Postfix) with ESMTPS id E17A3398EC05 for ; Fri, 9 Apr 2021 15:53:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E17A3398EC05 Received: by mail-qt1-x833.google.com with SMTP id c6so4522198qtc.1 for ; Fri, 09 Apr 2021 08:53:52 -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=tiWdFgHO3PMVgIssnSKnWz4ET9gGdjtLP4u5/9EpEWk=; b=HdNda+MQ5FfrIqruLhyJ6BaAg4Tjwx/1rJpUlzgmPz7vPphhReupETVNyfMTOJW5oN sQFgxUrVtBOgqbrAdUdMb1T3vlsLkF7MmDvFTUWOVk51fdVq9vu30xhkc486s8Jkrnzh Jd7ZMyyg7EVysItG8OgeNrvTlE2kr8lSpBJ5TBu2ZR2+IzJN/jyXNxsO8nPguPvRCj9Q vypGX2bsT+PcKDXp9FKDXsGdVloonrxIkhbw87r9rpyl4B3kN5mjkByo+ipsBVsbivNJ Ye2sfJr/ixxO2ribG7sIR74z3Zjr/hZj5nB+YctUa0Q27vu07zQd3n+/9UOAbu97RWUk /oTg== X-Gm-Message-State: AOAM532msmGsCNm2u8LlkGkw2AHFserzor35A5BadPrs7C0fAi6gJgyL gqq4NUEN7+Cj6uxPXQ6MHNF74Frv3qLRnEgr X-Google-Smtp-Source: ABdhPJx+qPOkb2qBn3rFi8w2MM9G6cL2aB5oF8wY9g8mZytCV/voT4Q4DMDVnRbSidPTFzJmbOXDqw== X-Received: by 2002:ac8:7776:: with SMTP id h22mr13693513qtu.325.1617983632326; Fri, 09 Apr 2021 08:53:52 -0700 (PDT) Received: from localhost.localdomain ([177.194.41.149]) by smtp.googlemail.com with ESMTPSA id 79sm2087632qki.37.2021.04.09.08.53.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 08:53:52 -0700 (PDT) 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 Message-Id: <20210409155346.1357023-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210409155346.1357023-1-adhemerval.zanella@linaro.org> References: <20210409155346.1357023-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 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-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" 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 + . */ + +#include + +bool +support_select_normalizes_timeout (void) +{ +#ifdef __linux__ + return true; +#else + return false; +#endif +}