Add a system call to linux source
2010-11-15 21:10
295 查看
1. get linux kernel source and uncpmpres it.
2. edit /include/linux/syscalls.h and add declaration of the function
asmlinkage long sys_test();
3. edit /kernel/sys.c and add the implement of system call
asmlinkage long sys_test(){
printk("my system call/n");
return 0;
}
4. edit /arch/arm or i86(your object platform)/include/asm/unistd.h. add system call number define
#define __NR_test (__NR_SYSCALL_BASE + 365(inclresed 1 than the last system call).
5. edit /arch/arm/kernel/call.S or /arch/x86/kernel/syscall_table.S add
.long sys_test
6. make to rebuild linux and start kernel. write progra as folowing:
#include <Linux/errno.h>
#include<sys/syscall.h>
#include <Linux/unistd.h>
long errno; //this is the return code from the system call
//this is a macro defined in unistd.h to help prototype sys calls
_syscall2(0, test);
main() {
test();
}
2. edit /include/linux/syscalls.h and add declaration of the function
asmlinkage long sys_test();
3. edit /kernel/sys.c and add the implement of system call
asmlinkage long sys_test(){
printk("my system call/n");
return 0;
}
4. edit /arch/arm or i86(your object platform)/include/asm/unistd.h. add system call number define
#define __NR_test (__NR_SYSCALL_BASE + 365(inclresed 1 than the last system call).
5. edit /arch/arm/kernel/call.S or /arch/x86/kernel/syscall_table.S add
.long sys_test
6. make to rebuild linux and start kernel. write progra as folowing:
#include <Linux/errno.h>
#include<sys/syscall.h>
#include <Linux/unistd.h>
long errno; //this is the return code from the system call
//this is a macro defined in unistd.h to help prototype sys calls
_syscall2(0, test);
main() {
test();
}
相关文章推荐
- Add a system call to the linux kernel in Ubuntu
- Linux Systemcall By INT 0x80、Llinux Kernel Debug Based On Sourcecode
- project 1 Adding a System Call to the Linux Kernel(初版)
- add a splash to load system is easy:1:add spashWnd,then call it in instance ,when some work ok,close it.
- How can I add a user to a group under Linux operating system?
- How to Use `strace` to Trace the System Call in Linux
- linux下向clearcase中提交多级目录(clearcase add to source recursively)
- [Fw]How to Add a System Call(Fedora Core 6 Kernel : 2.6.18)
- Adding a Custom System Call to Ubuntu Linux in [C]
- add a system call in linux kernel
- Howto: Linux Add User To Group -- 再次无语国内转帖抄袭之风
- [From Linux Toy] inxi– bash script to get system information
- call to unavailable function system not available on ios问题解决
- Rockie's Android Porting Guide(3)——Add correct keymap to your system
- How to set up a mail server on a GNU / Linux system
- How to add a linked source folder in Android Studio?
- get system call table in x86-64 Linux
- How to check system status with basic Linux utilities.
- createDataSource, and add new rows on the datagrid to be filled out.
- Select system call limitation in Linux