摘要:
#include <stdio.h>#include <unistd.h>#include <sys/poll.h>int main(void){ //要等待的文件的数组 struct pollfd fds[2]; int ret; fds[0].fd = STDIN_FILENO;//文件符 fds[0].events = POLLIN;//等待的事件类型 fds[1].fd = STDOUT_FILENO; fds[1].events = POLLOUT; ret = poll(fds, 1, 5000); if(ret == -1){... 阅读全文
摘要:
#include <stdio.h>#include <sys/time.h>#include <sys/types.h>#include <unistd.h>int main(void){ struct timeval tv; fd_set readfds; int ret; //等待stdin的输入 FD_ZERO(&readfds);//移除所有 FD_SET(STDIN_FILENO, &readfds);//加入分组 //FD_CLR用来移除 //设置等待时间 tv.tv_sec = 5; tv.tv_usec = 0; 阅读全文
摘要:
1、ext2_add_link的执行过程,函数的定义如下:int ext2_add_link (struct dentry *dentry, struct inode *inode){ struct inode *dir = dentry->d_parent->d_inode;//父节点的inode const char *name = dentry->d_name.name;//目录名 int namelen = dentry->d_name.len;//名字长度 unsigned chunk_size = ext2_chunk_size(dir);//块大小 ... 阅读全文