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 find
> out what sbwait ( or ither states for that matter ) mean ?
> 
> ---------------
>  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
from 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 = 
sbwait(&so->so_snd);
    /usr/src/sys/kern/uipc_socket.c:                error = sbwait(&so->so_rcv);
    /usr/src/sys/kern/uipc_socket.c:                        error = 
sbwait(&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 with sbwait().
    /usr/src/sys/kern/uipc_syscalls.c:                      error = 
sbwait(&so->so_snd);
    /usr/src/sys/kern/uipc_syscalls.c:                       * An error from sbwait 
usually indicates that we've
    /usr/src/sys/kern/uipc_usrreq.c:                                 * if sbwait 
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));
    
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;
    {
    
            sb->sb_flags |= SB_WAIT;
            return (tsleep((caddr_t)&sb->sb_cc,
                (sb->sb_flags & SB_NOINTR) ? PSOCK : PSOCK | PCATCH, "sbwait",
                sb->sb_timeo));
    }

        Cheers,

        Matthew

-- 
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 [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message

Reply via email to