文件描述符和打开的文件
我有两个简单的问题:
两个文件描述符何时指向同一个打开的文件?
什么时候两个打开的文件指向同一个索引节点?
另外,如果您碰巧有一些很好的文档,其中有图表解释了这一点,如果您向我展示它的链接,我将非常感激:)
谢谢!
I have two quick questions:
When do two file descriptors point to the same open file ?
When do two open files point to the same inode ?
Also, if you happen to have some good documentation with graphs explaining this, i'll be very grateful if you show me the link to it :)
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以根据需要向单个文件打开任意数量的文件描述符 - 只需调用
open()
几次即可。操作系统通常允许打开文件进行读取(由任意数量的客户端需要访问)或进行读取和写入(但仅由单个客户端进行)。如果文件系统中的两个文件是指向同一文件的硬链接,则它们可以指向同一索引节点。
You can open as many file descriptors to a single file as you like - just call
open()
a few times. It's common for operating systems to allow a file either to be opened for reading (by as many clients as want access) or for reading and writing (but by only a single client).Two files in a filesystem could point to the same inode if they were hard links to the same file.