[patch] don't use SOCK_CLOEXEC if not available

Robert Schwebel r.schwebel at pengutronix.de
Fri Aug 6 12:46:07 PDT 2010


Lennart,

On Fri, Aug 06, 2010 at 09:28:48PM +0200, Lennart Poettering wrote:
> On Fri, 06.08.10 14:26, Colin Walters (walters at verbum.org) wrote:
> 
> > 
> > On Fri, Aug 6, 2010 at 1:30 PM, Robert Schwebel
> > <r.schwebel at pengutronix.de> wrote:
> > >
> > > +/* only available on linux >= 2.6.27 */
> > > +#ifndef SOCK_CLOEXEC
> > > +#define SOCK_CLOEXEC 0
> > > +#endif
> > 
> > This patch should probably be defensive and also call fcntl(fd,
> > CLOEXEC) too.  It doesn't matter for dbus because it's not
> > multi-threaded, but for other consumers of sd-daemon.c it may.
> 
> I'll fix this upstream and then update the version in D-Bus.
> 
> 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.

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?

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