Create a test folder in the root src: src/linux-3.4/testing/ , then paste it into this folder:
- file containing syscall code: strcpy.c
#include <linux/linkage.h> #include <linux/kernel.h> asmlinkage long sys_strcpy(char *dest, char *src) { int i=0; while(src[i]!='\0') { dest[i]=src[i++]; } dest[i]='\0'; printk(" Done it "); return 0; }
and a Makefile that contains only the following line:
obj-y:=strcpy.o
Add an entry to the syscall table and the function prototype:
- edit the src/linux-3.4/arch/x86/syscalls/syscall_32.tbl , adding this line to record 223, free
223 i386 strcpy sys_strcpy
Edit the src/linux-3.4/include/linux/syscalls.h file by adding a function prototype
asmlinkage long sys_strcpy(char *dest, char *src);
Edit the main Makefile in the src root ( src/linux-3.4/Makefile ), adding the previously created test folder, as shown below:
core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ testing/
source share