nfs, smb: rename 'lfaware' to 'flags'
[unleashed.git] / lib / libc / shutdown.2
blobba871598d5fe405bf12f70ba43b9d1c85221a905
1 .\"     $OpenBSD: shutdown.2,v 1.15 2014/09/09 09:00:17 guenther Exp $
2 .\"     $NetBSD: shutdown.2,v 1.5 1995/02/27 12:37:11 cgd Exp $
3 .\"
4 .\" Copyright (c) 1983, 1991, 1993
5 .\"     The Regents of the University of California.  All rights reserved.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. Neither the name of the University nor the names of its contributors
16 .\"    may be used to endorse or promote products derived from this software
17 .\"    without specific prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" SUCH DAMAGE.
30 .\"
31 .\"     @(#)shutdown.2  8.1 (Berkeley) 6/4/93
32 .\"
33 .Dd October 26, 2016
34 .Dt SHUTDOWN 2
35 .Os
36 .Sh NAME
37 .Nm shutdown
38 .Nd disable sends or receives on a socket
39 .Sh SYNOPSIS
40 .In sys/socket.h
41 .Ft int
42 .Fn shutdown "int s" "int how"
43 .Sh DESCRIPTION
44 The
45 .Fn shutdown
46 system call disables sends or receives on a socket.
47 .Pp
48 If the file descriptor
49 .Fa s
50 is associated with a
51 .Dv SOCK_STREAM
52 socket, all or part of the full-duplex connection will be shut down.
53 .Pp
54 The
55 .Fa how
56 argument specifies the type of shutdown.
57 Possible values are:
58 .Bl -tag -width "SHUT_RDWRXXX" -offset indent
59 .It Dv SHUT_RD
60 Further receives will be disallowed.
61 .It Dv SHUT_WR
62 Further sends will be disallowed.
63 This may cause actions specific to the protocol family of the socket
64 .Fa s
65 to happen.
66 .It Dv SHUT_RDWR
67 Further sends and receives will be disallowed.
68 .El
69 .Pp
70 The following protocol specific actions apply to the use of
71 .Dv SHUT_WR
72 based on the properties of the socket associated with the file descriptor
73 .Fa s :
74 .Bl -column "AF_INET6" "SOCK_STREAM" "IPPROTO_UDP" -offset indent
75 .It DOMAIN Ta TYPE Ta PROTOCOL Ta "RETURN VALUE AND ACTION"
76 .Pp
77 .It Dv AF_INET Ta Dv SOCK_DGRAM Ta Dv IPPROTO_UDP Ta
78 Return 0.
79 ICMP messages will
80 .Em not
81 be generated.
82 .It Dv AF_INET Ta Dv SOCK_STREAM Ta Dv IPPROTO_TCP Ta
83 Return 0.
84 Send queued data, wait for ACK, then send FIN.
85 .It Dv AF_INET6 Ta Dv SOCK_DGRAM Ta Dv IPPROTO_UDP Ta
86 Return 0.
87 ICMP messages will
88 .Em not
89 be generated.
90 .It Dv AF_INET6 Ta Dv SOCK_STREAM Ta Dv IPPROTO_TCP Ta
91 Return 0.
92 Send queued data, wait for ACK, then send FIN.
93 .El
94 .Sh RETURN VALUES
95 .Rv -std
96 .Sh ERRORS
97 The
98 .Fn shutdown
99 system call fails if:
100 .Bl -tag -width Er
101 .It Bq Er EBADF
103 .Fa s
104 argument is not a valid file descriptor.
105 .It Bq Er EINVAL
107 .Fa how
108 argument is invalid.
109 .It Bq Er ENOTCONN
111 .Fa s
112 argument specifies a
113 .Dv SOCK_STREAM
114 socket which is not connected.
115 .It Bq Er ENOTSOCK
117 .Fa s
118 argument does not refer to a socket.
119 .It Bq Er EOPNOTSUPP
120 The socket associated with the file descriptor
121 .Fa s
122 does not support this operation.
124 .Sh SEE ALSO
125 .Xr connect 2 ,
126 .Xr socket 2 ,
127 .Xr inet 7P  ,
128 .Xr inet6 7P
129 .Sh STANDARDS
131 .Fn shutdown
132 function conforms to
133 .St -p1003.1-2008 .
134 .Sh HISTORY
136 .Fn shutdown
137 system call first appeared in
138 .Bx 4.1c .
140 .Dv SHUT_RD , SHUT_WR ,
142 .Dv SHUT_RDWR
143 constants appeared in
144 .St -p1003.1g-2000 .