当前位置:首页>Linux>Linux阻塞与非阻塞IO详解

Linux阻塞与非阻塞IO详解

  • 2026-02-26 06:34:44
Linux阻塞与非阻塞IO详解

在Linux内核驱动开发中,阻塞与非阻塞IO是最基础且核心的IO模型,直接决定了进程与设备交互的效率和资源占用方式。无论是字符设备、块设备驱动,还是用户态应用程序的IO调用,都离不开对这两种模型的理解与合理运用。

本文将结合阻塞/非阻塞IO的核心理论、等待队列机制、globalfifo驱动实例,重点适配Linux 6.6内核的实际特性(兼容旧接口、优化点、实操注意事项),从原理拆解、内核实现、驱动实操到用户态验证,手把手带你吃透Linux 6.6下的阻塞与非阻塞IO。

一、核心概念:阻塞与非阻塞IO的本质区别

阻塞与非阻塞IO的核心差异,在于进程无法获取设备资源时的处理逻辑——前者“等待资源”,后者“立即返回”,两者没有绝对的优劣,需根据场景选择。

1.1 阻塞IO:“等待资源就绪,再执行操作”

阻塞IO的核心逻辑的是“未就绪则挂起”:当进程调用read()、write()等系统调用访问设备时,若设备资源(如缓冲区、硬件接口)未就绪,进程会主动放弃CPU,进入睡眠状态,并从内核调度器的运行队列中移除,直到等待的资源满足可操作条件(如缓冲区有数据、硬件就绪),才会被唤醒并继续执行IO操作。

对用户态应用而言,阻塞IO是“透明的”——应用程序调用系统调用后会一直阻塞,直到IO完成才返回结果,无需关心内核层面的进程调度和资源等待。

关键注意点(Linux 6.6兼容):阻塞IO必须保证“有唤醒机制”,否则睡眠的进程会永久挂起(俗称“僵死”)。在Linux内核中,唤醒逻辑大多与中断绑定(硬件资源就绪时触发中断,中断服务程序唤醒阻塞进程),这也是驱动开发中阻塞IO实现的核心要点。

1.2 非阻塞IO:“不等待,要么放弃要么轮询”

非阻塞IO的核心逻辑是“未就绪则立即返回”:当进程调用IO系统调用时,若设备资源未就绪,内核不会挂起进程,而是立即返回一个错误码(**-EAGAIN**),告知应用程序“资源暂时不可用,请稍后再试”。

应用程序收到-EAGAIN后,有两种处理方式:一是直接放弃IO操作,二是通过循环轮询的方式反复调用IO接口,直到资源就绪并完成操作。

Linux 6.6补充:非阻塞IO的优势是“不浪费CPU等待时间”,适合对响应速度敏感的场景(如网络IO、串口实时通信);但轮询机制会占用额外CPU资源,因此实际开发中常结合IO多路复用(select/poll/epoll)优化,避免无效轮询。

1.3 一张图看懂两者流程(适配Linux 6.6内核)

  • 阻塞IO流程:用户态调用read/write → 内核检查资源 → 资源未就绪 → 进程睡眠(移出运行队列) → 资源就绪(中断唤醒) → 进程恢复运行 → 完成IO → 返回结果。

  • 非阻塞IO流程:用户态调用read/write → 内核检查资源 → 资源未就绪 → 立即返回-EAGAIN → 应用程序轮询调用 → 资源就绪 → 完成IO → 返回结果。

二、用户态控制:阻塞与非阻塞IO的切换方式

在Linux中,用户态应用程序可以通过两种方式控制IO的阻塞/非阻塞模式,Linux 6.6完全兼容这两种方式,且无接口变更,实操性极强。

2.1 方式1:打开文件时指定(最常用)

通过open()系统调用的flags参数,指定O_NONBLOCK标志,即可设置非阻塞模式;不指定则默认是阻塞模式。串口读写实例,在Linux 6.6中可直接运行,以下是简化实操版。

实例1:阻塞方式读串口(/dev/ttyS1)

char buf;// 不指定O_NONBLOCK,默认阻塞模式int fd = open("/dev/ttyS1", O_RDWR);if (fd < 0) { perror("open error"); return-1; }// 阻塞等待:直到串口有输入才返回ssize_t res = read(fd, &buf, 1);if (res == 1) {printf("读取到字符:%c\n", buf);}close(fd);

