引用第2楼0o龙i魂o0于2010-08-07 10:49发表的 :
能详细的说明下吗,或者哪本书对这个讲得比较详细的!
谢了
基本上设备驱动相关的系统调用(open(), close(), read(), write(), lseek(), ioctl() ...)和你的设备所属的驱动的file_operations结构里的成员函数指针是一一对应的。比如系统调用ssize_t read(int fd, void *buf, size_t count)和驱动file_operations里的ssize_t (*read) struct file * file, char __user * buf, size_t count, loff_t *ppos),基本上,void *buf <--> char __user *buf, size_t count <-->size_t count。loff_t *ppos是由lseek()系统调用指定的文件pos。
要深入理解系统调用和内核的关系,建议你看一下"Understanding the Linux Kernel, 3rd edition"的第10章“System Calls”