QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1208|回复: 0

lseek返回老是-1,请问如何解决

[复制链接]
发表于 2006-8-31 16:35:55 | 显示全部楼层 |阅读模式
上层程序:
if (lseek(fd,writeaddress,SEEK_SET)==-1){
perror("can't lseek");
}

对应的驱动static int iic_llseek(struct file *filp,loff_t off,int whence){
loff_t newpos;
switch(whence){
case 0:
newpos=off;
break;
case 1:
newpos=filp->f_pos+off;
break;
default:
return -EINVAL;
}
if(newpos<0)
return -EINVAL;
filp->f_pos=newpos;
return newpos;
}

运行上层程序
输入writeaddress=2
在驱动中跟踪传递的值
newpos=2
但上层应用程序出错提示
can't lseek: Value too large for defined data type
不知道是什么原因???
您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-5-13 19:08 , Processed in 0.107640 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

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