From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) by sourceware.org (Postfix) with ESMTPS id 21E2C3858D32 for ; Mon, 29 May 2023 17:39:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 21E2C3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-5559cd68b67so1763572eaf.3 for ; Mon, 29 May 2023 10:39:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685381988; x=1687973988; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=VdojX2naJUoH47K1xfE1XJuthUspPr30ZNulELGRRiw=; b=BSAI1dkdH4fRjjRhyiuWsfIKS6Y9hIrpmgjWly9Bu/qAzmkKnOcT8We+Dg9Yfs+PJ7 0Lr4+Rgcfa+8kY7LEMkBjL33vB7PddBvMxkjob1yoihsQICXOtFHTLDp1kgoVEXipI2N +EJ9fKbEETd5mdcJzZoBAu5ReFCrC4KqYy8aC7TVV87fqvIRYcKN0H5H7UwkM2oe+uKR mdE0l3oOiyCZBePg//zojeq3KzaSsttQTds9h7T3NtRiYQ6P+XNDmne1TeMpdAIyXhjN I7GNPloFwkTluAAGGs3LHpP480PTa+aYfdmaEpA49qGIXsaScCLF9ggo4obKTMyHkrVU 8c+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685381988; x=1687973988; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VdojX2naJUoH47K1xfE1XJuthUspPr30ZNulELGRRiw=; b=OpFByvJTvAxLWonY2U+sJmVdjIzvjJ8A3fYm3PYRX8budJ/f8fGeQaqK0vWUQg+Q8f IsnCjbg1k/xi82+H6IknaVikv75wUkYJaGZYm/myqVLHUXM7zPVtkuPK6+0qvqPZ6ey4 coRlgvFq4/rahiMslPgBL4jI/WrOZyRvdwPYbwwyWLosgWCzNW6e8oyn9XAQ17vn1WdA NxUluAqvm9dnEOu6rAY5JxjgvZQXuEuzHifOyLBtr/alpwrsG6nMigt0UN+HKohxmXEO mrETrrgxkXOL3CmZ6Km33QkPQahouVxnWDwLvPlh9/jo/TjL4e1iyuNtuxxVwdxnDjil AwTg== X-Gm-Message-State: AC+VfDw7bIjLnKXxsrm8eTANKxZpoHnnnbbvXiFyRzvS8kGoxcQq88y+ tU0xhFs1s/h1Q8lg8iXP7o+6jQ== X-Google-Smtp-Source: ACHHUZ55C+9KI8fF/ovGDXESdhjpryYSDq7V6hcvlJB5o81QwBXfTKwUr4Pb2QuKwtVKRVcVAr757A== X-Received: by 2002:a4a:4988:0:b0:556:ffe9:3630 with SMTP id z130-20020a4a4988000000b00556ffe93630mr4156536ooa.3.1685381988253; Mon, 29 May 2023 10:39:48 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c1:4dd5:7120:a40d:fc97:d6db? ([2804:1b3:a7c1:4dd5:7120:a40d:fc97:d6db]) by smtp.gmail.com with ESMTPSA id t19-20020a4adbd3000000b0055828dd5a9bsm444985oou.36.2023.05.29.10.39.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 May 2023 10:39:47 -0700 (PDT) Message-ID: <30f8c03c-ecb3-733a-b14c-cf5509356697@linaro.org> Date: Mon, 29 May 2023 14:39:45 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.1 Subject: Re: [PATCH] Use __nonnull for the epoll_wait(2) family of syscalls Content-Language: en-US From: Adhemerval Zanella Netto To: Alejandro Colomar , libc-alpha@sourceware.org Cc: Alejandro Colomar References: <6c399f6b-6e89-17c4-2a56-1219a1b86448@linaro.org> <20230522220120.37208-1-alx@kernel.org> Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: In fact, checking I am seeing a regression: ../sysdeps/unix/sysv/linux/tst-epoll.c: In function ‘do_test’: ../sysdeps/unix/sysv/linux/tst-epoll.c:194:11: error: argument 2 null where non-null expected [-Werror=nonnull] 194 | int r = epoll_pwait2 (-1, NULL, 0, NULL, NULL); | ^~~~~~~~~~~~ In file included from ../include/sys/epoll.h:2, from ../sysdeps/unix/sysv/linux/tst-epoll.c:27: ../sysdeps/unix/sysv/linux/sys/epoll.h:144:12: note: in a call to function ‘epoll_pwait2’ declared ‘nonnull’ 144 | extern int epoll_pwait2 (int __epfd, struct epoll_event *__events, | ^~~~~~~~~~~~ cc1: all warnings being treated as errors And I am not sure why it was not caught by buildbots. The check is only for test for epoll_pwait2 support, so I think it would be simpler to just suppress the warning: diff --git a/sysdeps/unix/sysv/linux/tst-epoll.c b/sysdeps/unix/sysv/linux/tst-epoll.c index 66f091c202..e2fd34e0e6 100644 --- a/sysdeps/unix/sysv/linux/tst-epoll.c +++ b/sysdeps/unix/sysv/linux/tst-epoll.c @@ -18,12 +18,13 @@ #include #include +#include +#include #include #include #include -#include #include -#include +#include #include /* The test focus on checking if the timeout argument is correctly handled @@ -191,7 +192,12 @@ do_test (void) xsigaction (SIGCHLD, &sa, NULL); } + /* The NULL tests here is only to check if epoll_pwait2 is supported by the + kernel and to simplify the rest of test. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (7, "-Wnonnull"); int r = epoll_pwait2 (-1, NULL, 0, NULL, NULL); + DIAG_POP_NEEDS_COMMENT; TEST_COMPARE (r, -1); bool pwait2_supported = errno != ENOSYS; Could you send a v3 with the change? Another possibility is to remove the pwait2_supported and handle it on the test itself (it would require more extensive changes). On 23/05/23 09:27, Adhemerval Zanella Netto wrote: > LGTM, thanks. > > Reviewed-by: Adhemerval Zanella > > On 22/05/23 19:01, Alejandro Colomar wrote: >> Signed-off-by: Alejandro Colomar >> --- >> include/sys/epoll.h | 3 ++- >> sysdeps/unix/sysv/linux/sys/epoll.h | 8 ++++---- >> 2 files changed, 6 insertions(+), 5 deletions(-) >> >> diff --git a/include/sys/epoll.h b/include/sys/epoll.h >> index 8049381a26..b23bc9c7c0 100644 >> --- a/include/sys/epoll.h >> +++ b/include/sys/epoll.h >> @@ -9,7 +9,8 @@ libc_hidden_proto (epoll_pwait) >> #else >> extern int __epoll_pwait2_time64 (int fd, struct epoll_event *ev, int maxev, >> const struct __timespec64 *tmo, >> - const sigset_t *s); >> + const sigset_t *s) >> + __nonnull ((2)); >> libc_hidden_proto (__epoll_pwait2_time64) >> #endif >> >> diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h >> index b17d344e79..23872c9438 100644 >> --- a/sysdeps/unix/sysv/linux/sys/epoll.h >> +++ b/sysdeps/unix/sysv/linux/sys/epoll.h >> @@ -123,7 +123,7 @@ extern int epoll_ctl (int __epfd, int __op, int __fd, >> __THROW. */ >> extern int epoll_wait (int __epfd, struct epoll_event *__events, >> int __maxevents, int __timeout) >> - __attr_access ((__write_only__, 2, 3)); >> + __attr_access ((__write_only__, 2, 3)) __nonnull ((2)); >> >> >> /* Same as epoll_wait, but the thread's signal mask is temporarily >> @@ -134,7 +134,7 @@ extern int epoll_wait (int __epfd, struct epoll_event *__events, >> extern int epoll_pwait (int __epfd, struct epoll_event *__events, >> int __maxevents, int __timeout, >> const __sigset_t *__ss) >> - __attr_access ((__write_only__, 2, 3)); >> + __attr_access ((__write_only__, 2, 3)) __nonnull ((2)); >> >> /* Same as epoll_pwait, but the timeout as a timespec. >> >> @@ -144,7 +144,7 @@ extern int epoll_pwait (int __epfd, struct epoll_event *__events, >> extern int epoll_pwait2 (int __epfd, struct epoll_event *__events, >> int __maxevents, const struct timespec *__timeout, >> const __sigset_t *__ss) >> - __attr_access ((__write_only__, 2, 3)); >> + __attr_access ((__write_only__, 2, 3)) __nonnull ((2)); >> #else >> # ifdef __REDIRECT >> extern int __REDIRECT (epoll_pwait2, (int __epfd, struct epoll_event *__ev, >> @@ -152,7 +152,7 @@ extern int __REDIRECT (epoll_pwait2, (int __epfd, struct epoll_event *__ev, >> const struct timespec *__timeout, >> const __sigset_t *__ss), >> __epoll_pwait2_time64) >> - __attr_access ((__write_only__, 2, 3)); >> + __attr_access ((__write_only__, 2, 3)) __nonnull ((2)); >> # else >> # define epoll_pwait2 __epoll_pwait2_time64 >> # endif