[systemd-devel] [PATCH] core: don't complain if cgroup property is missing
Lennart Poettering
lennart at poettering.net
Fri Aug 15 03:01:47 PDT 2014
On Fri, 15.08.14 11:46, Lennart Poettering (lennart at poettering.net) wrote:
> > I think there is a misunderstanding. Cgroup properties do not exist if
> > they are turned off. And since your concern is EACCESS, I think a
> > "file exists?" check inside cg_set_attribute before we call
> > "write_string_file" is more proper in this case.
>
> Hmm, OK, so I wonder if this is simply the case because we ask the file
> to be written with O_CREAT. Because you cannot create files on cgroups
> this will result in EACCES. Now, of course, we actually never really
> want to create the files, so if we drop the O_CREAT we should probably
> get ENOENT instead, which would be so much nicer to check for.
>
> The O_CREAT is done because opf fopen(.., "we") inside of
> write_string_file(), inside of cg_set_attribute(). Now, there's
> apparently no way to make fopen() open a file for writing without
> O_CREAT. We hence have to build our own version, by combining open() and
> fdopen()...
>
> Anyway, could you have a look at this? We probably want an entirely new
> function write_string_file_nocreate() or so, which does this, and then
> make the cgroup code use that...
Don#t bother, I just decided to quickly hack that up myself. Does this
make things work for you? Can you check?
I left the log messages in btw, I just downgrade them to LOG_DEBUG now,
if the files are missing.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list