简体   繁体   English

如何从用户空间应用程序插入内核模块?

[英]How to insert kernel module from userspace app?

I am looking for one thing: 我在寻找一件事:

How can i insert kernel module from userspace program? 如何从用户空间程序插入内核模块? can anyone please provide me any example related to this scenario? 谁能给我提供与此情况有关的任何示例吗?

Thanks 谢谢

Raheel 拉海尔

After a little search, I found that there's a system call named 稍作搜索后,我发现有一个名为

#include <linux/module.h>
int init_module(const char *name, struct module *image);

You can take a look at this man page if you want further details. 如果需要更多详细信息,可以查看此手册页。
http://www.kernel.org/doc/man-pages/online/pages/man2/init_module.2.html http://www.kernel.org/doc/man-pages/online/pages/man2/init_module.2.html

Thank you Adel C Kod, I just resolved that issue, here I am posting a simple sample code: 谢谢Adel C Kod,我刚刚解决了这个问题,在这里我发布了一个简单的示例代码:

char cmnd[10];

if (strcmp(cmnd, "insert")==0) {
  system ("/sbin/insmod /home/xyzUBUNtu/Desktop/MyMod/kernel1.ko");
  printf("Your Module inserted");
  return 1;
}

thanks 谢谢

Raheel.. Raheel ..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 kernel 模块头导出到用户空间 - Export kernel module headers to userspace 从Linux内核模块共享内存,以供用户空间进程访问 - Share memory from a Linux kernel module for a userspace process to access 如何确定用户空间进程是否已连接到netlink内核模块? - how to find out if userspace process is connected to netlink kernel module? lm75内核模块在用户空间中可用 - lm75 kernel module available in userspace 如何通过信号(send_sig_info)将数据从 kernel 发送到用户空间? - How to send data from kernel to userspace through signals (send_sig_info)? 在用户空间中使用内核功能 - Use Kernel functions in userspace 如何使用netlink套接字进行内核 - 用户空间通信Android - How to use netlink sockets for kernel - userspace communication Android 如何区分内核中的软锁定和用户空间中的softlockup? - How to tell the difference between soft lockup in kernel and softlockup in userspace? 与用户空间上下文切换相比,内核上下文切换有多贵? - How expensive are kernel context switches compared to userspace context switches? 在free()之后,用户空间程序如何将内存传递回内核? - How do userspace programs pass memory back to the kernel after free()?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM