[patch] don't use SOCK_CLOEXEC if not available

Lennart Poettering mzqohf at 0pointer.de
Sat Aug 7 05:37:31 PDT 2010


On Fri, 06.08.10 21:46, Robert Schwebel (r.schwebel at pengutronix.de) wrote:

> > Given that systemd does not support old systems which lack SOCK_CLOEXEC
> > anyway the suggested patch should actually be fine, since there would
> > never be any fds we could even set the cloexec flag for...
> 
> Hmm, in my scenario I have a (cross)toolchain which was built with
> kernel header files < 2.6.27 and glibc-2.8, but the actual kernel of the
> system will be fairly recent. So I'm wondering if systemd could run in
> this scenario or if I need a newer toolchain.

Well, if you cross-compile stuff you should make sure that the build
machine has the right header files around for the system you will be
running things on. This simple truth applies to systemd as much as to
any other project. It's how autoconf works basically.

> Does "does not support old systems" mean that a better fix would be that
> systemd should check for a minimum kernel version or for the CLOEXEC
> features in configure.ac and refuse to build if it is too old?

Well, systemd just uses O_CLOEXEC and SOCK_CLOEXEC in its sources,
without further checking. You should be unable to build it on a system
that lacks it. The configure script won't notice but the build will just
fail.

Of course, we could add proper checks for this, but given that I don't
even know myself which version is the minimum kernel version necessary
for systemd I wouldn't know how exactly to place the check.

Also, this kind of check would just move the failure a little bit
earlier, but the build would still fail, so I am not even sure how
useful such a check would actually be?

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the dbus mailing list