From owner-freebsd-questions Fri Jan 24 9:53:48 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2D80F37B401 for ; Fri, 24 Jan 2003 09:53:46 -0800 (PST) Received: from smtp.infracaninophile.co.uk (ns0.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8C15343ED8 for ; Fri, 24 Jan 2003 09:53:44 -0800 (PST) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost.infracaninophile.co.uk [IPv6:::1]) by smtp.infracaninophile.co.uk (8.12.6/8.12.6) with ESMTP id h0OHrgHZ077066 for ; Fri, 24 Jan 2003 17:53:42 GMT (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost) by happy-idiot-talk.infracaninophile.co.uk (8.12.6/8.12.6/Submit) id h0OHraSA077065 for freebsd-questions@FreeBSD.ORG; Fri, 24 Jan 2003 17:53:36 GMT Date: Fri, 24 Jan 2003 17:53:36 +0000 From: Matthew Seaman To: freebsd-questions Subject: Re: top -> what does sbwait mean ? Message-ID: <20030124175336.GB76154@happy-idiot-talk.infracaninophi> Mail-Followup-To: Matthew Seaman , freebsd-questions References: <018d01c2c3bb$a1f58cc0$fd01a8c0@motims> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <018d01c2c3bb$a1f58cc0$fd01a8c0@motims> User-Agent: Mutt/1.5.3i X-Spam-Status: No, hits=-3.0 required=5.0 tests=IN_REP_TO,MIME_LONG_LINE_QP,QUOTED_EMAIL_TEXT,REFERENCES, SPAM_PHRASE_00_01,TO_LOCALPART_EQ_REAL,USER_AGENT, USER_AGENT_MUTT version=2.43 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Jan 24, 2003 at 10:16:53AM -0500, Moti Levy wrote: > Hi to all , > I've written a small perl script , > when i run it it soemtimes shows in perl with sbwait state? where can i f= ind > out what sbwait ( or ither states for that matter ) mean ? >=20 > --------------- > PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU CPU COMMAND > 9146 root 2 -20 303M 303M sbwait 1 46:34 0.00% 0.00% perl > ---------------- sbwait is the name of a kernel function meaning 'socket buffer wait' --- ie. the process is waiting on data to be delivered to or drain =66rom a socket. Or, at least that's what I gather from reading the sources: there doesn't seem to be any documentation in the whole RELENG_4 src tree mentioning that particular term: % find /usr/src -type f -print | xargs grep -i sbwait /usr/src/sys/kern/uipc_socket.c: error =3D sbwai= t(&so->so_snd); /usr/src/sys/kern/uipc_socket.c: error =3D sbwait(&so->s= o_rcv); /usr/src/sys/kern/uipc_socket.c: error =3D sbwai= t(&so->so_rcv); /usr/src/sys/kern/uipc_socket2.c:sbwait(sb) /usr/src/sys/kern/uipc_socket2.c: (sb->sb_flags & SB_NOINTR) = ? PSOCK : PSOCK | PCATCH, "sbwait", /usr/src/sys/kern/uipc_syscalls.c: * a race condition wit= h sbwait(). /usr/src/sys/kern/uipc_syscalls.c: error =3D sbwai= t(&so->so_snd); /usr/src/sys/kern/uipc_syscalls.c: * An error fro= m sbwait usually indicates that we've /usr/src/sys/kern/uipc_usrreq.c: * if s= bwait returns an error due to receipt /usr/src/sys/kern/uipc_usrreq.c: * of a= signal. If sbwait does return /usr/src/sys/kern/uipc_usrreq.c: (void) = sbwait(&so->so_rcv); /usr/src/sys/nfs/nfs_socket.c: * sbwait() after someone else = has received my reply for me. /usr/src/sys/sys/socketvar.h:int sbwait __P((struct sockbuf *sb)= ); =20 The function definition is in /usr/src/sys/kern/uipc_socket2.c: /* * Wait for data to arrive at/drain from a socket buffer. */ int sbwait(sb) struct sockbuf *sb; { =20 sb->sb_flags |=3D SB_WAIT; return (tsleep((caddr_t)&sb->sb_cc, (sb->sb_flags & SB_NOINTR) ? PSOCK : PSOCK | PCATCH, "sbwai= t", sb->sb_timeo)); } Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message