Received: by 10.213.65.68 with SMTP id h4csp624565imn; Wed, 4 Apr 2018 04:38:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx48KH9ZcBtiRc+kuEMBFgstf4ugrKuCTgl+Av04mQI1d4WnUGbLdrVV/6ub3jKnXuLwGoqOS X-Received: by 2002:a17:902:bf4a:: with SMTP id u10-v6mr16895073pls.120.1522841936078; Wed, 04 Apr 2018 04:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522841936; cv=none; d=google.com; s=arc-20160816; b=0i9wWcTKdmEafKEG6eKHzVhTB3Tq7lEm1ePv1IF95EmWQ8xq00OLUexjAFRTxr4AfT IEOaAE91PdOoyxxu6y3hg4wQlpF5gmWUOMNwfD1NUo0rYWbEdCJpp5dZ8ygrus2y4dmG zoMZDkulXgafEHKGnlieUEIggvdvtiXnbnP4VVStRQx4mwp87yEAuIe62ts1z4igqq0B g5Aq/Wkg1jdix4OFo0jIrxPPqmgRVZRiRvR0ZVUGhgRYK1On37MWP1CA8v9g+CI9biuG U82lvNumO64/uKrMF+VhUGfFvAj+tLfk71sUc+ykQ3gjGyl0UANL97YtZNBwStH2GpzZ FvCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=U6E7i5e9JtdzDFI6fm3zC6iwoWWInBTaidcE4Rig4YQ=; b=IgL9JyM2s78MtGZFOBJlIj6lg9Lqhqw5v8MSCwmK8SAeAx/iiBNR04ThL2El4BD2pE cjfbWb10HrVE0X+kgW7FwFeZOTBj/2FKXGrfQan7V094Ey6vjx3IvGm9Tu2iK2/wIAaC VC+Hu0hZUm9bE+AgFI48cD8e8F2tHmAcysD+e/dgWpuPk0U6QU5ASegAPCyZx/weOPRj cK0as0+oRTm7NfiPhFBkz9uYtKQquOjc5iItQdO2EX28MxT992zdbPMG0kRuF5FQ99PS gVi24Tr/g8g3jADuz3irSnXiDZop+1XvciVXp26tirzrMz+DXbp9hwrspBA2uZKSqjFR lazQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e592dfHc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11-v6si3019161pla.724.2018.04.04.04.38.41; Wed, 04 Apr 2018 04:38:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e592dfHc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751672AbeDDLgV (ORCPT + 99 others); Wed, 4 Apr 2018 07:36:21 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:33120 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751573AbeDDLgT (ORCPT ); Wed, 4 Apr 2018 07:36:19 -0400 Received: by mail-pl0-f68.google.com with SMTP id s10-v6so11569692plp.0 for ; Wed, 04 Apr 2018 04:36:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=U6E7i5e9JtdzDFI6fm3zC6iwoWWInBTaidcE4Rig4YQ=; b=e592dfHc8VzFZImuatP9RK8m0mVOVBfakZtgWQYZ8to575YGQnHhI0KEKYogcXAPka FvLYTJJE6kenOejkWb84VQ6Or0sUAI6CtpLwNU9JTDrDxKDUjNh9amJXSOGaPcyTKmBj VQBFidhebA4DV3PrrWjCu4Kj2fPzJ70JCdpcM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=U6E7i5e9JtdzDFI6fm3zC6iwoWWInBTaidcE4Rig4YQ=; b=XGDOdmnC0hxtSgmNjR7b15Vf8Ccvh2FJGd73omwyYtsDgNonUw5lpTasDAhx7fBRTg smuHPCVgmhpETb5IoqlstqRIaQ56l/BPiAisBQqWNeRZDx22Opv4fR1TEVAJaCtw8kax no3Dtyu4JhuGvVfuRT9S0PYcbFfCVxTs2u6QAIDMjyWuqBs35EZm6dqSZHLAmbIdAzY8 abGRdYbOtqutjbRPZgq+dJYy99Y1/zHH70PwEZRmgWORBoU5sP33FAp1LQcnqplyt598 vEMm97/42QmpnJKjY2/XPlFawS1kDHox+BhH7/rYyhBaU5adWTkiafSJ9w8yupPySDl/ 86lw== X-Gm-Message-State: AElRT7FUPPQTZ6OKE8XsVoI80Pcwf/JFVq6zOM1gkQF4nh87Gm2psxtJ 5SV7rMZ5cGi/B2KDRzbHLGgjntR+HLJ4ikGBoatTKA== X-Received: by 2002:a17:902:464:: with SMTP id 91-v6mr18097393ple.126.1522841779245; Wed, 04 Apr 2018 04:36:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.137.1 with HTTP; Wed, 4 Apr 2018 04:36:18 -0700 (PDT) In-Reply-To: References: <20180313114205.27714-1-anders.roxell@linaro.org> From: Anders Roxell Date: Wed, 4 Apr 2018 13:36:18 +0200 Message-ID: Subject: Re: [PATCH 1/2] selftests/memfd/memfd_test.c: fix implicit declaration To: Mike Kravetz Cc: shuah@kernel.org, linux-kselftest@vger.kernel.org, Linux Kernel Mailing List , David Herrmann Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14 March 2018 at 02:09, Mike Kravetz wrote: > On 03/13/2018 04:42 AM, Anders Roxell wrote: >> gcc warns about implicit declaration. >> >> gcc -D_FILE_OFFSET_BITS=3D64 -I../../../../include/uapi/ >> -I../../../../include/ -I../../../../usr/include/ >> memfd_test.c common.o -o memfd_test >> memfd_test.c: In function =E2=80=98mfd_assert_get_seals=E2=80=99: >> memfd_test.c:74:6: warning: implicit declaration of function =E2=80=98fc= ntl=E2=80=99 >> [-Wimplicit-function-declaration] >> r =3D fcntl(fd, F_GET_SEALS); >> ^~~~~ >> memfd_test.c: In function =E2=80=98mfd_assert_open=E2=80=99: >> memfd_test.c:197:6: warning: implicit declaration of function =E2=80=98o= pen=E2=80=99 >> [-Wimplicit-function-declaration] >> r =3D open(buf, flags, mode); >> ^~~~ >> memfd_test.c: In function =E2=80=98mfd_assert_write=E2=80=99: >> memfd_test.c:328:6: warning: implicit declaration of function =E2=80=98f= allocate=E2=80=99 >> [-Wimplicit-function-declaration] >> r =3D fallocate(fd, >> ^~~~~~~~~ >> >> In the current code, we include the headers that the functions want >> according to the man pages, and we add some defines that will be used if >> they isn't found in glibc. The defines was added into the kernel source >> in kernel >=3D 3.16 and glibc requires kernel header files >=3D 3.2. >> >> Fixes: 4f5ce5e8d7e2 ("selftests: add memfd_create() + sealing tests") >> Signed-off-by: Anders Roxell >> --- >> tools/testing/selftests/memfd/memfd_test.c | 25 +++++++++++++++++++++++= +- >> 1 file changed, 24 insertions(+), 1 deletion(-) >> >> diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/= selftests/memfd/memfd_test.c >> index 10baa1652fc2..0dbeb29c094c 100644 >> --- a/tools/testing/selftests/memfd/memfd_test.c >> +++ b/tools/testing/selftests/memfd/memfd_test.c >> @@ -6,7 +6,6 @@ >> #include >> #include >> #include >> -#include >> #include >> #include >> #include >> @@ -14,13 +13,37 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> +#include >> #include > > I suspect there is some guiding philosophy for selftests that I am > unfamiliar with. However, it seems that tests should use as much > of the header files in the current kernel source tree as possible. > This change removes the include of a header in the current source > tree . It replaces that with the header > from the host system (and some other changes). > > To me, this seems like step in the wrong direction. But, I could > be totally wrong and perhaps self tests should primarily target the > host system header files. So in a way I agree with you. However, what was the design decisions internal kernel headers vs. headers from Host System ? For me it isn't clear how/when we use them, its a mix today is it not? To ignore warnings with -Wno-implicit-function-declaration wont be an alternative I think. Cheers, Anders > -- > Mike Kravetz