HP-UX Reference (11i v1 00/12) - 2 System Calls (vol 5)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man2/!!!intro.2
________________________________________________________________
___ ___
a
accept(2) accept(2)
If an error occurs, accept() returns -1 and sets errno to indicate the cause.
ERRORS
If accept() fails, errno is set to one of the following values:
[EAGAIN] Nonblocking I/O is enabled using O_NONBLOCK and no connections are present to be
accepted.
[EBADF] The argument, s, is not a valid file descriptor.
[ECONNABORTED] The socket is being shutdown due to a request by software. This is usually caused by
a shutdown() system call.
[EFAULT] The addr parameter is not a valid pointer.
[EINTR] The call was interrupted by a signal before a valid connection arrived.
[EINVAL] The socket referenced by s is not currently a listen socket or has been shut down with
shutdown().Alisten() must be done before an accept() is allowed.
[EMFILE] The maximum number of file descriptors for this process are currently open.
[ENFILE] The system’s table of open files is full and no more
accept() calls can be processed
at this time.
[ENOBUFS] No buffer space is available. The accept() cannot complete. The queued socket
connect request is aborted.
[ENOMEM] No memory is available. The accept() cannot complete. The queued socket con-
nect request is aborted.
[ENOTSOCK] The argument, s, is a valid file descriptor, but it is not a socket.
[EOPNOTSUPP] The socket referenced by s does not support accept().
[EWOULDBLOCK] Nonblocking I/O is enabled using
O_NDELAY or FIOSNBIO and no connections are
present to be accepted.
OBSOLESCENCE
Currently, the
socklen_t and size_t types are the same size. This is compatible with both the UNIX
95 and UNIX 98 profiles. However, in a future release, socklen_t might be a different size. In that
case, passing a size_t pointer will evoke compile-time warnings, which must be corrected in order for the
application to behave correctly. Applications that use socklen_t now, where appropriate, will avoid
such migration problems. On the other hand, applications that need to be portable to the UNIX 95 profile
should follow the X/Open specification (see xopen_networking(7)).
FUTURE DIRECTION
Currently, the default behavior is the HP-UX BSD Sockets; however, it might be changed to X/Open
Sockets in a future release. At that time, any HP-UX BSD Sockets behavior that is incompatible with
X/Open Sockets might be obsoleted. Applications that conform to the X/Open specification now will avoid
migration problems (see xopen_networking(7)).
MULTITHREAD USAGE
The
accept() system call is thread-safe. It has a cancellation point; and it is async-cancel safe, async-
signal safe, and fork-safe.
AUTHOR
accept() was developed by HP and the University of California, Berkeley.
SEE ALSO
bind(2), connect(2), listen(2), select(2), socket(2), socketx25(7), xopen_networking(7).
STANDARDS CONFORMANCE
accept(): XPG4
HP-UX Release 11i: December 2000 − 2 − Section 2−−3
___
___