On Thu, 10.04.14 01:39, Zbigniew Jędrzejewski-Szmek (zbys...@in.waw.pl) wrote:
> > On Wed, Apr 09, 2014 at 07:35:15PM -0400, Mike Gilbert wrote: > > On Wed, Apr 9, 2014 at 12:32 PM, Lennart Poettering > > <lenn...@poettering.net> wrote: > > > On Wed, 09.04.14 11:21, Tom Gundersen (t...@jklm.no) wrote: > > > > > >> > > >> On Mon, Mar 31, 2014 at 8:28 PM, Mike Gilbert <flop...@gentoo.org> wrote: > > >> > Several units now utilize the PrivateNetwork parameter, which requires > > >> > network namespace support. > > > > > > BTW, this really sounds like something where we should have graceful > > > degradation: if network namespaces are missing we should probably simply > > > ignore PrivateNetwork= (maybe print a one-time warning to syslog, just > > > to mentioned this), and proceed without them. After all this is a > > > feature that just takes away features, and doesn't add any, thus simply > > > ignoring it should be safe. > > > > > > I'd be happy to merge a patch which implements such a scheme to support > > > kernels with a more limited feature set. > > > > > > > Are there any examples of how to implement a "one-time warning" for > > this sort of thing? > Not in systemd, I think. > > 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. Maybe we shouldn't bother too much with making this one-time. Maybe instead we should print it all the time, but simply at debug log level, so that this isnt too visible... Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel