From owner-freebsd-hackers Fri Jul 6 15:27:51 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mail6.speakeasy.net (mail6.speakeasy.net [216.254.0.206]) by hub.freebsd.org (Postfix) with SMTP id 539C537B406 for ; Fri, 6 Jul 2001 15:27:38 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 43546 invoked from network); 6 Jul 2001 22:27:37 -0000 Received: from unknown (HELO laptop.baldwin.cx) ([64.81.54.73]) (envelope-sender ) by mail6.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 6 Jul 2001 22:27:37 -0000 Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20010706174019.B700@ringworld.oblivion.bg> Date: Fri, 06 Jul 2001 15:27:34 -0700 (PDT) From: John Baldwin To: Peter Pentchev Subject: Re: LIST_NEXT() Cc: freebsd-hackers@FreeBSD.ORG, Evan Sarmiento Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 06-Jul-01 Peter Pentchev wrote: > On Fri, Jul 06, 2001 at 09:48:26AM -0400, Evan Sarmiento wrote: >> Hello, >> >> I'm writing a kernel module, and it involves traversing the proc list >> searching for the right structure, >> however, when I use SLIST_NEXT(p, p_list) in the program, I get a warning >> when I compile it: >> >> warning: statement with mo effect >> >> What am I doing wrong? I've read the manpages on queue and looked at the >> proc structure. >> >> Here's the code: >> int >> prfw_setflags(p, uap) >> struct proc *p; >> struct prfw_setflags_args *uap; >> { >> ... >> if (uap->id) { >> while (uap->id != p->p_pid) >> LIST_NEXT(p, p_list); >> } > > Well, first, you're using LIST_NEXT(), not SLIST_NEXT() :) > Second, none of the *_NEXT() queue.h macros modify their parameters; > they just return a pointer to the next element. So, just try: > > p = LIST_NEXT(p, p_list); > > ..and you'll be just fine. However, you should be using pfind() to look up a process by pid. -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message