Understanding of write file operation in char driver
me storage
me.storage126 at gmail.com
Thu Jan 1 03:24:40 EST 2015
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150101/835ee5a1/attachment.html
More information about the Kernelnewbies
mailing list