Re: rebuild kernel add syscall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I mean   weather  i can use sys_open  in   /kernel/sys.c
Or how can i test it  but i am  in user space ?

2011/3/10 xinyou yan <yxy.716@xxxxxxxxx>:
> 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  ?
>
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux