分类: 系统运维
2013-12-03 21:12:01
原文地址:文件描述符 文件描述标志 文件状态标志 作者:zhangzheyuk
文件描述符 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 , we'll see how to fetch and modify both the file descriptor flags and the file status flags.