On Wed, Mar 19, 2003 at 10:27:57PM +1100, Bruce Evans wrote:
...
<re. SIGPIPE handling>
...
> Similarly in for sockets except in the SO_NOSIGPIPE case, unless I am
> misreading uipc_syscalls.c:sendit():
> 
> %     error = so->so_proto->pr_usrreqs->pru_sosend(so, to, &auio, 0, control,
> %                                                  flags, td);
> %     if (error) {
> %             if (auio.uio_resid != len && (error == ERESTART ||
> %                 error == EINTR || error == EWOULDBLOCK))
> %                     error = 0;
> %             /* Generation of SIGPIPE can be controlled per socket */
> %             if (error == EPIPE && !(so->so_options & SO_NOSIGPIPE)) {
> %                     PROC_LOCK(td->td_proc);
> %                     psignal(td->td_proc, SIGPIPE);
>                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> %                     PROC_UNLOCK(td->td_proc);
> %             }
> %     }
> 
> This code seems to have an interesting version of mishandling short
> i/o counts (auio.uio_resid != len && auio.ui_resid != 0).  Short i/o
> counts involving an interrupt are normally the only ones handled
> correctly (by the ERESTART/EINTR/EWOULDBLOCK fixup).  However, in the
> case of EPIPE/SIGPIPE, we only notice the SIGPIPE after we do the
> fixup, so we never do the fixup and always return an error instead of
> the short i/o count.

this is probably harmless because the pipe is gone anyways,
so it matters little how many bytes have been written, right ?

        cheers
        luigi

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to