[Linux-HA] socket of lrmd

Lars Ellenberg lars.ellenberg at linbit.com
Fri Jul 3 05:06:30 MDT 2009


On Fri, Jul 03, 2009 at 12:10:17PM +0200, Dejan Muhamedagic wrote:
> > All those FDs should probably be opened with the "O_CLOEXEC" flag,
> > or alternatively by
> > flags = fcntl(fd, F_GETFD); /*error handling*/
> > fcntl(fd, F_SETFD, flags | FD_CLOEXEC); /*error handling*/
> 
> Never heard of CLOEXEC. According to the manpage it's also linux
> specific.

fcntl FD_CLOEXEC is POSIX.

O_CLOEXEC is linux specific, and was introduced in linux 2.6.23 (or so
the manpage says), to avoid the race in multi-threaded applications:
t1:     t2:
 open
          exec -----> inherited fd :(
 fcntl(FD_CLOEXEC)

-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.


More information about the Linux-HA mailing list