linux-kernel

Execute shell command in kernel module

痴心易碎 提交于 2021-02-06 12:49:22
问题 Is it possible to execute shell command in kernel module. I know that we can do it in user space C code using system subroutine. I am debugging a kernel module which has memory leak issue. After doing insmod and rmmod module.ko in an infinite loop, system goes out of memory within few minutes with 8G RAM. It would be helpful to know memory status using free command before and after the call to API responsible to free memory so i can know that API is working or not. This is the way i am

how to port c/c++ applications to legacy linux kernel versions

天大地大妈咪最大 提交于 2021-02-06 10:00:18
问题 Ok, this is just a bit of a fun exercise, but it can't be too hard compiling programmes for some older linux systems, or can it? I have access to a couple of ancient systems all running linux and maybe it'd be interesting to see how they perform under load. Say as an example we want to do some linear algebra using Eigen which is a nice header-only library. Any chance to compile it on the target system? user@ancient:~ $ uname -a Linux local 2.2.16 #5 Sat Jul 8 20:36:25 MEST 2000 i586 unknown

Study device driver source files?

北城余情 提交于 2021-02-06 09:34:04
问题 I want to study the source files of some of the device drivers that are installed and loaded on either a raspberry pi(raspian), beaglebone(debian) or a my laptop(ubuntu). My aim is to learn how to properly implement my own modules by studying the source files of some drivers that actually works. I am particularly interested in drivers that communicates with actual hardware (USB, I2C, SPI, UART etc). Can someone tell me how to find these sources? are they available in some particular folder i

How programmatically get Linux process's stack start and end address?

泪湿孤枕 提交于 2021-02-06 02:39:43
问题 For a mono threaded program, I want to check whether or not a given virtual address is in the process's stack. I want to do that inside the process which is written in C. I am thinking of reading /proc/self/maps to find the line labelled [stack] to get start and end address for my process's stack. Thinking about this solution led me to the following questions: /proc/self/maps shows a stack of 132k for my particular process and the maximum size for the stack (ulimit -s) is 8 mega on my system.

How programmatically get Linux process's stack start and end address?

ε祈祈猫儿з 提交于 2021-02-06 02:39:29
问题 For a mono threaded program, I want to check whether or not a given virtual address is in the process's stack. I want to do that inside the process which is written in C. I am thinking of reading /proc/self/maps to find the line labelled [stack] to get start and end address for my process's stack. Thinking about this solution led me to the following questions: /proc/self/maps shows a stack of 132k for my particular process and the maximum size for the stack (ulimit -s) is 8 mega on my system.

How programmatically get Linux process's stack start and end address?

橙三吉。 提交于 2021-02-06 02:36:37
问题 For a mono threaded program, I want to check whether or not a given virtual address is in the process's stack. I want to do that inside the process which is written in C. I am thinking of reading /proc/self/maps to find the line labelled [stack] to get start and end address for my process's stack. Thinking about this solution led me to the following questions: /proc/self/maps shows a stack of 132k for my particular process and the maximum size for the stack (ulimit -s) is 8 mega on my system.

How programmatically get Linux process's stack start and end address?

こ雲淡風輕ζ 提交于 2021-02-06 02:35:14
问题 For a mono threaded program, I want to check whether or not a given virtual address is in the process's stack. I want to do that inside the process which is written in C. I am thinking of reading /proc/self/maps to find the line labelled [stack] to get start and end address for my process's stack. Thinking about this solution led me to the following questions: /proc/self/maps shows a stack of 132k for my particular process and the maximum size for the stack (ulimit -s) is 8 mega on my system.

How programmatically get Linux process's stack start and end address?

删除回忆录丶 提交于 2021-02-06 02:34:17
问题 For a mono threaded program, I want to check whether or not a given virtual address is in the process's stack. I want to do that inside the process which is written in C. I am thinking of reading /proc/self/maps to find the line labelled [stack] to get start and end address for my process's stack. Thinking about this solution led me to the following questions: /proc/self/maps shows a stack of 132k for my particular process and the maximum size for the stack (ulimit -s) is 8 mega on my system.

why parallel execution on java compile take linear growth in time

旧时模样 提交于 2021-02-04 12:51:05
问题 time javac Main.java --> 0m1.050s time javac Main.java & javac Main.java --> 0m1.808s time javac Main.java & javac Main.java & javac Main.java --> 0m2.690s time javac Main.java & ... 8 time --> 0m8.309s When we run javac command in parallel and with each increase in javac command ~1 sec gets added for all the javac command to complete. Why is there a linear growth is time ? Is all javac process while running involved in some kind on locks , if yes how to overcome it so as not to have a linear

Is kmalloc allocation not virtually contiguous?

可紊 提交于 2021-02-04 06:12:54
问题 I found that kmalloc returns physically and virtually contiguous memory. I wrote some code to observe the behavior, but only the physical memory seems to be contiguous and not the virtual. Am I making any mistake? #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/moduleparam.h> MODULE_LICENSE("GPL"); static char *ptr; int alloc_size = 1024; module_param(alloc_size, int, 0); static int test_hello_init(void) { ptr = kmalloc(alloc_size,GFP_ATOMIC); if(