一、Linux中的open
用户空间的open()如下
/*
返回值为int类型的fd;
参数flags用户指定文件的打开或者创建模式
参数mode只在创建一个新文件时使用,用于指定新建文件时的访问权限,比如可读、可写及可执行权限*/
int open(const char *pathname, int flags);
int open(const char *pathname, int flags, mode_t mode);
do_filp_open
内核中的文件操作函数的参数都有struct file* filp,显然内核需要在打开设备文件时为fd与filp建立某种联系,其次是为filp与驱动程序中的fops建立关联。在系统调用流程中会调用如下函数:
struct file *do_filp_open(int dfd, str