]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/shutdown.2
Many pages: Use correct letter case in page titles (TH)
[thirdparty/man-pages.git] / man2 / shutdown.2
CommitLineData
fea681da
MK
1.\" Copyright (c) 1983, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
47009d5e 4.\" SPDX-License-Identifier: BSD-4-Clause-UC
fea681da
MK
5.\"
6.\" $Id: shutdown.2,v 1.1.1.1 1999/03/21 22:52:23 freitag Exp $
7.\"
8.\" Modified Sat Jul 24 09:57:55 1993 by Rik Faith <faith@cs.unc.edu>
9.\" Modified Tue Oct 22 22:04:51 1996 by Eric S. Raymond <esr@thyrsus.com>
10.\" Modified 1998 by Andi Kleen
11.\"
4c1c5274 12.TH shutdown 2 (date) "Linux man-pages (unreleased)"
fea681da
MK
13.SH NAME
14shutdown \- shut down part of a full-duplex connection
9697acd2
AC
15.SH LIBRARY
16Standard C library
8fc3b2cf 17.RI ( libc ", " \-lc )
fea681da 18.SH SYNOPSIS
c7db92b9 19.nf
fea681da 20.B #include <sys/socket.h>
68e4db0a 21.PP
c4e7b714 22.BI "int shutdown(int " sockfd ", int " how );
c7db92b9 23.fi
fea681da
MK
24.SH DESCRIPTION
25The
e511ffb6 26.BR shutdown ()
fea681da
MK
27call causes all or part of a full-duplex connection on the socket
28associated with
75c59601 29.I sockfd
c13182ef
MK
30to be shut down.
31If
fea681da
MK
32.I how
33is
34.BR SHUT_RD ,
c13182ef
MK
35further receptions will be disallowed.
36If
fea681da
MK
37.I how
38is
39.BR SHUT_WR ,
c13182ef
MK
40further transmissions will be disallowed.
41If
fea681da
MK
42.I how
43is
44.BR SHUT_RDWR ,
45further receptions and transmissions will be disallowed.
47297adb 46.SH RETURN VALUE
c13182ef
MK
47On success, zero is returned.
48On error, \-1 is returned, and
fea681da 49.I errno
f6a4078b 50is set to indicate the error.
fea681da
MK
51.SH ERRORS
52.TP
53.B EBADF
3e4088f4 54.I sockfd
d9cb0d7d 55is not a valid file descriptor.
fea681da 56.TP
556bb77a
MK
57.B EINVAL
58An invalid value was specified in
1ae6b2c7 59.I how
556bb77a
MK
60(but see BUGS).
61.TP
fea681da
MK
62.B ENOTCONN
63The specified socket is not connected.
64.TP
65.B ENOTSOCK
deedfd97 66The file descriptor
3e4088f4 67.I sockfd
deedfd97 68does not refer to a socket.
3113c7f3 69.SH STANDARDS
eee11a0f 70POSIX.1-2001, POSIX.1-2008, 4.4BSD
256cf66a
MK
71.RB ( shutdown ()
72first appeared in 4.2BSD).
fea681da 73.SH NOTES
2f0af33b
MK
74The constants
75.BR SHUT_RD ,
76.BR SHUT_WR ,
77.B SHUT_RDWR
78have the value 0, 1, 2,
fea681da
MK
79respectively, and are defined in
80.I <sys/socket.h>
81since glibc-2.1.91.
556bb77a 82.SH BUGS
7e64d33c 83Checks for the validity of
556bb77a 84.I how
7e64d33c
MK
85are done in domain-specific code,
86and before Linux 3.7 not all domains performed these checks.
556bb77a 87.\" https://bugzilla.kernel.org/show_bug.cgi?id=47111
7e64d33c
MK
88Most notably, UNIX domain sockets simply ignored invalid values.
89This problem was fixed for UNIX domain sockets
90.\" commit fc61b928dc4d72176cf4bd4d30bf1d22e599aefc
91.\" and for DECnet sockets in commit 46b66d7077b89fb4917ceef19b3f7dd86055c94a
92in Linux 3.7.
47297adb 93.SH SEE ALSO
df818717 94.BR close (2),
fea681da 95.BR connect (2),
5dfedcae
MK
96.BR socket (2),
97.BR socket (7)