文件描述符 文件描述标志 文件状态标志


文件描述符 File Descriptors

文件描述标志 File Descriptors Flag

文件状态标志 File Status Flag


文件描述符是一个标示,非负整数,类似于windows里的句柄,为了与标准C保持一致(标准C里的文件的读写都是通过File Pointer)UNIX采用了这样的三级结构,我混淆于文件描述标志和文件状态标志,还是看英文来的有效,fd flag = close_on_exec。是在一个文件在某进程中的标示,而由于文件可以被多个进程打开,因此这个file status flag能被很多个进程访问到,它表示的是这个文件在此刻的读写等标示。下面附上一份原文。

Note the difference in scope between the file descriptor flags and the file status flags. The former apply only to a single descriptor in a single process, whereas the latter apply to all descriptors in any process that point to the given file table entry. When we describe the fcntl function in Section 3.14, we'll see how to fetch and modify both the file descriptor flags and the file status flags.

发布了28 篇原创文章 · 获赞 7 · 访问量 13万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章