实例2:非阻塞方式读串口(/dev/ttyS1)

char buf;// 指定O_NONBLOCK,设置为非阻塞模式int fd = open("/dev/ttyS1", O_RDWR | O_NONBLOCK);if (fd < 0) { perror("open error"); return-1; }// 轮询读取:未就绪则返回-EAGAIN,循环重试while (read(fd, &buf, 1) != 1) {// 可添加微小延时,减少CPU占用(Linux 6.6推荐用usleep)    usleep(1000);}printf("读取到字符:%c\n", buf);close(fd);

2.2 方式2:文件打开后动态切换(灵活适配场景)

若文件已打开(默认阻塞模式),可通过fcntl()或ioctl()系统调用动态修改IO模式,Linux 6.6中fcntl()接口更常用、更稳定,推荐优先使用。

核心示例(将阻塞IO改为非阻塞IO):

// 假设fd已通过open()打开(默认阻塞)int flags = fcntl(fd, F_GETFL);  // 获取当前文件状态标志if (flags < 0) { perror("fcntl F_GETFL error"); return-1; }// 设置O_NONBLOCK标志,改为非阻塞模式flags |= O_NONBLOCK;if (fcntl(fd, F_SETFL, flags) < 0) {    perror("fcntl F_SETFL error");return-1;}

补充(Linux 6.6):若要从非阻塞切换回阻塞,只需执行flags &= ~O_NONBLOCK,再调用fcntl()设置即可。

三、内核驱动实现:等待队列(阻塞IO的核心)

Linux内核中,阻塞IO的实现依赖等待队列(Wait Queue)——它是内核中用于同步进程与资源的基础机制,与进程调度紧密结合,信号量、互斥体等同步机制在底层也依赖等待队列实现。

Linux 6.6内核中,等待队列的核心接口完全兼容旧版本(无API废弃),但增加了部分性能优化(如等待队列元素的快速插入/删除),讲解驱动中等待队列的实操的流程。

3.1 等待队列的核心操作(Linux 6.6实操版)

等待队列的操作分为7步,对应的核心知识点,以下是Linux 6.6中驱动开发的标准用法,附带关键注释:

  1. 定义等待队列头部:使用wait_queue_head_t类型,本质是__wait_queue_head结构体的typedef,用于管理等待队列链表。wait_queue_head_t my_wait_queue;  // 定义等待队列头部

  2. 初始化等待队列头部:有两种方式,推荐使用DECLARE_WAITQUEUE_HEAD()宏(快捷方式),无需单独调用init_waitqueue_head()。// 方式1:快捷宏(定义+初始化,推荐) DECLARE_WAITQUEUE_HEAD(my_wait_queue); // 方式2:手动初始化(适用于动态定义的头部) init_waitqueue_head(&my_wait_queue);

  3. 定义等待队列元素:使用DECLARE_WAITQUEUE()宏,绑定当前进程(current指针,内核中表示当前运行的进程)。// 定义并初始化等待队列元素,绑定当前进程 DECLARE_WAITQUEUE(wait, current);

  4. 添加/移除等待队列元素:将等待队列元素加入/移出等待队列头部管理的链表,核心接口add_wait_queue()和remove_wait_queue()。// 将wait元素添加到my_wait_queue队列头部 add_wait_queue(&my_wait_queue, &wait); // 完成IO后,将wait元素从队列中移除(必须执行,避免内存泄漏) remove_wait_queue(&my_wait_queue, &wait);

  5. 等待事件(核心步骤):进程进入等待状态,直到指定条件满足才被唤醒。Linux 6.6中常用4个宏,核心区别在于“是否可被信号打断”和“是否超时”:

    • wait_event(queue, condition):不可被信号打断,直到condition为真才唤醒。

    • wait_event_interruptible(queue, condition):可被信号打断(推荐,避免进程僵死),Linux 6.6驱动开发中优先使用。

    • wait_event_timeout(queue, condition, timeout):不可被信号打断,超时(jiffy为单位)后强制返回。

    • wait_event_interruptible_timeout(queue, condition, timeout):可被信号打断,支持超时。

  6. 唤醒队列:资源就绪后,唤醒等待队列中的进程,需与等待事件宏成对使用(避免唤醒无效进程):// 与wait_event()/wait_event_timeout()成对使用,唤醒所有进程 wake_up(&my_wait_queue); // 与wait_event_interruptible()/wait_event_interruptible_timeout()成对使用(推荐) wake_up_interruptible(&my_wait_queue);Linux 6.6补充:wake_up()可唤醒TASK_INTERRUPTIBLE(浅度睡眠)和TASK_UNINTERRUPTIBLE(深度睡眠)状态的进程;wake_up_interruptible()仅唤醒TASK_INTERRUPTIBLE状态的进程,更安全。

  7. 在等待队列上睡眠:简化版接口sleep_on()和interruptible_sleep_on(),本质是“定义元素+添加队列+等待唤醒”的封装,Linux 6.6中仍可用,但推荐使用等待事件宏(更灵活)。

