3663| 2
|
copy_from_user函数的使用问题 |
20金钱
最佳答案App应用程序中使用ioctl
定义变量:int arg;
两种方式:
1.ioctl(fp, cmd, arg) 的时候会将arg的值送入内核(值传递),内核可直接使用。
2.ioctl(fp, cmd, &arg)的时候送入内核的值是用户地址(地址传递),所以内核在使用的时候需要用copy_from_user将数据拷贝后使用.
内核中:
定义变量:int value;
拷贝变量:copy_from_user(&value, (int *)arg, sizeof(int));
然后使用value也就是arg的 ...
| ||
| ||
He who fights with monsters should look to it that he himself does not become a monster, when you gaze long into the abyss, the abyss also gazes into you.
过于执着就会陷入其中,迷失自己,困住自己。 |
||
| ||
|手机版|OpenEdv-开源电子网
( 粤ICP备12000418号-1 )
GMT+8, 2025-2-23 04:44
Powered by OpenEdv-开源电子网
© 2001-2030 OpenEdv-开源电子网