applepie 发表于 2003-5-26 19:46:41

请教copy_to_user的用法

我接着"请教设备驱动程序"问:


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;
}


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

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

请指教

Dragonfly 发表于 2003-5-26 22:02:52

u should include <asm/uaccess.h>
read LDD2 for detail. i bet the book has this.

applepie 发表于 2003-5-26 22:37:20

谢谢
原来我没有 include

Dragonfly 发表于 2003-5-26 22:42:54

make sure u read LDD2 Page 78-79 carefully.

applepie 发表于 2003-5-27 12:42:00

我还没这本书呢

Dragonfly 发表于 2003-5-27 21:25:12

there is an e version online for freely download from its publisher site. i think is oriley..
页: [1]
查看完整版本: 请教copy_to_user的用法