[問題] Kernel module 相關問題

看板LinuxDev作者 (flawless)時間5年前 (2019/03/17 20:32), 5年前編輯推噓1(109)
留言10則, 4人參與, 5年前最新討論串1/1
想請教各位大大,kernel module 裡面是不是不能用到 kernel header 以外的 include path?目前想把 stdint.h 引用進去,可是發現 kernel header 裡面的 stdint.h 內容 跟 /usr/include 那邊的stdint.h 不一樣,而且直接引用會出錯(include_next 相關), 可是假如強制餵給 make (-I/use/include) 又會有重複宣告的問題,網路上看到有人這 樣解決...。不知道想引用的話是不是有專門的方法呢? 謝謝大家! 手機發文,傷眼抱歉! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 101.12.20.170 ※ 文章網址: https://www.ptt.cc/bbs/LinuxDev/M.1552825937.A.1EB.html

03/17 20:49, 5年前 , 1F
user space與kernel space的header本來就是分開的吧?
03/17 20:49, 1F

03/17 22:22, 5年前 , 2F
感謝回覆。所以換句話說,kernel module 裡面不會有用
03/17 22:22, 2F

03/17 22:22, 5年前 , 3F
到stdint.h的程式碼嘛?這樣 kernel header 那邊的 stdi
03/17 22:22, 3F

03/17 22:22, 5年前 , 4F
nt.h 是專用來做什麼的嗎?
03/17 22:22, 4F
※ 編輯: dces4212 (101.12.20.170), 03/17/2019 22:23:04 ※ 編輯: dces4212 (101.12.20.170), 03/17/2019 22:23:47

03/18 17:12, 5年前 , 5F
你要 stdint.h 幹嘛?
03/18 17:12, 5F

03/20 15:33, 5年前 , 6F
改 #include <linux/types.h> ?
03/20 15:33, 6F

03/20 15:43, 5年前 , 7F
啊, 其實 #include <linux/kernel.h> 也包含了.
03/20 15:43, 7F

03/27 02:58, 5年前 , 8F
後來發現我應該要用kernel專用的資料型態(u32, u64...e)
03/27 02:58, 8F

03/27 02:58, 5年前 , 9F
*etc
03/27 02:58, 9F

03/27 02:59, 5年前 , 10F
感謝兩位大大
03/27 02:59, 10F
文章代碼(AID): #1SZZvH7h (LinuxDev)
文章代碼(AID): #1SZZvH7h (LinuxDev)