2013/1/18 Zbigniew Jędrzejewski-Szmek <zbys...@in.waw.pl> > Hi, > I had a look at the your patches (without actually running them :). > I started with a few cleanups, I'll post them as replies to this letter. > Then I had a better look at the logic of USER_UNIT and I have a few > questions. > > Hi Thanks for having a look.
> -#define log_full_unit(level, unit, ...) log_meta_object(level, > __FILE__, __LINE__, __func__, "UNIT=", unit, __VA_ARGS__) > +#define log_full_unit(level, unit, ...) log_meta_object(level, __FILE__, > __LINE__, __func__, getpid() == 1 ? "UNIT=" : "USER_UNIT=", unit, > __VA_ARGS__) > +#define log_struct_unit(level, unit, ...) log_struct(level, getpid() == 1 > ? "UNIT=%s" : "USER_UNIT=%s", unit, __VA_ARGS__) Are all those calls to getpid() efficient? Is the result cached or does > each one generate a system call? > > According to man 2 getpid the result is cached, which btw Linus calls a "totally useless optimization" ;) http://yarchive.net/comp/linux/getpid_caching.html + if (!endswith(unit, ".service") && > + !endswith(unit, ".socket") && > + !endswith(unit, ".mount") && > + !endswith(unit, ".swap")) > + return 0; > > + if (!endswith(unit, ".service") && > + !endswith(unit, ".socket")) > > Do those conditions make sense? Aren't the messages logged for > all types of units (at least under debug or error conditions) > by systemd itself? > > The the first four conditions already exist in the current code. I wasn't sure if they make sense either but left them in place for now or rather removed mount and swap units for the user session. > Zbyszek > Mirco
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel