您的位置:首页 > 运维架构 > Linux

[Linux]O_CLOEXEC 标志

2016-02-28 13:14 573 查看
http://stackoverflow.com/questions/1315382/closing-all-open-files-in-a-process

If your program will be calling
fork
and
exec
, you really should open all file descriptors with the
O_CLOEXEC
flag so you don't have to manually close them before
exec
. You can also use
fcntl
to add this flag after a file is opened, but that's subject to race conditions in multithreaded programs.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: