Received: by 10.213.65.68 with SMTP id h4csp684570imn; Tue, 13 Mar 2018 18:10:27 -0700 (PDT) X-Google-Smtp-Source: AG47ELv3DvlDBsjxr4uWFfbr3qANyLCNm73spqV4Dwc9+9t4qZJrfNFBmfBwXk9gIfK4vC2rD4Y0 X-Received: by 10.99.56.68 with SMTP id h4mr2070369pgn.230.1520989827785; Tue, 13 Mar 2018 18:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520989827; cv=none; d=google.com; s=arc-20160816; b=GDCPEDiLmk0/U+glUS+JUawXVUnf0UeHe0Snb+e2c+H8vClaXi2XUMh/J9pf1uLgcF iC0w23uvoPhGtzAzSBO/wdSsDk+9uErw0d06Ip/PF7T9Avpx4fs0SsKffRCbU9uGcwLv /CexhdHoZzq5KslDVIYVA14qZrmnyofUsmqbhyUmBF25tBOJ2SGrUR56OjmFnOu8j1L+ 7l009+1s2M7FIwynCDlsG4rEYOmYpIZLIQeo+iKQitEX1KNokHoEJi5ivfcPGF0o70yI EKnCrdpR4V2bRb0lihZ5BpiTZLxwysMgEJbGbU3lPOsgxrD6wfpmHPrVL1ql3v03j93G WrqQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=MABAs4KXZp/1sfpuCl0a9g6ppCZsgrEpfguee2yjpOk=; b=udeIRU1CVVi30rlDLblK8Zh/5dJx+BsyfSAcpfqM4qkmR9ll+ZiL459a3nEVBcckJd uGtywyobJsgEDXoUGVL800D3q51Ff+fvSJo5mIqzGYrmZ/sjgtrNhNyvk6MmXP481CsZ 0d6U+ab6mFY89L7/2J3Wg8axk9uyHhqf9+A5n3IavEdH+RDyqwZ4cwH34v0wAEeDbpwg GdiUe/zFDNQcw3b9iJ36uYDs96mvV0IEZRNj7jL2msmtMk+DcVE7X17efUpFgN1Znefx 6t0usm5lepazX6hPg7dUxvPTqzxzOXU5SO7/LXlG6YAPgDtXwmVSP4iRpUWgzV8CRYuD NMqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=VdJQH7vW; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z13si1055115pfh.217.2018.03.13.18.10.13; Tue, 13 Mar 2018 18:10:27 -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=@oracle.com header.s=corp-2017-10-26 header.b=VdJQH7vW; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932923AbeCNBJU (ORCPT + 99 others); Tue, 13 Mar 2018 21:09:20 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:35544 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932590AbeCNBJS (ORCPT ); Tue, 13 Mar 2018 21:09:18 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2E16dpA070829; Wed, 14 Mar 2018 01:09:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=MABAs4KXZp/1sfpuCl0a9g6ppCZsgrEpfguee2yjpOk=; b=VdJQH7vWgzHsZT+M4onYd3M3w9/RRO/SUZ9rgV7+u+et0Xizc3h9mBSMB/lUifqSB2PJ GtvgyD8kveG9XnKHC2dMtHo70gtglRAhjRPVjUr2n29sEHklaZ6qGI19ubHCP+CXokSh 1KkPoHP/KLQowCBRXKhWO5XkdKHJ2Jqa7FaryBtMPgTcKXdKxLF/pYFUF6JQ1aj3H/GI ehRX+E0/+TDQ82xiVHPXkNtIXT+MkWAYIDZmhtci77L+dSNWQWx2yW7/AAc1kkYY3NA1 C+1A5iGzTSBK6Xw67mORY7P7qd9kBk5J6w75PJsSQloo896+Y6ETGAfmE9z1oB6mEPxN fQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2gprh4r6ar-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Mar 2018 01:09:14 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2E19ESK010038 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Mar 2018 01:09:14 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w2E19DAW024906; Wed, 14 Mar 2018 01:09:13 GMT Received: from [192.168.1.164] (/98.246.252.205) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 13 Mar 2018 18:09:13 -0700 Subject: Re: [PATCH 1/2] selftests/memfd/memfd_test.c: fix implicit declaration To: Anders Roxell , shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, dh.herrmann@gmail.com References: <20180313114205.27714-1-anders.roxell@linaro.org> From: Mike Kravetz Message-ID: Date: Tue, 13 Mar 2018 18:09:12 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180313114205.27714-1-anders.roxell@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8831 signatures=668690 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803140009 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/13/2018 04:42 AM, Anders Roxell wrote: > gcc warns about implicit declaration. > > gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ > -I../../../../include/ -I../../../../usr/include/ > memfd_test.c common.o -o memfd_test > memfd_test.c: In function ‘mfd_assert_get_seals’: > memfd_test.c:74:6: warning: implicit declaration of function ‘fcntl’ > [-Wimplicit-function-declaration] > r = fcntl(fd, F_GET_SEALS); > ^~~~~ > memfd_test.c: In function ‘mfd_assert_open’: > memfd_test.c:197:6: warning: implicit declaration of function ‘open’ > [-Wimplicit-function-declaration] > r = open(buf, flags, mode); > ^~~~ > memfd_test.c: In function ‘mfd_assert_write’: > memfd_test.c:328:6: warning: implicit declaration of function ‘fallocate’ > [-Wimplicit-function-declaration] > r = 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 >= 3.16 and glibc requires kernel header files >= 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. -- Mike Kravetz