[systemd-devel] [PATCH 1/2] RFC: journald: Allow to cache the cg_get_root_path
lennart at poettering.net
Mon Jul 15 18:21:56 PDT 2013
On Thu, 27.06.13 18:30, Holger Hans Peter Freyther (holger at freyther.de) wrote:
> From: Holger Hans Peter Freyther <holger at moiji-mobile.com>
> Allow to cache the cg_get_root_path and introduce a new method
> cg_pid_get_path_shifted_with_root that can use the cached version
> instead of allocating a new string.
Sorry for the delay in reviewing.
THe general approach of caching the result of cg_get_root_path() is a
good one, but I am not fond of placing this in a static variable. We try
to avoid that where possible, especially if we have some kind of context
object around anyway where we could place this.
> + if (!cg_root)
> + return -1;
We use negative "errno"-style errors everywhere for indicating errors,
not -1. i.e. please use "return -EINVAL" or suchlike, but not literal
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel