rebuild kernel add syscall

xinyou yan yxy.716 at gmail.com
Thu Mar 10 07:17:35 UTC 2011


I want to and a new syscall
1  add
.long sys_mysyscall
in        arch/x86/kernel/syscall_table_32.S

2    add
       #define   __NR_mysyscall   341
in    arch/x86/include/asm/unistd_32.

3.    add

asmlinkage int sys_mysyscall(char* sourceFile,char* destFile)
{
    int source=sys_open(sourceFile,O_RDONLY,0);
    int dest=sys_open(destFile,O_WRONLY|O_CREAT|O_TRUNC,0600);
    char buf[1024];
    mm_segment_t fs;
    fs = get_fs();
    set_fs(get_ds());
    int nread;

    if(source>0 && dest>0)
    {
            while((nread=sys_read(source,buf,1024)) > 0)
                       sys_write(dest,buf,read);
    }
    else
    {
             printk("Error!");
    }
    sys_close(source);
    sys_close(dest);
    set_fs(fs);
    return 0;
}
in  kerrnel/sys.c

4. make menuconfig
5. make  all
6  make  modules_install

reboot


Now I want just do it one time
How can i make sure the  new syscall here is mysyscall  work fine  ?


More information about the users mailing list