Understanding of write file operation in char driver

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

 



I am learning char drivers.But i didn't understand write operation of char device driver properly. the below is my write operation
static ssize_t dev_write(struct file *fil,const char __user *buff,size_t len,loff_t *off)
{
    pr_info("user input string %s\n",buff);
    pr_info("user input string len %d\n",len);
    return len;
}

my doubt is if i write into my device like
echo "hello" > /dev/myDev
it is giving different behaviour like below is the dmesg
[20596.975355] user input string hello [20596.975355] 77b9e4 [20596.975355] insmod insmod [20596.975355] n/zeitgeist-daemon [20596.975355] atives [20596.975355] [20596.975355] vars "${upargs[@]}" [20596.975355] cur cword words=(); [20596.975355] local upargs=() upvars=() vcur vcword vprev vwords; [20596.975355] while getopts "c:i:n:p:w:" flag "$@"; do [20596.975355] case $flag in [20596.975355] c) [20596.975355] vcur=$OPTARG [20596.975355] ;; [20596.975355] i) [20596.975355] vcword=$OPTARG [20596.975355] ;; [20596.975355] n) [20596.975355] exclude=$OPTARG [20596.975355] ;; [20596.975355] p) [20596.975355] vprev=$OPTARG [20596.975355] ;; [20596.975355] w) [20596.975355] vwords=$OPTARG [20596.975355] ;; [20596.975358] user input string len 6 [20596.975361] Device closed

so i didn't understand what is happening inside .Can any one please explain what is happening?
Thanks & Regards
Prasad
_______________________________________________
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