QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2505|回复: 5

请教copy_to_user的用法

[复制链接]
发表于 2003-5-26 19:46:41 | 显示全部楼层 |阅读模式
我接着"请教设备驱动程序"问:

[code:1]
char *words="aaabbbccc";

ssize_t scull_read(struct file *filp, char *buf, size_t count,
                loff_t *f_pos)
{
        printk("read %s\n",words);
       
        copy_to_user(buf,words,count);
        return 0;
}
[/code:1]

这里 copy_to_user 不知道咋用
copy_to_user(buf,words,count);  是我想当然的写的

编译通过后
#insmod chard.o
chard.o: unresolved symbol copy_to_user

请指教
发表于 2003-5-26 22:02:52 | 显示全部楼层
u should include <asm/uaccess.h>
read LDD2 for detail. i bet the book has this.
回复

使用道具 举报

 楼主| 发表于 2003-5-26 22:37:20 | 显示全部楼层
谢谢  
原来我没有 include
回复

使用道具 举报

发表于 2003-5-26 22:42:54 | 显示全部楼层
make sure u read LDD2 Page 78-79 carefully.
回复

使用道具 举报

 楼主| 发表于 2003-5-27 12:42:00 | 显示全部楼层
我还没这本书呢
回复

使用道具 举报

发表于 2003-5-27 21:25:12 | 显示全部楼层
there is an e version online for freely download from its publisher site. i think is oriley..
回复

使用道具 举报

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

本版积分规则

GMT+8, 2024-6-16 04:42 , Processed in 0.067838 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

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