]> git.saurik.com Git - apple/xnu.git/blob - bsd/man/man2/disconnectx.2
d9990242bd7c0860d8d07c29b4b4470ac136c991
[apple/xnu.git] / bsd / man / man2 / disconnectx.2
1 .\"
2 .\" Copyright (c) 2015 Apple Inc. All rights reserved.
3 .\"
4 .\" @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 .\"
6 .\" This file contains Original Code and/or Modifications of Original Code
7 .\" as defined in and that are subject to the Apple Public Source License
8 .\" Version 2.0 (the 'License'). You may not use this file except in
9 .\" compliance with the License. The rights granted to you under the License
10 .\" may not be used to create, or enable the creation or redistribution of,
11 .\" unlawful or unlicensed copies of an Apple operating system, or to
12 .\" circumvent, violate, or enable the circumvention or violation of, any
13 .\" terms of an Apple operating system software license agreement.
14 .\"
15 .\" Please obtain a copy of the License at
16 .\" http://www.opensource.apple.com/apsl/ and read it before using this file.
17 .\"
18 .\" The Original Code and all software distributed under the License are
19 .\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 .\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 .\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 .\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 .\" Please see the License for the specific language governing rights and
24 .\" limitations under the License.
25 .\"
26 .\" @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 .\"
28 .Dd April 10, 2015
29 .Dt DISCONNECTX 2
30 .Os Darwin
31 .Sh NAME
32 .Nm disconnectx
33 .Nd disconnects a connection on a socket
34 .Sh SYNOPSIS
35 .Fd #include <sys/socket.h>
36 .Ft int
37 .Fo disconnectx
38 .Fa "int socket"
39 .Fa "sae_associd_t associd"
40 .Fa "sae_connid_t connid"
41 .Fc
42 .Sh DESCRIPTION
43 The parameter
44 .Fa socket
45 is a socket. The communication domain of the socket determines the
46 availability and behavior of
47 .Fn disconnectx .
48 For connection-oriented socket,
49 .Fn disconnectx
50 is analogous to
51 .Xr shutdown 2
52 .Dv with SHUT_RDWR
53 issued on the socket. For connectionless socket, it disassociates any existing
54 association to the peer socket.
55 .\" identified by
56 .\" .Fa connid ,
57 .\" or on all connections associated with the
58 .\" .Fa associd
59 .\" association.
60 .Pp
61 The parameter
62 .Fa associd
63 specifies the association identifier. It should be set to
64 .Dv SAE_ASSOCID_ANY .
65 .\"when there is only one association present;
66 .\".Dv SAE_ASSOCID_ALL
67 .\"to specify all existing associations; or one of the identifiers returned from
68 .\".Xr getassocids 3 .
69 .Pp
70 The parameter
71 .Fa connid
72 should be set to
73 .\" specifies the connection identifier. It may be set to
74 .Dv SAE_CONNID_ANY .
75 .\" or
76 .\".Dv SAE_CONNID_ALL ,
77 .\" in which case the association represented by
78 .\" .Fa associd
79 .\" will be dissolved; or the value returned from
80 .\" .Xr connectx 2
81 .\" or
82 .\" .Xr getconnids 3 ,
83 .\" which indicates that the disconnection occurs only on that connection
84 .\" while keeping the session association intact. For the latter, the connection
85 .\" associated with
86 .\" .Fa connid
87 .\" will no longer be valid upon success.
88 .Sh NOTES
89 .Fn disconnectx
90 is currently supported only on AF_INET and AF_INET6 sockets of type SOCK_DGRAM
91 and SOCK_STREAM.
92 .Sh RETURN VALUES
93 The
94 .Fn disconnectx
95 function returns the value 0 if successful; otherwise the value of -1 is
96 returned and the global integer variable
97 .Va errno
98 is set to indicate the error.
99 .Sh ERRORS
100 The
101 .Fn disconnectx
102 system call succeeds unless:
103 .Bl -tag -width Er
104 .\" ===========
105 .It Bq Er EALREADY
106 Operation already in progress.
107 .\" for the session association represented by
108 .\" .Fa associd .
109 .\" ===========
110 .It Bq Er EBADF
111 .Fa Socket
112 is not a valid descriptor.
113 .\" ===========
114 .It Bq Er EINVAL
115 The
116 .Fa associd
117 or
118 .Fa connid
119 argument is invalid or the underlying protocol is no longer attached to
120 .Fa socket .
121 .\" ===========
122 .It Bq Er ENOTCONN
123 .\" The session association repreresented by
124 .\" .Fa associd
125 .\" is not connected.
126 The
127 .Fa socket
128 is not connected.
129 .\" ===========
130 .It Bq Er ENOTSOCK
131 .Fa Socket
132 is a file, not a socket.
133 .El
134 .Sh SEE ALSO
135 .Xr connect 2 ,
136 .Xr connectx 2 ,
137 .Xr socket 2 ,
138 .\" .Xr getassocids 3 ,
139 .\" .Xr getconnids 3 ,
140 .\" .Xr getconninfo 3 ,
141 .Xr compat 5
142 .Sh HISTORY
143 The
144 .Fn disconnectx
145 function call appeared in Darwin 15.0.0