我正在开发与我的用户空间C应用程序通信的Linux内核模块。 在这个模块中,我正在创建一个线程。 此外,我需要知道用户空间进程的pid,因此我正在使用pid_task(find_vpid(pid), PIDTYPE_PID)函数。
这是我面临问题的模块:
#include
#include
#include
#include //siginfo
#include //rcu_read_lock
#include //find_task_by_pid_type
#include
#include
#include
#include
#include
#include
#include
#include
#define SIG_TEST 44 // we choose 44 as our signal number (real-time signals are in the range of 33 to 64)
#define BTN_FILE_PATH "/dev/input/event0"
char *str = BTN_FILE_PATH;
int file;
struct file *f; // keyboard driver
// prototypage des fonctions read_in_thread & read_pid
int read_in_thread(void *data);
static ssize_t read_pid(struct file *pfile, char __user *buffer, size_t length, loff_t *offset);
static ssize_t write_pid(struct file *pfile, const char __user *buffer,
size_t length, loff_t *offset)
{
return 0;
}
struct read_args {
struct file *pfile;
const char __user *buffer;
size_t length;
loff_t *offset;