]> git.saurik.com Git - apple/xnu.git/blame - bsd/man/man2/disconnectx.2
xnu-2782.20.48.tar.gz
[apple/xnu.git] / bsd / man / man2 / disconnectx.2
CommitLineData
39236c6e
A
1.\"
2.\" Copyright (c) 2012 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 November 14, 2012
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 "associd_t associd"
40.Fa "connid_t connid"
41.Fc
42.Sh DESCRIPTION
43The parameter
44.Fa socket
45is a socket. The communication domain of the socket determines the
46availability and behavior of
47.Fn disconnectx .
48In general,
49.Fn disconnectx
50is analogous to
51.Xr shutdown 2
52.Dv with SHUT_RDWR
53issued on the connection identified by
54.Fa connid ,
55or on all connections associated with the
56.Fa associd
57association.
58.Pp
59The parameter
60.Fa associd
61specifies the association identifier. It may be set to
62.Dv ASSOCID_ANY
63when there is only one association present;
64.Dv ASSOCID_ALL
65to specify all existing associations; or one of the identifiers returned from
66.Xr getassocids 3 .
67.Pp
68The parameter
69.Fa connid
70specifies the connection identifier. It may be set to
71.Dv CONNID_ANY
72or
73.Dv CONNID_ALL ,
74in which case the association represented by
75.Fa associd
76will be dissolved; or the value returned from
77.Xr connectx 2
78or
79.Xr getconnids 3 ,
80which indicates that the disconnection occurs only on that connection
81while keeping the session association intact. For the latter, the connection
82associated with
83.Fa connid
84will no longer be valid upon success.
85.Sh RETURN VALUES
86The
87.Fn disconnectx
88function returns the value 0 if successful; otherwise the value of -1 is
89returned and the global integer variable
90.Va errno
91is set to indicate the error.
92.Sh ERRORS
93The
94.Fn disconnectx
95system call succeeds unless:
96.Bl -tag -width Er
97.\" ===========
98.It Bq Er EALREADY
99Operation already in progress for the session association represented by
100.Fa associd .
101.\" ===========
102.It Bq Er EBADF
103.Fa Socket
104is not a valid descriptor.
105.\" ===========
106.It Bq Er EINVAL
107The
108.Fa associd
109or
110.Fa connid
111argument is invalid or the underlying protocol is no longer attached to
112.Fa socket .
113.\" ===========
114.It Bq Er ENOTCONN
115The session association repreresented by
116.Fa associd
117is not connected.
118.\" ===========
119.It Bq Er ENOTSOCK
120.Fa Socket
121is a file, not a socket.
122.El
123.Sh SEE ALSO
124.Xr connectx 2 ,
125.Xr socket 2 ,
126.Xr getassocids 3 ,
127.Xr getconnids 3 ,
128.Xr getconninfo 3 ,
129.Xr compat 5
130.Sh HISTORY
131The
132.Fn disconnectx
133function call appeared in Darwin 13.0.0