Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Mar 2005 15:06:16 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/sys/kern sys_socket.c
Message-ID:  <200503111506.j2BF6HIm008578@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
rwatson     2005-03-11 15:06:16 UTC

  FreeBSD src repository

  Modified files:
    sys/kern             sys_socket.c 
  Log:
  The SO_NOSIGPIPE socket option allows a user process to mark a socket
  so that the socket does not generate SIGPIPE, only EPIPE, when a write
  is attempted after socket shutdown.  When the option was introduced in
  2002, this required the logic for determining whether SIGPIPE was
  generated to be pushed down from dofilewrite() to the socket layer so
  that the socket options could be considered.  However, the change in
  2002 omitted modification to soo_write() required to add that logic,
  resulting in SIGPIPE not being generated even without SO_NOSIGPIPE when
  the socket was written to using write() or related generic system calls.
  
  This change adds the EPIPE logic to soo_write(), generating a SIGPIPE
  signal to the process associated with the passed uio in the event that
  the SO_NOSIGPIPE option is not set.
  
  Notes:
  
  - The are upsides and downsides to placing this logic in the socket
    layer as opposed to the file descriptor layer.  This is really fd
    layer logic, but because we need so_options, we have a choice of
    layering violations and pick this one.
  
  - SIGPIPE possibly should be delivered to the thread performing the
    write, not the process performing the write.
  
  - uio->uio_td and the td argument to soo_write() might potentially
    differ; we use the thread in the uio argument.
  
  - The "sigpipe" regression test in src/tools/regression/sockets/sigpipe
    tests for the bug.
  
  Submitted by:           Mikko Tyolajarvi <mbsd at pacbell dot net>
  Talked with:            glebius, alfred
  PR:                     78478
  MFC after:              1 week
  
  Revision  Changes    Path
  1.68      +8 -0      src/sys/kern/sys_socket.c



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