[patch] don't use SOCK_CLOEXEC if not available

Robert Schwebel r.schwebel at pengutronix.de
Sun Aug 8 23:37:56 PDT 2010

On Sat, Aug 07, 2010 at 02:37:31PM +0200, Lennart Poettering wrote:
> 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.

That's usually true (and we make sure in ptxdist that cross built
components actually see the right header files), but the kernel is
different. Kernel header files go into the toolchain, and you can easily
use a newer kernel than the one the toolchain was built with - but in
rare cases new things are added to the userspace visible kernel headers
(usually definitions for kernel/userspace interfaces, like ioctls). At
that point you still can use the features which do not require a newer
set of header files - it's compatible.

> > 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,

That was my question.

> 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.

If you say that the right thing is that systemd isn't supposed to work
on older systems, I can think about the proper checks.

> 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?

The idea of the autoconf is to check on configure time if the system has
the right prerequisites for a program. At the moment a casual observer
cannot easily find out if it isn't supposed to run on new systems or if
it is just a bug.

Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

More information about the dbus mailing list