code

asmlinkage void sys_print_val(int a)
{
    printk("in sys_print_val: %d\n",a);
    return;
}

asmlinkage void sys_str2num(char __user *str, int str_len, int __user *ret)
{
    char s[1000];
    int num=0, i;
    if (!copy_from_user(s, str, str_len))
    {
        for (i=0;i<str_len;i++) num=num*10+*(s+i)-'0';
    }
    copy_to_user(ret, &num, sizeof(int));
}

 

posted @ 2019-04-29 20:13  fqqq  阅读(181)  评论(0编辑  收藏  举报