問題描述
我可以在 C 代碼中使用 LKM 內核代碼中的“getpwuid”嗎? (Can I use "getpwuid" from kernel code in LKM in c code?)
我想要一個與內核空間中的 LKM 模塊中的 getpwuid() 等效的庫,以獲取“passwd”結構。您能建議我如何從內核空間而不是用戶空間獲取“passwd”結構嗎?謝謝你。//DAUM
參考解法
方法 1:
It is extremely unlikely you have any valid reason to do this. You will have to elaborate.
In short, the setup can be quite complicated and e.g. involve querying databases on different machines. For /joke/ purposes one could implement that by having a userspace helper for the kernel.
(by Happy、user4822941)