码迷,mamicode.com
首页 > 系统相关 > 详细

Linux 文件缓存 (二)

时间:2015-05-17 14:58:39      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:

close系统调用
1. 首先来到系统调用入口,主要使用__close_fd进行了具体的处理过程
(current->files表示进程当前打开文件表信息,fd为需要关闭的文件索引)
1048
/* 1049 * Careful here! We test whether the file pointer is NULL before 1050 * releasing the fd. This ensures that one clone task can‘t release 1051 * an fd while another clone is opening it. 1052 */ 1053 SYSCALL_DEFINE1(close, unsigned int, fd) 1054 { 1055 int retval = __close_fd(current->files, fd); 1056 1057 /* can‘t restart close syscall because file table entry was cleared */ 1058 if (unlikely(retval == -ERESTARTSYS || 1059 retval == -ERESTARTNOINTR || 1060 retval == -ERESTARTNOHAND || 1061 retval == -ERESTART_RESTARTBLOCK)) 1062 retval = -EINTR; 1063 1064 return retval; 1065 } 1066 EXPORT_SYMBOL(sys_close);

Linux 文件缓存 (二)

标签:

原文地址:http://www.cnblogs.com/lailailai/p/4509654.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!