Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jan 2003 17:53:36 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        freebsd-questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: top -> what does sbwait mean ?
Message-ID:  <20030124175336.GB76154@happy-idiot-talk.infracaninophi>
In-Reply-To: <018d01c2c3bb$a1f58cc0$fd01a8c0@motims>
References:  <018d01c2c3bb$a1f58cc0$fd01a8c0@motims>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030124175336.GB76154>