lkml.org 
[lkml]   [1997]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectSystem call Implementation....
Date

hi,


struct sk_buff *prak_str1;

I have implented a system call like this......

asmlinkage int sys_test(struct sk_buff *praks_ptr,char *pkt_data)
{
cli();
if(prak_str1 !=NULL) /*in netif_rx() function this will be updated
as the pointer to skbuff which netif_rx()
gets as argument so if no packet is there
this will be null*/
{
memcpy_tofs(praks_ptr,prak_str1,sizeof(struct sk_buff));
memcpy_tofs(pkt_data,prak_str1->data,prak_str1->len);
prak_str1 = NULL;
if_pkt_flag = 0;
}
else
{
if_pkt_flag = -1;
}
sti();
return(if_pkt_flag);
}


and i called it in this way,from an application pgm................


main()
{
struct sk_buff *prak_ptr;
char *data ;
int ret_val;
int fd;
data = (char *)malloc(1500 * sizeof(char));
prak_ptr = (struct sk_buff *)malloc(sizeof(struct sk_buff));
fd = open("./lec",O_RDWR|O_CREAT|O_APPEND);
while(1)
{
__asm__ ("movl $141, %eax\n\t"
"movl -4(%ebp),%ebx\n\t"
"movl -8(%ebp),%ecx\n\t"
"int $128\n\t"
"pushl %eax\n\t");

ret_val = func();
if (ret_val == 0)
{
printf("%d\n",prak_ptr->len);
}
}
}
int func(int tmp)
{
return(tmp);
}




It gives an out of memory error.....
Can u please help me.................










\
 
 \ /
  Last update: 2005-03-22 13:39    [W:0.022 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site