linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: "Maciej Wieczór-Retman" <maciej.wieczor-retman@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>, Shuah Khan <shuah@kernel.org>,
	<ilpo.jarvinen@linux.intel.com>, <linux-kernel@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH RESEND v3 1/2] selftests/resctrl: Fix schemata write error check
Date: Wed, 13 Sep 2023 11:49:19 -0700	[thread overview]
Message-ID: <6d6dba28-a7f0-1f49-3f59-4e0026d0c2b8@intel.com> (raw)
In-Reply-To: <jyxp5mspjn7xbmclj5sumbsuwd424fqmdvntiiuq24tiz5yqb4@qunho7whbamf>

Hi Maciej,

On 9/12/2023 10:59 PM, Maciej Wieczór-Retman wrote:
> On 2023-09-12 at 09:00:28 -0700, Reinette Chatre wrote:
>> Hi Maciej,
>>
>> On 9/11/2023 11:32 PM, Maciej Wieczór-Retman wrote:
>>> On 2023-09-11 at 09:59:06 -0700, Reinette Chatre wrote:
>>>> Hi Maciej,
>>>> When I build the tests with this applied I encounter the following:
>>>>
>>>> resctrlfs.c: In function ‘write_schemata’:
>>>> resctrlfs.c:475:14: warning: implicit declaration of function ‘open’; did you mean ‘popen’? [-Wimplicit-function-declaration]
>>>>  475 |         fd = open(controlgroup, O_WRONLY);
>>>>      |              ^~~~
>>>>      |              popen
>>>> resctrlfs.c:475:33: error: ‘O_WRONLY’ undeclared (first use in this function)
>>>>  475 |         fd = open(controlgroup, O_WRONLY);
>>>>      |                                 ^~~~~~~~
>>>> resctrlfs.c:475:33: note: each undeclared identifier is reported only once for each function it appears in
>>>
>>> Hmm, that's odd. How do you build the tests?
>>
>> I applied this series on top of kselftest repo's "next" branch.
>>
>> I use a separate build directory and first ran "make headers". After that,
>> $ make O=<build dir> -C tools/testing/selftests/resctrl
> 
> I do the same, just without the build directory, but that shouldn't
> matter here I guess.
> 
>>> I use "make -C tools/testing/selftests/resctrl" while in the root kernel
>>> source directory. I tried to get the same error you experienced by
>>> compiling some dummy test program with "open" and "O_WRONLY". From the
>>> experiment I found that the "resctrl.h" header provides the declarations
>>> that are causing your errors.
>>
>>From what I can tell resctrl.h does not include fcntl.h that provides
>> what is needed.
> 
> I found out you can run "gcc -M <file>" and it will recursively tell you
> what headers are including other headers.
> 
> Using this I found that "resctrl.h" includes <sys/mount.h> which in turn
> includes <fcntl.h> out of /usr/include/sys directory. Is that also the
> case on your system?
> 

No. The test system I used is running glibc 2.35 and it seems that including
fcntl.h was added to sys/mount.h in 2.36. See glibc commit
78a408ee7ba0 ("linux: Add open_tree")

Generally we should avoid indirect inclusions and here I think certainly so
since it cannot be guaranteed that fcntl.h would be available via 
sys/mount.h.

Reinette

  reply	other threads:[~2023-09-13 18:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01 13:41 [PATCH RESEND v3 0/2] selftests/resctrl: Bug fix and optimization Wieczor-Retman Maciej
2023-09-01 13:42 ` [PATCH RESEND v3 1/2] selftests/resctrl: Fix schemata write error check Wieczor-Retman Maciej
2023-09-11 16:59   ` Reinette Chatre
2023-09-12  6:32     ` Maciej Wieczór-Retman
2023-09-12 16:00       ` Reinette Chatre
2023-09-13  5:59         ` Maciej Wieczór-Retman
2023-09-13 18:49           ` Reinette Chatre [this message]
2023-09-14  6:01             ` Maciej Wieczór-Retman
2023-09-14 15:14               ` Reinette Chatre
2023-09-15  8:16                 ` Maciej Wieczór-Retman
2023-09-01 13:42 ` [PATCH RESEND v3 2/2] selftests/resctrl: Move run_benchmark() to a more fitting file Wieczor-Retman Maciej
2023-09-11 16:59   ` Reinette Chatre
2023-09-12  6:34     ` Maciej Wieczór-Retman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6d6dba28-a7f0-1f49-3f59-4e0026d0c2b8@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).