3.2 等待队列实操模板(Linux 6.6驱动)

适配Linux 6.6内核,编写驱动中写操作的阻塞IO模板(含非阻塞判断、信号处理、死锁避免),关键代码带详细注释:

staticssize_txxx_write(struct file *file, constchar __user *buffer, size_t count, loff_t *ppos){int ret = 0;int avail;  // 用于判断设备缓冲区是否可写// 1. 定义并初始化等待队列元素,绑定当前进程    DECLARE_WAITQUEUE(wait, current);// 2. 将等待队列元素添加到自定义的等待队列头部(xxx_wait需提前定义初始化)    add_wait_queue(&xxx_wait, &wait);// 3. 循环等待设备缓冲区可写(避免虚假唤醒,Linux 6.6推荐用do-while)do {        avail = device_writable(...);  // 自定义函数:判断缓冲区是否可写(返回值<0表示不可写)if (avail < 0) {// 4. 判断是否为非阻塞IO,若是则立即返回-EAGAINif (file->f_flags & O_NONBLOCK) {                ret = -EAGAIN;goto out;  // 跳转到out,移除等待队列元素            }// 5. 设置进程状态为TASK_INTERRUPTIBLE(浅度睡眠,可被信号打断)            __set_current_state(TASK_INTERRUPTIBLE);// 6. 调度其他进程执行,当前进程进入睡眠(Linux 6.6调度逻辑无变更)            schedule();// 7. 唤醒后判断:若为信号唤醒,返回-ERESTARTSYS(内核会重新调度)if (signal_pending(current)) {                ret = -ERESTARTSYS;goto out;            }        }    } while (avail < 0);// 8. 缓冲区可写,执行写操作(自定义写逻辑)    device_write(...);out:// 9. 移除等待队列元素(必须执行,否则会导致内存泄漏)    remove_wait_queue(&xxx_wait, &wait);// 10. 将进程状态重置为TASK_RUNNING(避免状态异常)    set_current_state(TASK_RUNNING);return ret;}

3.3 关键注意点(Linux 6.6驱动避坑)

  • 避免虚假唤醒:等待事件必须用循环(do-while)判断条件,因为内核可能会出现“虚假唤醒”(无资源就绪却唤醒进程),Linux 6.6仍存在此情况,需通过循环再次校验条件。

  • 信号处理:优先使用wait_event_interruptible(),并判断signal_pending(current),否则进程可能被信号永久挂起(Linux 6.6对信号处理的兼容性无变化)。

  • 资源释放:睡眠前若持有互斥体、自旋锁等同步锁,必须先释放(如globalfifo驱动的第17行、69行),否则会导致死锁(Linux 6.6对死锁的检测更严格,会直接触发内核告警)。

四、实战案例:Linux 6.6 globalfifo驱动(支持阻塞/非阻塞IO)

结合globalfifo驱动实例,适配Linux 6.6内核,实现一个支持阻塞/非阻塞读写的字符设备驱动,涵盖设备结构体定义、模块加载、读写函数实现,可直接编译运行(需适配内核源码路径)。

4.1 驱动核心实现(Linux 6.6适配版)

核心思路:将globalmem改为FIFO缓冲区,读进程阻塞等待“缓冲区非空”,写进程阻塞等待“缓冲区非满”,读写操作相互唤醒,同时支持非阻塞模式和互斥保护(避免并发问题)。

步骤1:定义设备结构体(增加等待队列头部)

#include<linux/module.h>#include<linux/fs.h>#include<linux/mutex.h>#include<linux/wait.h>#include<linux/slab.h>#include<linux/uaccess.h>#define GLOBALFIFO_SIZE 1024  // FIFO缓冲区大小#define GLOBALFIFO_MAJOR 231  // 主设备号(可自定义,避免冲突)staticint globalfifo_major = GLOBALFIFO_MAJOR;// 设备结构体:包含cdev、缓冲区、互斥体、等待队列头部structglobalfifo_dev {structcdevcdev;// 字符设备核心结构体unsignedint current_len;  // FIFO中有效数据长度(0=空,GLOBALFIFO_SIZE=满)unsignedchar mem[GLOBALFIFO_SIZE];  // FIFO缓冲区structmutexmutex;// 互斥体,保护临界资源(避免并发读写冲突)wait_queue_head_t r_wait;  // 读等待队列:等待缓冲区非空wait_queue_head_t w_wait;  // 写等待队列:等待缓冲区非满};staticstructglobalfifo_dev *globalfifo_devp;

步骤2:模块加载函数(初始化等待队列)

// 字符设备操作集(后续实现read/write)staticconststructfile_operationsglobalfifo_fops = {    .owner = THIS_MODULE,    .read = globalfifo_read,    .write = globalfifo_write,    .open = globalfifo_open,    .release = globalfifo_release,};// 初始化字符设备staticvoidglobalfifo_setup_cdev(struct globalfifo_dev *dev, int index){int devno = MKDEV(globalfifo_major, index);    cdev_init(&dev->cdev, &globalfifo_fops);    dev->cdev.owner = THIS_MODULE;    cdev_add(&dev->cdev, devno, 1);}// 模块加载函数(Linux 6.6无接口变更)staticint __init globalfifo_init(void){int ret;dev_t devno = MKDEV(globalfifo_major, 0);// 注册设备号(动态/静态)if (globalfifo_major) {        ret = register_chrdev_region(devno, 1"globalfifo");    } else {        ret = alloc_chrdev_region(&devno, 01"globalfifo");        globalfifo_major = MAJOR(devno);    }if (ret < 0return ret;// 分配设备结构体内存(GFP_KERNEL:内核态正常分配)    globalfifo_devp = kzalloc(sizeof(struct globalfifo_dev), GFP_KERNEL);if (!globalfifo_devp) {        ret = -ENOMEM;goto fail_malloc;    }// 初始化字符设备、互斥体、等待队列头部    globalfifo_setup_cdev(globalfifo_devp, 0);    mutex_init(&globalfifo_devp->mutex);    init_waitqueue_head(&globalfifo_devp->r_wait);  // 初始化读等待队列    init_waitqueue_head(&globalfifo_devp->w_wait);  // 初始化写等待队列    printk(KERN_INFO "globalfifo driver init ok (Linux 6.6)\n");return0;fail_malloc:    unregister_chrdev_region(devno, 1);return ret;}module_init(globalfifo_init);  // 注册模块加载函数

步骤3:读写函数实现(支持阻塞/非阻塞)

核心逻辑:读函数阻塞等待“缓冲区非空”,写函数阻塞等待“缓冲区非满”,读写完成后相互唤醒,同时处理非阻塞模式和信号唤醒,避免死锁。

// 读函数:阻塞等待缓冲区非空,支持非阻塞模式staticssize_tglobalfifo_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos){int ret;structglobalfifo_dev *dev = filp->private_data;    DECLARE_WAITQUEUE(wait, current);  // 定义等待队列元素    mutex_lock(&dev->mutex);  // 加互斥体,保护临界资源    add_wait_queue(&dev->r_wait, &wait);  // 加入读等待队列// 循环等待:缓冲区为空则睡眠(避免虚假唤醒)while (dev->current_len == 0) {// 非阻塞模式:立即返回-EAGAINif (filp->f_flags & O_NONBLOCK) {            ret = -EAGAIN;goto out;        }// 设置进程为浅度睡眠,调度其他进程        __set_current_state(TASK_INTERRUPTIBLE);        mutex_unlock(&dev->mutex);  // 睡眠前释放互斥体,避免死锁(关键!)        schedule();// 唤醒后判断:是否为信号唤醒if (signal_pending(current)) {            ret = -ERESTARTSYS;goto out2;        }        mutex_lock(&dev->mutex);  // 唤醒后重新加互斥体    }// 读取数据:最多读取当前有效数据长度if (count > dev->current_len) {        count = dev->current_len;    }// 将内核缓冲区数据拷贝到用户空间(copy_to_user返回0表示成功)if (copy_to_user(buf, dev->mem, count)) {        ret = -EFAULT;goto out;    } else {// 移动缓冲区数据(移除已读取的数据)memcpy(dev->mem, dev->mem + count, dev->current_len - count);        dev->current_len -= count;        printk(KERN_INFO "read %zd bytes, current_len: %u\n", count, dev->current_len);// 读完成后,唤醒写等待队列(缓冲区有空闲空间了)        wake_up_interruptible(&dev->w_wait);        ret = count;    }out:    mutex_unlock(&dev->mutex);  // 释放互斥体out2:    remove_wait_queue(&dev->r_wait, &wait);  // 移除等待队列元素    set_current_state(TASK_RUNNING);  // 重置进程状态return ret;}// 写函数:阻塞等待缓冲区非满,支持非阻塞模式(与读函数逻辑对称)staticssize_tglobalfifo_write(struct file *filp, constchar __user *buf, size_t count, loff_t *ppos){int ret;structglobalfifo_dev *dev = filp->private_data;    DECLARE_WAITQUEUE(wait, current);    mutex_lock(&dev->mutex);    add_wait_queue(&dev->w_wait, &wait);// 循环等待:缓冲区满则睡眠while (dev->current_len == GLOBALFIFO_SIZE) {if (filp->f_flags & O_NONBLOCK) {            ret = -EAGAIN;goto out;        }        __set_current_state(TASK_INTERRUPTIBLE);        mutex_unlock(&dev->mutex);  // 睡眠前释放互斥体        schedule();if (signal_pending(current)) {            ret = -ERESTARTSYS;goto out2;        }        mutex_lock(&dev->mutex);    }// 写入数据:最多写入剩余空间if (count > GLOBALFIFO_SIZE - dev->current_len) {        count = GLOBALFIFO_SIZE - dev->current_len;    }// 将用户空间数据拷贝到内核缓冲区if (copy_from_user(dev->mem + dev->current_len, buf, count)) {        ret = -EFAULT;goto out;    } else {        dev->current_len += count;        printk(KERN_INFO "written %zd bytes, current_len: %u\n", count, dev->current_len);// 写完成后,唤醒读等待队列(缓冲区有数据了)        wake_up_interruptible(&dev->r_wait);        ret = count;    }out:    mutex_unlock(&dev->mutex);out2:    remove_wait_queue(&dev->w_wait, &wait);    set_current_state(TASK_RUNNING);return ret;}

4.2 Linux 6.6驱动编译与加载

编写Makefile(适配Linux 6.6内核源码路径),编译生成.ko模块,然后加载模块、创建设备节点,步骤如下:

1. Makefile编写

obj-m += globalfifo.oKERNELDIR ?= /lib/modules/$(shell uname -r)/build  # Linux 6.6内核源码路径PWD := $(shell pwd)default:$(MAKE) -C $(KERNELDIR) M=$(PWD) modulesclean:$(MAKE) -C $(KERNELDIR) M=$(PWD) clean

2. 编译与加载

# 编译驱动模块(需安装Linux 6.6内核开发包)make# 加载驱动模块sudo insmod globalfifo.ko# 查看模块是否加载成功lsmod | grep globalfifo# 创建设备文件节点(主设备号231,与驱动中一致)sudo mknod /dev/globalfifo c 231 0# 修改设备节点权限(允许普通用户访问)sudo chmod 666 /dev/globalfifo

五、用户态验证:阻塞/非阻塞IO实测(Linux 6.6)

驱动加载完成后,在用户态通过简单命令或代码,验证阻塞与非阻塞IO的功能,完全复用的验证逻辑,Linux 6.6中可直接执行。

5.1 阻塞IO验证(默认模式)

# 1. 打开第一个终端,后台执行cat命令(阻塞读,等待缓冲区有数据)cat /dev/globalfifo &# 2. 打开第二个终端,向设备写入数据(写完成后唤醒读进程)echo"Linux 6.6 globalfifo block IO test" > /dev/globalfifo# 3. 查看第一个终端输出(会打印写入的数据,说明阻塞读正常)

5.2 非阻塞IO验证

编写用户态非阻塞读代码(test_nonblock.c),验证非阻塞模式下的-EAGAIN返回值:

#include<stdio.h>#include<fcntl.h>#include<unistd.h>#include<errno.h>intmain(){char buf[32];int fd = open("/dev/globalfifo", O_RDONLY | O_NONBLOCK);  // 非阻塞读if (fd < 0) { perror("open error"); return-1; }// 缓冲区为空,非阻塞读应返回-EAGAINssize_t ret = read(fd, buf, sizeof(buf));if (ret < 0) {if (errno == EAGAIN) {printf("非阻塞读:资源暂时不可用(-EAGAIN)\n");        } else {            perror("read error");        }    }    close(fd);return0;}

编译运行:

gcc test_nonblock.c -o test_nonblock./test_nonblock# 输出:非阻塞读:资源暂时不可用(-EAGAIN),说明非阻塞模式正常

5.3 权限注意事项(Linux 6.6)

向/dev/globalfifo写入数据需root权限,直接执行sudo echo会失效,推荐先切换到root用户:

sudo su  #echo"test" > /dev/globalfifo

六、Linux 6.6内核相关优化与注意事项

Linux 6.6内核中,阻塞与非阻塞IO的核心机制未发生变更,但针对等待队列、进程调度做了部分性能优化,驱动开发中需注意以下几点:

  • 等待队列性能优化:Linux 6.6优化了等待队列元素的插入/删除效率,尤其是高并发场景下,add_wait_queue()和remove_wait_queue()的执行速度更快,无需修改驱动代码,直接兼容旧接口。

  • 互斥体与死锁检测:Linux 6.6对内核死锁的检测更严格,若阻塞进程睡眠前未释放互斥体,会触发内核告警(dmesg可查看),因此必须严格遵循“睡眠前释放锁、唤醒后重新加锁”的原则。

  • O_NONBLOCK标志兼容性:Linux 6.6完全兼容O_NONBLOCK标志,无论是open()指定还是fcntl()动态修改,行为与旧版本一致,无需适配。

  • 信号处理优化:signal_pending(current)的执行效率提升,在非阻塞IO的信号唤醒场景中,响应速度更快,驱动中的信号处理逻辑无需修改。

七、总结:阻塞与非阻塞IO的选型建议

结合Linux 6.6内核特性和实际开发场景,总结两种IO模型的选型原则,帮你避免无效开发:

  1. 优先选阻塞IO:适用于“IO操作不频繁、对CPU占用不敏感”的场景(如普通字符设备读写、磁盘文件操作),实现简单、资源占用低,无需处理轮询和-EAGAIN错误。

  2. 选非阻塞IO:适用于“对响应速度敏感、IO频繁”的场景(如串口实时通信、网络IO),但需结合IO多路复用(epoll)优化轮询,避免CPU资源浪费。

  3. 驱动开发核心:阻塞IO的关键是“等待队列+唤醒机制”,非阻塞IO的关键是“-EAGAIN处理+轮询优化”,两者都需注意同步锁的合理使用,避免死锁和并发问题。

本文结合的核心知识点,适配Linux 6.6内核的实际特性,从原理到实操,完整覆盖了阻塞与非阻塞IO的驱动开发和用户态验证。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-28 16:10:21 HTTP/2.0 GET : https://f.mffb.com.cn/a/476377.html
  2. 运行时间 : 0.318121s [ 吞吐率:3.14req/s ] 内存消耗:4,704.63kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=9cea27c737de7f4183566f9115ac68f2
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000945s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001454s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000626s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.013251s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001624s ]
  6. SELECT * FROM `set` [ RunTime:0.008712s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001524s ]
  8. SELECT * FROM `article` WHERE `id` = 476377 LIMIT 1 [ RunTime:0.015882s ]
  9. UPDATE `article` SET `lasttime` = 1772266221 WHERE `id` = 476377 [ RunTime:0.043057s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 67 LIMIT 1 [ RunTime:0.000834s ]
  11. SELECT * FROM `article` WHERE `id` < 476377 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.012659s ]
  12. SELECT * FROM `article` WHERE `id` > 476377 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.004616s ]
  13. SELECT * FROM `article` WHERE `id` < 476377 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.052643s ]
  14. SELECT * FROM `article` WHERE `id` < 476377 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.037340s ]
  15. SELECT * FROM `article` WHERE `id` < 476377 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.035914s ]
0.319814s