2013/1/18 Zbigniew Jędrzejewski-Szmek <span dir="ltr"><<a href="mailto:zbyszek@in.waw.pl" target="_blank">zbyszek@in.waw.pl</a>></span><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
I had a look at the your patches (without actually running them :).<br>
I started with a few cleanups, I'll post them as replies to this letter.<br>
Then I had a better look at the logic of USER_UNIT and I have a few<br>
questions.<br>
<br></blockquote><div>Hi</div><div>Thanks for having a look. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-#define log_full_unit(level, unit, ...) log_meta_object(level, __FILE__, __LINE__, __func__, "UNIT=", unit, __VA_ARGS__)<br>
+#define log_full_unit(level, unit, ...) log_meta_object(level, __FILE__, __LINE__, __func__, getpid() == 1 ? "UNIT=" : "USER_UNIT=", unit, __VA_ARGS__)<br>
+#define log_struct_unit(level, unit, ...) log_struct(level, getpid() == 1 ? "UNIT=%s" : "USER_UNIT=%s", unit, __VA_ARGS__) </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Are all those calls to getpid() efficient? Is the result cached or does<br>
each one generate a system call?<br>
<br></blockquote><div> According to man 2 getpid the result is cached, which btw Linus calls a "totally useless optimization" ;) <a href="http://yarchive.net/comp/linux/getpid_caching.html">http://yarchive.net/comp/linux/getpid_caching.html</a></div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ if (!endswith(unit, ".service") &&<br>
+ !endswith(unit, ".socket") &&<br>
+ !endswith(unit, ".mount") &&<br>
+ !endswith(unit, ".swap"))<br>
+ return 0;<br>
<br>
+ if (!endswith(unit, ".service") &&<br>
+ !endswith(unit, ".socket"))<br>
<br>
Do those conditions make sense? Aren't the messages logged for<br>
all types of units (at least under debug or error conditions)<br>
by systemd itself?<br>
<br></blockquote><div>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.</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Zbyszek<br>
</blockquote></div>Mirco