public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Richard Palethorpe <rpalethorpe@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 5/5] cgroup: Add memcontrol02
Date: Mon, 3 Jan 2022 10:45:04 +0100	[thread overview]
Message-ID: <YdLFoNp1m7Yc7BCT@pevik> (raw)
In-Reply-To: <20211230103718.369-5-rpalethorpe@suse.com>

Hi Richie,

> +static void alloc_pagecache_50M_check(void)
> +{
> +	const size_t size = MB(50);
> +	size_t current, file;
> +	const char *const file_key_fmt = is_v1_memcg ? "cache %zd" : "file %zd";
> +
> +	TEST(open(TMPDIR"/tmpfile", O_RDWR | O_CREAT));
FYI open() needs to have also mode:
TEST(open(TMPDIR"/tmpfile", O_RDWR | O_CREAT, 0600));

To fix error:

Although man open(2) suggest it could work:

The mode argument must be supplied if O_CREAT or O_TMPFILE is specified in flags; if it is not supplied, some arbitrary bytes from the stack will be applied as the file mode.

<fcntl.h> in glibc actually check for it and require it:

In function ‘open’,
    inlined from ‘alloc_pagecache_50M_check’ at memcontrol02.c:92:2,
    inlined from ‘test_memcg_current’ at memcontrol02.c:140:4:
/usr/include/bits/fcntl2.h:50:11: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
   50 |           __open_missing_mode ();

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-01-03  9:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20 13:10 [LTP] [PATCH 1/3] API/cgroup: Add safe_cgroup_lines_scanf Richard Palethorpe via ltp
2021-12-20 13:10 ` [LTP] [PATCH 2/3] API/cgroup: Add memory.stat Richard Palethorpe via ltp
2021-12-20 15:15   ` Cyril Hrubis
2021-12-20 13:10 ` [LTP] [PATCH 3/3] cgroup: Add memcontrol02 Richard Palethorpe via ltp
2021-12-20 15:44   ` Cyril Hrubis
2021-12-21  8:38     ` Richard Palethorpe
2021-12-21 11:14       ` Cyril Hrubis
2021-12-20 15:08 ` [LTP] [PATCH 1/3] API/cgroup: Add safe_cgroup_lines_scanf Cyril Hrubis
2021-12-30 10:37 ` [LTP] [PATCH v2 1/5] " Richard Palethorpe via ltp
2021-12-30 10:37   ` [LTP] [PATCH v2 2/5] API/cgroup: Add memory.stat Richard Palethorpe via ltp
2021-12-30 10:37   ` [LTP] [PATCH v2 3/5] API/fs: Add exfat magic Richard Palethorpe via ltp
2021-12-30 10:37   ` [LTP] [PATCH v2 4/5] API: Add TST_EXP_EXPR macro Richard Palethorpe via ltp
2021-12-30 10:37   ` [LTP] [PATCH v2 5/5] cgroup: Add memcontrol02 Richard Palethorpe via ltp
2022-01-03  9:45     ` Petr Vorel [this message]
2022-01-03  9:51   ` [LTP] [PATCH v2 1/5] API/cgroup: Add safe_cgroup_lines_scanf Petr Vorel

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=YdLFoNp1m7Yc7BCT@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=rpalethorpe@suse.com \
    /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