[LTP] [PATCH v2 5/5] cgroup: Add memcontrol02
Petr Vorel
pvorel@suse.cz
Mon Jan 3 10:45:04 CET 2022
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
More information about the ltp
mailing list