FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 03-10-2011, 06:17 AM
xinyou yan
 
Default rebuild kernel add syscall

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,06 00);
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@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 03-10-2011, 06:38 AM
xinyou yan
 
Default rebuild kernel add syscall

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@gmail.com>:
> 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,06 00);
> * *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@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 

Thread Tools




All times are GMT. The time now is 05:46 PM.

VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org