From owner-freebsd-hackers@FreeBSD.ORG Wed Jan 11 16:46:00 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A98C416A41F for ; Wed, 11 Jan 2006 16:46:00 +0000 (GMT) (envelope-from kamal_ckk@yahoo.com) Received: from web30009.mail.mud.yahoo.com (web30009.mail.mud.yahoo.com [68.142.200.72]) by mx1.FreeBSD.org (Postfix) with SMTP id D19AB43D48 for ; Wed, 11 Jan 2006 16:45:59 +0000 (GMT) (envelope-from kamal_ckk@yahoo.com) Received: (qmail 5716 invoked by uid 60001); 11 Jan 2006 16:45:59 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=gsuNxe6gkDWPyrNORQmgXZGZLk1Mh23RWnxWTN9RTnOwv28XM4VNnqrUUdrl94+BSzz5blDLgBG1dZ/2HPucEhbzbmYYiWkiNU+tCKxGZh6wy6fUz2AeBCEfGXAvtrCyWAABQA7I2QssJi26jFyMyOA7ZksblM+pSR+JEnP1oqc= ; Message-ID: <20060111164559.5714.qmail@web30009.mail.mud.yahoo.com> Received: from [202.79.62.13] by web30009.mail.mud.yahoo.com via HTTP; Wed, 11 Jan 2006 08:45:59 PST Date: Wed, 11 Jan 2006 08:45:59 -0800 (PST) From: kamal kc To: freebsd In-Reply-To: <200601110903.18120.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: rescheduling tasks using swi_add() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2006 16:46:00 -0000 --- John Baldwin wrote: > > the man page discussed the swi_add() and > swi_sched() > > functions. > > > > what i don't understand is, how do i register my > > handler > > function ?? > > if i use the swi_add() for that purpose what > > do i use for the void *arg argument. > > > > and how can i dispatch control to the software > > interrupt handler ?? > > the swi_sched() uses only the cookie and the flags > > arguments. > > there is no way i can pass arguments to my handler > > function .. > > > > i guess most of you are familiar with this and can > > help me > > out ...... > > Queue a task to a taskqueue. Behind the scenes that > will invoke a swi_add if > you use the taskqueue_swi queue. However, given > that you want to do some > rather complicated work, you'd be better off > creating a dedicated taskqueue > thread and queueing tasks off to it I think. > thanks for the suggestion on the taskqueue. i tried it on my dummy kernel module and got some output but i am not sure if i followed the correct steps to use the taskqueue. the only thing i found was the man pages and the taskqueue.h. here is the code: ----------------------- struct taskqueue_arguments { int a; int b; }; void taskqueue_function(void *,int); typedef void taskqueue_function_t(void *,int); /* taskqueue function */ void taskqueue_function(void *arguments,int int_arg) { struct taskqueue_arguments *arg; arg=(struct taskqueue_arguments *)arguments; printf("\ntakqueue_function was called the args are %d %d",arg->a,arg->b); return; } /* function implementing the syscall */ static int hello(struct thread *td, void *arg) { ......... struct task mytask; taskqueue_function_t *taskqueue_function_ptr; taskqueue_function_ptr=taskqueue_function; struct taskqueue_arguments arg_var; arg_var.a=10; arg_var.b=20; TASK_INIT(&mytask,50,taskqueue_function_ptr,&arg_var); taskqueue_enqueue(taskqueue_swi, &mytask); ........... } did i do it correctly ??? thanks, kamal __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com