我可以在 C 代碼中使用 LKM 內核代碼中的“getpwuid”嗎? (Can I use "getpwuid" from kernel code in LKM in c code?)


問題描述

我可以在 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 Happyuser4822941)

參考文件

  1. Can I use "getpwuid" from kernel code in LKM in c code? (CC BY‑SA 2.5/3.0/4.0)

#linux-kernel #linux






相關問題

選擇 Linux I/O 調度程序 (Selecting a Linux I/O Scheduler)

Android可加載內核模塊錯誤:賦值使指針從沒有強制轉換的整數 (Android Loadable Kernel Module Error: assignment makes integer from pointer without a cast)

文件描述符中實際存儲了多少信息? (How much information is actually stored in a file descriptor?)

hrtimer mengulangi tugas di kernel Linux (hrtimer repeating task in the Linux kernel)

我可以在 C 代碼中使用 LKM 內核代碼中的“getpwuid”嗎? (Can I use "getpwuid" from kernel code in LKM in c code?)

將傳入數據包注入網絡接口 (Injecting an incoming packet to a network interface)

無法從 D3 睡眠狀態喚醒 pci 總線 (Unable to wake pci bus form D3 sleep satate)

在 Linux 中使用 DMA 的最簡單方法 (Easiest way to use DMA in Linux)

Linux I2C 通信問題 (Linux I2C communication issues)

理解 perf stat 輸出中的數字 (Make sense of numbers in perf stat output)

我如何在 amazon Linux AMI 上找到我的 Linux 發行版? (How i could find my Linux distribution on amazon Linux AMI?)

將參數傳遞給系統調用 (Passing arguments to system calls)







留言討論