找回密码
 注册
查看: 976|回复: 2

调用mmap函数有问题,想用erron这个全局变量,可怎么用

[复制链接]
发表于 2006-8-1 10:06:23 | 显示全部楼层 |阅读模式
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <signal.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <linux/types.h>
#include <linux/videodev.h>
在下面有个函数。我做摄像头采集数据的
unsigned char *camera_video_mmap(int cam_fd, struct video_mbuf *mbuf)
{       
        unsigned char *grab_data;
        int debug_temp;

         if((debug_temp == camera_video_mbuf(cam_fd, mbuf)) < 0)
         {       
                fprintf(stderr,"the calling of camera_video_mbuf method is failure!\n");  
                exit(1);
          }
                if((grab_data = (unsigned char *)mmap(0, mbuf->size, PROT_READ | PROT_WRITE, MAP_SHARED, cam_fd, 0)) == MAP_FAILED)
        {
                if(erron == EINVAL) fprintf(stderr, "the erron NO is erron=%d\n",erron);
                fprintf(stderr,"the calling of mmap method to get the value of grab_data  is failure!\n");  
                exit(1);
        }
       
        return (grab_data);
}
}
//////////////////////////////////////////////////////////////////////////////
我这个mmap函数调用不起。返回的是MAP_FAILED。。。我想从erron中看到错误类型。。
可是我编译的时候。gcc -c camera.c(注camera.c是我保存的文件名)提示我没有定义erron这个变量。。
怎么回事情啊。。。

请教给位了。。。
发表于 2006-8-1 10:48:39 | 显示全部楼层
不是errno 么
回复

使用道具 举报

 楼主| 发表于 2006-8-1 15:11:15 | 显示全部楼层
呵呵。对啊。。兄弟我失误了。。。。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2025-2-6 21:39 , Processed in 0.023212 second(s), 15 queries .

© 2001-2025 Discuz! Team. Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表