Re: Simple Misc Driver - Problem with string copy to user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think it is good for you to read LDD3 or google some corresponding
materials at first.

2014-05-27 20:48 GMT+08:00 Lucas Tanure <tanure@xxxxxxxxx>:
> Hi!
>
> Goal, when the user do :
> # head -1 /dev/miscdrv
>
> The driver prints:  Hello World!
>
> Steps:
> # Make
> # insmod misc.ko
> # head -1 /dev/miscdrv
>
> Why my driver doesn't work ?
>
> What is worg with my read operation?
>
> static ssize_t
> misc_drv_read(struct file *filp, char __user * buf, size_t count, loff_t *
> offp){
>     int nbytes;
> char * string = "hello World";
> nbytes = copy_to_user(buf, string, 12);
> return nbytes;
> }
>
>
> --
> Lucas Tanure
> Brazil
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@xxxxxxxxxxxxxxxxx
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux