亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: 關(guān)于copy_to_user [打印本頁(yè)]

作者: yangfan876    時(shí)間: 2012-08-22 20:02
標(biāo)題: 關(guān)于copy_to_user

為什么我的copy_to_user函數(shù)實(shí)驗(yàn)不成功....我用添加內(nèi)核模塊的方法添加了一個(gè)系統(tǒng)調(diào)用,然后在用戶(hù)程序中調(diào)用這個(gè)系統(tǒng)調(diào)用,同時(shí)把用戶(hù)buf地址傳入系統(tǒng)調(diào)用中,但是在內(nèi)核模塊中調(diào)用copy_to_user有問(wèn)題,用戶(hù)態(tài)中的數(shù)據(jù)不對(duì)。幫我看看....

用戶(hù)態(tài)代碼:
  1 #include<stdio.h>
  2 #include<sys/types.h>
  3
  4 struct user_buf
  5 {                                                                                   
  6     int pid;
  7 };
  8
  9 main ()
10 {
11     struct user_buf user_data={0};
12     syscall (223, &user_data);
13     printf ("user pid is %d", user_data.pid);
14 }



內(nèi)核態(tài)代碼:
21 asmlinkage int my_syscall (struct kernel_buf *user_buf)
22 {
23     struct kernel_buf temp_buf;
24     printk ("the current process's pid is %d\n", current->pid);
25     copy_to_user (user_buf, &temp_buf, sizeof (temp_buf));
26 }     

就這些....
作者: janetliu9    時(shí)間: 2012-08-23 14:29
根本沒(méi)調(diào)到你自定義的系統(tǒng)調(diào)用。修改下系統(tǒng)調(diào)用表,用你自己的my_syscall把系統(tǒng)的223號(hào)系統(tǒng)調(diào)用替換掉,重編內(nèi)核。




歡迎光臨 Chinaunix (http://www.72891.cn/) Powered by Discuz! X3.2