[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH XEN v7 27/29] tools/libs/*: Use O_CLOEXEC on Linux and FreeBSD



On Wed, 2015-12-16 at 06:16 -0700, Jan Beulich wrote:
> > > > On 16.12.15 at 13:31, <ian.campbell@xxxxxxxxxx> wrote:
> > --- a/tools/libs/call/freebsd.c
> > +++ b/tools/libs/call/freebsd.c
> > @@ -35,8 +35,14 @@
> > Â
> > Âint osdep_xencall_open(xencall_handle *xcall)
> > Â{
> > -ÂÂÂÂint flags, saved_errno;
> > -ÂÂÂÂint fd = open(PRIVCMD_DEV, O_RDWR);
> > +ÂÂÂÂint saved_errno;
> > +ÂÂÂÂint fd = open(PRIVCMD_DEV, O_RDWR|O_CLOEXEC);
> 
> No compatibility define needed for FreeBSD?

No, the kernel and libc are more tightly integrated there.

> > --- a/tools/libs/call/linux.c
> > +++ b/tools/libs/call/linux.c
> > @@ -26,15 +26,23 @@
> > Â
> > Â#include "private.h"
> > Â
> > +#ifndef O_CLOEXEC
> > +#define O_CLOEXECÂÂÂÂÂÂ02000000
> > +#endif
> 
> Is that a good idea? Wouldn't you better define to zero if building on
> an old glibc, assuming you'd then also run on an old kernel?

Good point, I was only considering the old userspace but with newer kernel
case. Since O_CLOEXEC was implemented in 2.6.23 I was expecting we could
just rely on its presence, but you mentioned that you sometimes used newers
kernels with older glibcs.

In the end I don't think I mind either way.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.