On Thu, 10.04.14 10:21, Thomas Bächler (tho...@archlinux.org) wrote:

> Am 10.04.2014 03:35, schrieb Lennart Poettering:
> >> Simply try:
> >>   int func(...) {
> >>      static bool network_namespace_warning = false;
> >>      ...
> >>
> >>      if (!network_namespace_warning) {
> >>          network_namespace_warning = true;
> >>     log_warn("...");
> >>      }
> >>   }
> >>
> >> Zbyszek
> > 
> > Hmm, so actually this is more complex than this, since the network
> > namespace stuff is done after we fork() before we exec() in the child
> > process. That means having this as static variable won't help, since you
> > could only set the copy, never the variable in the parent.
> 
> So, why not issue the warning while parsing the configuration, i.e.
> during daemon startup or reload?

Yeah, I thought about that too, but I couldn't think about a nice way to
detect this. However, now thinking about this again I think it might be
OK to do an access("/proc/self/ns/net, F_OK) should suffice. The
/proc/self/ns feature is newer than net namespaces, but that shouldn't
matter because to my knowledge both where available in 3.0 and we don't
support anything older anymore.

So, yeah, let's do this!

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to