lkml.org 
[lkml]   [2007]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: O_CLOEXEC / MSG_CMSG_CLOEXEC documentation
On 9/5/07, Michael Kerrisk <mtk-manpages@gmx.net> wrote:
> O_CLOEXEC (Since Linux 2.6.23)
> Enable the close-on-exec flag for the new file
> descriptor. This is useful in multithreaded programs
> since using a separate fcntl(2) F_SETFD operation to
> set the FD_CLOEXEC flag does not suffice to avoid race
> conditions in multithreaded programs where one thread
> opens a file descriptor at the same time as another
> thread does a fork(2) plus execve(2).

Correct, although you might want to reconsider the repetition of "in
multithreaded programs".

Plus, it's also useful in other programs since it avoids the
additional system call to fcntl.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-09-06 13:37    [W:0.025 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site