[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130708125007.6ee941ba@nehalam.linuxnetplumber.net>
Date: Mon, 8 Jul 2013 12:50:07 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Andrey Wagin <avagin@...il.com>
Cc: Eric Dumazet <eric.dumazet@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH] ip: set the close-on-exec flag for descriptors
On Mon, 8 Jul 2013 23:23:35 +0400
Andrey Wagin <avagin@...il.com> wrote:
> 2013/7/8 Eric Dumazet <eric.dumazet@...il.com>:
> > On Mon, 2013-07-08 at 19:51 +0400, Andrey Wagin wrote:
> >> Hi Eric,
> >>
> >> 2013/7/8 Eric Dumazet <eric.dumazet@...il.com>:
> >> >> Applied
> >> >
> >> > It seems it could break ip command for old kernels, as SOCK_CLOEXEC is
> >> > supported from 2.6.27
> >> >
> >> > Not sure if its worth a patch, to do the normal socket() call followed
> >> > by legacy fcntl() one.
> >>
> >> fcntl is not safe for multithread applications. If libnetlink isn't
> >> going to be used for them, I don't have objection. The patch is
> >> attached.
> >>
> >
> > If you want multithread safety, you could attempt the SOCK_CLOEXEC, and
> > fall back in case of error to legacy socket()/fcntl()
> >
>
> Yes, it's good idea. Look at the attached patch.
>
> Thanks.
>
> >
> >
Just always do the fcntl(), it makes more sense rather than having
two code paths.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists