文章目录
非阻塞 IO(NIO)
上一节中 https://blog.csdn.net/tyustli/article/details/135140523,使用等待队列头实现了阻塞 IO
程序使用时,阻塞 IO 和非阻塞 IO 的区别在于文件打开的时候是否使用了
O_NONBLOCK
标志位。
- O_RDWR 默认以阻塞的方式打开
- O_NONBLOCK 以非阻塞的方式打开
模型
驱动程序
文件打卡时,文件打开标志存放在文件结构体 struct file
f_flags
字段
文件结构体原型在 linux/fs.h
文件中
struct file {
union {
struct