/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-1999 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* ev_connects.c - implement asynch connect/accept for the eventlib
* vix 16sep96 [initial]
*/
#if !defined(LINT) && !defined(CODECENTER)
#endif
/* Import. */
#include "port_before.h"
#include "fd_setsize.h"
#include <unistd.h>
#include <isc/eventlib.h>
#include <isc/assertions.h>
#include "eventlib_p.h"
#include "port_after.h"
/* Macros. */
0 \
) \
)
/* Forward. */
/* Public. */
int
{
int mode;
/*
* Remember the nonblocking status. We assume that either evSelectFD
* has not been done to this fd, or that if it has then the caller
* will evCancelConn before they evDeselectFD. If our assumptions
* are not met, then we might restore the old nonblocking status
* incorrectly.
*/
if ((mode & PORT_NONBLOCK) == 0) {
#ifdef USE_FIONBIO_IOCTL
#else
#endif
}
return (-1);
}
if (id)
return (0);
}
int
{
/* Do the select() first to get the socket into nonblocking mode. */
return (-1);
}
errno != EWOULDBLOCK &&
errno != EINPROGRESS) {
return (-1);
}
/* No error, or EWOULDBLOCK. select() tells when it's ready. */
if (id)
return (0);
}
int
int mode;
if (mode == -1) {
return (-1);
} else {
#ifdef USE_FIONBIO_IOCTL
int off = 0;
#else
#endif
}
}
/* Unlink from ctx->conns. */
else
/*
* Remove `this' from the ctx->accepts list (zero or more times).
*/
{
}
}
/* Wrap up and get out. */
return (0);
}
return (-1);
}
return (0);
}
int ret;
return (-1);
}
return (0);
if (ret == 0)
return (ret);
}
int
return (-1);
}
}
} else
} else {
return (-1);
}
}
return (0);
}
/* Private. */
static void
union {
#ifndef NO_SOCKADDR_UN
#endif
int new;
new = -1;
}
if (new >= 0) {
new = -1;
}
return;
}
static void
union {
#ifndef NO_SOCKADDR_UN
#endif
#ifndef NETREAD_BROKEN
#endif
void *conn_uap;
int socket_errno = 0;
#ifdef SO_ERROR
optlen = sizeof socket_errno;
if (fd < 0 &&
&optlen) < 0)
else
#endif
socket_errno ||
#ifdef NETREAD_BROKEN
0 ||
#else
#endif
fd = -1;
}
}
/*! \file */