gpt4 book ai didi

linux - 为什么 close_on_exec 不是默认配置?

转载 作者:IT王子 更新时间:2023-10-29 00:53:49 25 4
gpt4 key购买 nike

因为似乎没有办法在exec之后使用已经打开的fd,

为什么这个标志不是默认的?

最佳答案

文件描述符可以exec 调用之后使用;例如,这就是 Unix 实用程序从 shell 获取标准输入/输出/错误 fds 的方式。

Close-on-exec 不是默认设置,因为 POSIX standard (和 Unix 传统)要求相反的行为:

File descriptors open in the calling process image shall remain open in the new process image, except for those whose close-on- exec flag FD_CLOEXEC is set.

关于linux - 为什么 close_on_exec 不是默认配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9583845/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com