scull_user.c
来自「linux device drive II 的示例移植到2.6.x内核」· C语言 代码 · 共 29 行
C
29 行
/* simple user demo zhengjie caolingzi@netease.com*/#include <stdio.h>#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <sys/ioctl.h>#include "scull_user.h"int main(int argc, char *argv[]){ int fd, result; fd = open("/devfs/scull/0", O_RDWR | O_APPEND); if(fd < 0){ printf("Cannot open the file\n"); _exit(0); } result = ioctl(fd, SCULL_IOCTQSET); if(result < 0) printf("ioctl error\n"); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?