Chinaunix首页 | 论坛 | 博客
  • 博客访问: 11094
  • 博文数量: 6
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 10
  • 用 户 组: 普通用户
  • 注册时间: 2013-11-16 19:59
文章分类
文章存档

2014年(1)

2013年(5)

我的朋友

分类: 系统运维

2013-12-03 21:12:01


文件描述符 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.

阅读(459) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~