System call Implementation....

Prakash D (prakashd@wipinfo.soft.net)
Wed, 9 Jul 1997 20:11:32 +0500 (GMT+0500)


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.................