Provided by:
manpages-zh_1.5.2-1_all 
NAME
accept -
SYNOPSIS
#include <sys/types.h>
#include <sys/socket.h>
int accept(int s, struct sockaddr *addr, socklen_t *addrlen);
DESCRIPTION
accept (SOCK_STREAM, SOCK_SEQPACKET SOCK_RDM). , s ,, .. s . ( fcntl
F_SETFL ,) accept. .
s socket(2) , bind(2) , listen(2). . addr sockaddr.. ,. addr . (
socket(2) ). addrlen : addr ; . addr NULL,addrlenNULL.
,, accept . , accept EAGAIN.
select(2) poll(2). . , accept ., SIGIO; socket(7)
, DECNet, accept . , .LinuxDECNet .
NOTES
SIGIO select(2) poll(2) , accept ., . accept , s O_NONBLOCK (
socket(7)).
RETURN VALUE
-1. .
ERROR HANDLING
Linux accept accept . BSD., accept ,, EAGAIN .TCP/IP ENETDOWN,
EPROTO, ENOPROTOOPT, EHOSTDOWN, ENONET, EHOSTUNREACH, EOPNOTSUPP,
ENETUNREACH.
ERRORS
EAGAINEWOULDBLOCK
,.
EBADF .
ENOTSOCK
,.
EOPNOTSUPP
SOCK_STREAM.
EFAULT addr .
EPERM .
ENOBUFS,ENOMEM
. , .
,. Linux EMFILE, EINVAL, ENOSR, ENOBUFS, EPERM, ECONNABORTED,
ESOCKTNOSUPPORT, EPROTONOSUPPORT, ETIMEDOUT, ERESTARTSYS.
CONFORMING TO
SVr4,4.4BSD( accept BSD 4.2). BSD (EBADF, ENOTSOCK, EOPNOTSUPP,
EWOULDBLOCK, EFAULT). SUSv2EAGAIN, EBADF, ECONNABORTED, EFAULT, EINTR,
EINVAL, EMFILE, ENFILE, ENOBUFS, ENOMEM, ENOSR, ENOTSOCK, EOPNOTSUPP,
EPROTO, EWOULDBLOCK.
Linux accept O_NONBLOCK . BSD. ,accept.
NOTE
accept 'int *'(libc4libc5, BSD 4.*,SunOS 4, SGI);POSIX 1003.1g `size_t
*',SunOS 5. POSIXSingle Unix Specificationglibc2 `socklen_t *'.
Quoting Linus Torvalds: Linus Torvalds (:Linux,, ): I fails: only
italicizes a single line _Any_ sane library _must_ have "socklen_t" be
the same size as int. Anything else breaks any BSD socket layer stuff.
POSIX initially _did_ make it a size_t, and I (and hopefully others,
but obviously not too many) complained to them very loudly indeed.
Making it a size_t is completely broken, exactly because size_t very
seldom is the same size as "int" on 64-bit architectures, for example.
And it _has_ to be the same size as "int" because that's what the BSD
socket interface is. Anyway, the POSIX people eventually got a clue,
and created "socklen_t". They shouldn't have touched it in the first
place, but once they did they felt it had to have a named type for some
unfathomable reason (probably somebody didn't like losing face over
having done the original stupid thing, so they silently just renamed
their blunder).
"socklen_t"int. BSD.POSIXsize_t, Linus Torvalds(,) size_t,64
size_tint,(accept )int,BSD .POSIX, "socklen_t".Linux Torvalds , .
SEE ALSO
bind(2), connect(2), listen(2), select(2), socket(2)
[]
byeyear <love_my_love@263.net >
[]
2002.01.27
linuxman:
http://cmpp.linuxforum.net