From owner-freebsd-bugs Sun Oct 7 11:20: 6 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id E804737B405 for ; Sun, 7 Oct 2001 11:20:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f97IK2T01515; Sun, 7 Oct 2001 11:20:02 -0700 (PDT) (envelope-from gnats) Date: Sun, 7 Oct 2001 11:20:02 -0700 (PDT) Message-Id: <200110071820.f97IK2T01515@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Valentin Nechayev Subject: Re: kern/30985: incorrect signal handling in snpread() Reply-To: Valentin Nechayev Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/30985; it has been noted by GNATS. From: Valentin Nechayev To: Dima Dorfman Cc: Valentin Nechayev , FreeBSD-gnats-submit@freebsd.org Subject: Re: kern/30985: incorrect signal handling in snpread() Date: Sun, 7 Oct 2001 21:15:36 +0300 Sun, Oct 07, 2001 at 08:50:41, dima wrote about "Re: kern/30985: incorrect signal handling in snpread()": > > - tsleep((caddr_t) snp, (PZERO + 1) | PCATCH, "snoopread" > > , 0); > > + error = tsleep((caddr_t) snp, (PZERO + 1) | PCATCH, "snoopread", 0); > > + if (error == EINTR || error == ERESTART) { > > + splx(s); > > + return EINTR; > > + } > > Why can't we just return whatever tsleep() returns, as most (all?) > other drivers do? Like so (untested): I am not experienced kernel hacker ;) The examples I saw in kernel code, mostly test for ERESTART and possibly EINTR and exit from routine in case of such codes. tsleep(9) man page (in RELENG_4_4) mentions the only another return code allowed - EWOULDBLOCK in timeout case, but snpread() doesn't suppose timeout. If you suppose that exit on any nonzero value is correct, you probably are right. > snp->snp_flags |= SNOOP_RWAIT; > - tsleep((caddr_t)snp, (PZERO + 1) | PCATCH, "snprd", 0); > + error = tsleep((caddr_t)snp, (PZERO + 1) | PCATCH, > + "snprd", 0); > + if (error != 0) > + return (error); > } /netch To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message