|
|
我的程序在执行select后就死掉了(重启系统),但是poll函数中又没有出错!是不是poll后系统还会做一些别的事情。
我在驱动的poll里打印信息
- printk("after poll!\n");
- return imask;
复制代码
在应用程序中也打印信息
- pagesize = getpagesize();
- printf("page size is %d\n",pagesize);
- pic_buf = (char *)malloc(PIC_SIZE);
- buf_record = pic_buf;
- if(NULL == pic_buf){
- printf("fail to alloc memory!\n");
- return -1;
- }
- printf("after malloc!\n");
- tv.tv_sec = 5;
- tv.tv_usec = 0;
- FD_ZERO(&read_set);
- FD_SET(pic_fd, &read_set);
-
- pid = vfork();
- if(0 == pid){
- ioctl(pic_fd, EN_START_JPEG, 0);
- _exit(0);
- }
- waitpid(pid,0,0);
- printf("after start jpeg!\n");
- ret = select(pic_fd+1, &read_set, NULL, NULL, &tv);
- printf("after select!\n");
- if (FD_ISSET(pic_fd, &read_set)){
- jpeg_len = read(pic_fd,pic_buf,PIC_SIZE);
- printf("jpeg len is %d\n",jpeg_len);
- }
复制代码
但结果往往打印完“after poll!”后就死掉了,但也不是每次都死,要么连续死,死后重启还是死,要么连续不死,如果开始不是,程序重复执行也不死,但中间过一段时间不执行,再执行的话就有可能死。而且打印信息的次序也会错掉,搞不懂为什么!
- video_test
- page size is 4096
- after after poll!
- malloc!
- after start jpeg!
- Data access misaligned address violation
- - Attempted misaligned data memory or data cache access.
- DCPLB_FAULT_ADDR=000087c4
复制代码 |
|