]>
Commit | Line | Data |
---|---|---|
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 |
14 | shutdown \- shut down part of a full-duplex connection | |
9697acd2 AC |
15 | .SH LIBRARY |
16 | Standard 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 |
25 | The | |
e511ffb6 | 26 | .BR shutdown () |
fea681da MK |
27 | call causes all or part of a full-duplex connection on the socket |
28 | associated with | |
75c59601 | 29 | .I sockfd |
c13182ef MK |
30 | to be shut down. |
31 | If | |
fea681da MK |
32 | .I how |
33 | is | |
34 | .BR SHUT_RD , | |
c13182ef MK |
35 | further receptions will be disallowed. |
36 | If | |
fea681da MK |
37 | .I how |
38 | is | |
39 | .BR SHUT_WR , | |
c13182ef MK |
40 | further transmissions will be disallowed. |
41 | If | |
fea681da MK |
42 | .I how |
43 | is | |
44 | .BR SHUT_RDWR , | |
45 | further receptions and transmissions will be disallowed. | |
47297adb | 46 | .SH RETURN VALUE |
c13182ef MK |
47 | On success, zero is returned. |
48 | On error, \-1 is returned, and | |
fea681da | 49 | .I errno |
f6a4078b | 50 | is set to indicate the error. |
fea681da MK |
51 | .SH ERRORS |
52 | .TP | |
53 | .B EBADF | |
3e4088f4 | 54 | .I sockfd |
d9cb0d7d | 55 | is not a valid file descriptor. |
fea681da | 56 | .TP |
556bb77a MK |
57 | .B EINVAL |
58 | An invalid value was specified in | |
1ae6b2c7 | 59 | .I how |
556bb77a MK |
60 | (but see BUGS). |
61 | .TP | |
fea681da MK |
62 | .B ENOTCONN |
63 | The specified socket is not connected. | |
64 | .TP | |
65 | .B ENOTSOCK | |
deedfd97 | 66 | The file descriptor |
3e4088f4 | 67 | .I sockfd |
deedfd97 | 68 | does not refer to a socket. |
3113c7f3 | 69 | .SH STANDARDS |
eee11a0f | 70 | POSIX.1-2001, POSIX.1-2008, 4.4BSD |
256cf66a MK |
71 | .RB ( shutdown () |
72 | first appeared in 4.2BSD). | |
fea681da | 73 | .SH NOTES |
2f0af33b MK |
74 | The constants |
75 | .BR SHUT_RD , | |
76 | .BR SHUT_WR , | |
77 | .B SHUT_RDWR | |
78 | have the value 0, 1, 2, | |
fea681da MK |
79 | respectively, and are defined in |
80 | .I <sys/socket.h> | |
81 | since glibc-2.1.91. | |
556bb77a | 82 | .SH BUGS |
7e64d33c | 83 | Checks for the validity of |
556bb77a | 84 | .I how |
7e64d33c MK |
85 | are done in domain-specific code, |
86 | and before Linux 3.7 not all domains performed these checks. | |
556bb77a | 87 | .\" https://bugzilla.kernel.org/show_bug.cgi?id=47111 |
7e64d33c MK |
88 | Most notably, UNIX domain sockets simply ignored invalid values. |
89 | This problem was fixed for UNIX domain sockets | |
90 | .\" commit fc61b928dc4d72176cf4bd4d30bf1d22e599aefc | |
91 | .\" and for DECnet sockets in commit 46b66d7077b89fb4917ceef19b3f7dd86055c94a | |
92 | in 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) |