|
Packit |
7cfc04 |
.\" Copyright (c) 1983, 1991 The Regents of the University of California.
|
|
Packit |
7cfc04 |
.\" All rights reserved.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
|
|
Packit |
7cfc04 |
.\" Redistribution and use in source and binary forms, with or without
|
|
Packit |
7cfc04 |
.\" modification, are permitted provided that the following conditions
|
|
Packit |
7cfc04 |
.\" are met:
|
|
Packit |
7cfc04 |
.\" 1. Redistributions of source code must retain the above copyright
|
|
Packit |
7cfc04 |
.\" notice, this list of conditions and the following disclaimer.
|
|
Packit |
7cfc04 |
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
Packit |
7cfc04 |
.\" notice, this list of conditions and the following disclaimer in the
|
|
Packit |
7cfc04 |
.\" documentation and/or other materials provided with the distribution.
|
|
Packit |
7cfc04 |
.\" 3. All advertising materials mentioning features or use of this software
|
|
Packit |
7cfc04 |
.\" must display the following acknowledgement:
|
|
Packit |
7cfc04 |
.\" This product includes software developed by the University of
|
|
Packit |
7cfc04 |
.\" California, Berkeley and its contributors.
|
|
Packit |
7cfc04 |
.\" 4. Neither the name of the University nor the names of its contributors
|
|
Packit |
7cfc04 |
.\" may be used to endorse or promote products derived from this software
|
|
Packit |
7cfc04 |
.\" without specific prior written permission.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
Packit |
7cfc04 |
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
7cfc04 |
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
Packit |
7cfc04 |
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
Packit |
7cfc04 |
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Packit |
7cfc04 |
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
Packit |
7cfc04 |
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
Packit |
7cfc04 |
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
Packit |
7cfc04 |
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
Packit |
7cfc04 |
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
Packit |
7cfc04 |
.\" SUCH DAMAGE.
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_END
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" $Id: shutdown.2,v 1.1.1.1 1999/03/21 22:52:23 freitag Exp $
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Modified Sat Jul 24 09:57:55 1993 by Rik Faith <faith@cs.unc.edu>
|
|
Packit |
7cfc04 |
.\" Modified Tue Oct 22 22:04:51 1996 by Eric S. Raymond <esr@thyrsus.com>
|
|
Packit |
7cfc04 |
.\" Modified 1998 by Andi Kleen
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.TH SHUTDOWN 2 2016-03-15 "Linux" "Linux Programmer's Manual"
|
|
Packit |
7cfc04 |
.SH NAME
|
|
Packit |
7cfc04 |
shutdown \- shut down part of a full-duplex connection
|
|
Packit |
7cfc04 |
.SH SYNOPSIS
|
|
Packit |
7cfc04 |
.B #include <sys/socket.h>
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.BI "int shutdown(int " sockfd ", int " how );
|
|
Packit |
7cfc04 |
.SH DESCRIPTION
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR shutdown ()
|
|
Packit |
7cfc04 |
call causes all or part of a full-duplex connection on the socket
|
|
Packit |
7cfc04 |
associated with
|
|
Packit |
7cfc04 |
.I sockfd
|
|
Packit |
7cfc04 |
to be shut down.
|
|
Packit |
7cfc04 |
If
|
|
Packit |
7cfc04 |
.I how
|
|
Packit |
7cfc04 |
is
|
|
Packit |
7cfc04 |
.BR SHUT_RD ,
|
|
Packit |
7cfc04 |
further receptions will be disallowed.
|
|
Packit |
7cfc04 |
If
|
|
Packit |
7cfc04 |
.I how
|
|
Packit |
7cfc04 |
is
|
|
Packit |
7cfc04 |
.BR SHUT_WR ,
|
|
Packit |
7cfc04 |
further transmissions will be disallowed.
|
|
Packit |
7cfc04 |
If
|
|
Packit |
7cfc04 |
.I how
|
|
Packit |
7cfc04 |
is
|
|
Packit |
7cfc04 |
.BR SHUT_RDWR ,
|
|
Packit |
7cfc04 |
further receptions and transmissions will be disallowed.
|
|
Packit |
7cfc04 |
.SH RETURN VALUE
|
|
Packit |
7cfc04 |
On success, zero is returned.
|
|
Packit |
7cfc04 |
On error, \-1 is returned, and
|
|
Packit |
7cfc04 |
.I errno
|
|
Packit |
7cfc04 |
is set appropriately.
|
|
Packit |
7cfc04 |
.SH ERRORS
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B EBADF
|
|
Packit |
7cfc04 |
.I sockfd
|
|
Packit |
7cfc04 |
is not a valid file descriptor.
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B EINVAL
|
|
Packit |
7cfc04 |
An invalid value was specified in
|
|
Packit |
7cfc04 |
.IR how
|
|
Packit |
7cfc04 |
(but see BUGS).
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B ENOTCONN
|
|
Packit |
7cfc04 |
The specified socket is not connected.
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B ENOTSOCK
|
|
Packit |
7cfc04 |
The file descriptor
|
|
Packit |
7cfc04 |
.I sockfd
|
|
Packit |
7cfc04 |
does not refer to a socket.
|
|
Packit |
7cfc04 |
.SH CONFORMING TO
|
|
Packit |
7cfc04 |
POSIX.1-2001, POSIX.1-2008, 4.4BSD
|
|
Packit |
7cfc04 |
.RB ( shutdown ()
|
|
Packit |
7cfc04 |
first appeared in 4.2BSD).
|
|
Packit |
7cfc04 |
.SH NOTES
|
|
Packit |
7cfc04 |
The constants
|
|
Packit |
7cfc04 |
.BR SHUT_RD ,
|
|
Packit |
7cfc04 |
.BR SHUT_WR ,
|
|
Packit |
7cfc04 |
.B SHUT_RDWR
|
|
Packit |
7cfc04 |
have the value 0, 1, 2,
|
|
Packit |
7cfc04 |
respectively, and are defined in
|
|
Packit |
7cfc04 |
.I <sys/socket.h>
|
|
Packit |
7cfc04 |
since glibc-2.1.91.
|
|
Packit |
7cfc04 |
.SH BUGS
|
|
Packit |
7cfc04 |
Checks for the validity of
|
|
Packit |
7cfc04 |
.I how
|
|
Packit |
7cfc04 |
are done in domain-specific code,
|
|
Packit |
7cfc04 |
and before Linux 3.7 not all domains performed these checks.
|
|
Packit |
7cfc04 |
.\" https://bugzilla.kernel.org/show_bug.cgi?id=47111
|
|
Packit |
7cfc04 |
Most notably, UNIX domain sockets simply ignored invalid values.
|
|
Packit |
7cfc04 |
This problem was fixed for UNIX domain sockets
|
|
Packit |
7cfc04 |
.\" commit fc61b928dc4d72176cf4bd4d30bf1d22e599aefc
|
|
Packit |
7cfc04 |
.\" and for DECnet sockets in commit 46b66d7077b89fb4917ceef19b3f7dd86055c94a
|
|
Packit |
7cfc04 |
in Linux 3.7.
|
|
Packit |
7cfc04 |
.SH SEE ALSO
|
|
Packit |
7cfc04 |
.BR connect (2),
|
|
Packit |
7cfc04 |
.BR socket (2),
|
|
Packit |
7cfc04 |
.BR socket (7)
|
|
Packit |
7cfc04 |
.SH COLOPHON
|
|
Packit |
7cfc04 |
This page is part of release 4.15 of the Linux
|
|
Packit |
7cfc04 |
.I man-pages
|
|
Packit |
7cfc04 |
project.
|
|
Packit |
7cfc04 |
A description of the project,
|
|
Packit |
7cfc04 |
information about reporting bugs,
|
|
Packit |
7cfc04 |
and the latest version of this page,
|
|
Packit |
7cfc04 |
can be found at
|
|
Packit |
7cfc04 |
\%https://www.kernel.org/doc/man\-pages/.
|