看板 LinuxDev 關於我們 聯絡資訊
借題發問, 本人linux 初心者, 因為課程的關係所以在練習新增kernel, 我參考的網頁是: http://www.functor.me/hello-kernel/http://it.livekn.com/2013/01/kernel-system-call.html? showComment=1430913871922#c8818990812637366221 也確實有跑出結果來, https://drive.google.com/file/d/0Bx8PQxTU7Vk8U2dKY1pYdFVlem8/view 但是我希望能用類似 common_hello() 方法 而不是用syscall()來呼叫自己新增的syscall, 所以在估狗大神的幫忙之下湊出了下面這個結果: https://drive.google.com/file/d/0Bx8PQxTU7Vk8bXQ4X1lwN1hHNlU/view 然後我就不知道該怎麼繼續下一步了... Orz 請問我是不是做錯了什麼步驟或漏了什麼而不自知 ?_____? 然後爬文和google都有提到Syscall macros被移除掉了, 但是因為找到的資料都是2006左右時間久遠的話題, 所以不太確定現在情況是...? 如果是被移除掉的話我該怎麼達到我的目的呢? 作業系統: Ubuntu 14.04 (32位元) 核心: 3.19.6 謝謝大家 :) ※ 引述《sacanner (Sam)》之銘言: : 給個簡單的範例程式 : 參考看看吧~~ : -------------------------- : #include <stdio.h> : #include <asm/unistd.h> : #include <unistd.h> : #include <stdlib.h> : #include <string.h> : int errno; : #define __NR_occupy 289 //自己定義的數字 : _syscall1(long,occupy,int,cpu_id); : int main(int argc,char *argv[]) : { : int cpu_id=0; : occupy(cpu_id); : return 0; : } : ※ 引述《pinkisme ()》之銘言: : : 我是在Fedora上增加一個新的system call, : : 下面是呼叫的程式 : : include <linux/unistd.h> : : #include <sys/syscall.h> : : #include <errno.h> : : #include <stdio.h> : : int main() : : { : : int rc; : : rc = syscall(318,15); : : printf("RC=%d\n",rc); : : if(rc==-1) : : printf("ERROR\n"); : : return 0; : : } : : 可是跑出來卻還是沒有呼叫自訂的system call : : 想請問一下可能是哪個環節出問題嗎? : : 謝謝 -- 今天和明天都是藍綠藻可以想像的未來 一陳不變的日子堆積了五公分厚的灰塵 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 163.22.18.74 ※ 文章網址: https://www.ptt.cc/bbs/LinuxDev/M.1430917711.A.4A3.html
jserv: 可以請你的老師不要再出這種單調的題目了嗎? :) 06/03 11:14