disconnectx.2   [plain text]


.\" 
.\" Copyright (c) 2015 Apple Inc. All rights reserved.
.\" 
.\" @APPLE_OSREFERENCE_LICENSE_HEADER_START@
.\" 
.\" This file contains Original Code and/or Modifications of Original Code
.\" as defined in and that are subject to the Apple Public Source License
.\" Version 2.0 (the 'License'). You may not use this file except in
.\" compliance with the License. The rights granted to you under the License
.\" may not be used to create, or enable the creation or redistribution of,
.\" unlawful or unlicensed copies of an Apple operating system, or to
.\" circumvent, violate, or enable the circumvention or violation of, any
.\" terms of an Apple operating system software license agreement.
.\" 
.\" Please obtain a copy of the License at
.\" http://www.opensource.apple.com/apsl/ and read it before using this file.
.\" 
.\" The Original Code and all software distributed under the License are
.\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
.\" Please see the License for the specific language governing rights and
.\" limitations under the License.
.\" 
.\" @APPLE_OSREFERENCE_LICENSE_HEADER_END@
.\"
.Dd April 10, 2015
.Dt DISCONNECTX 2
.Os Darwin
.Sh NAME
.Nm disconnectx
.Nd disconnects a connection on a socket
.Sh SYNOPSIS
.Fd #include <sys/socket.h>
.Ft int
.Fo disconnectx
.Fa "int socket"
.Fa "sae_associd_t associd"
.Fa "sae_connid_t connid"
.Fc
.Sh DESCRIPTION
The parameter
.Fa socket
is a socket.  The communication domain of the socket determines the
availability and behavior of
.Fn disconnectx .
For connection-oriented socket,
.Fn disconnectx
is analogous to
.Xr shutdown 2
.Dv with SHUT_RDWR
issued on the socket. For connectionless socket, it disassociates any existing
association to the peer socket.
.\" identified by
.\" .Fa connid ,
.\" or on all connections associated with the
.\" .Fa associd
.\" association.
.Pp
The parameter
.Fa associd
specifies the association identifier.  It should be set to
.Dv SAE_ASSOCID_ANY .
.\"when there is only one association present;
.\".Dv SAE_ASSOCID_ALL
.\"to specify all existing associations; or one of the identifiers returned from
.\".Xr getassocids 3 .
.Pp
The parameter
.Fa connid
should be set to
.\" specifies the connection identifier.  It may be set to
.Dv SAE_CONNID_ANY .
.\" or
.\".Dv SAE_CONNID_ALL ,
.\" in which case the association represented by
.\" .Fa associd
.\" will be dissolved; or the value returned from
.\" .Xr connectx 2
.\" or
.\" .Xr getconnids 3 ,
.\" which indicates that the disconnection occurs only on that connection
.\" while keeping the session association intact.  For the latter, the connection
.\" associated with
.\" .Fa connid
.\" will no longer be valid upon success.
.Sh NOTES
.Fn disconnectx
is currently supported only on AF_INET and AF_INET6 sockets of type SOCK_DGRAM
and SOCK_STREAM.
.Sh RETURN VALUES
The
.Fn disconnectx
function returns the value 0 if successful; otherwise the value of -1 is
returned and the global integer variable
.Va errno
is set to indicate the error.
.Sh ERRORS
The
.Fn disconnectx
system call succeeds unless:
.Bl -tag -width Er
.\" ===========
.It Bq Er EALREADY
Operation already in progress.
.\" for the session association represented by
.\" .Fa associd .
.\" ===========
.It Bq Er EBADF
.Fa Socket
is not a valid descriptor.
.\" ===========
.It Bq Er EINVAL
The
.Fa associd
or
.Fa connid
argument is invalid or the underlying protocol is no longer attached to
.Fa socket .
.\" ===========
.It Bq Er ENOTCONN
.\" The session association repreresented by
.\" .Fa associd
.\" is not connected.
The
.Fa socket
is not connected.
.\" ===========
.It Bq Er ENOTSOCK
.Fa Socket
is a file, not a socket.
.El
.Sh SEE ALSO
.Xr connect 2 ,
.Xr connectx 2 ,
.Xr socket 2 ,
.\" .Xr getassocids 3 ,
.\" .Xr getconnids 3 ,
.\" .Xr getconninfo 3 ,
.Xr compat 5
.Sh HISTORY
The
.Fn disconnectx
function call appeared in Darwin 15.0.0