On success, zero is returned. On error, -1 is returned, and%uA0errno%uA0is set appropriately.
错误
标签
描述
EBADF
The argument%uA0s%uA0is not a valid descriptor.
EFAULT
The%uA0name%uA0parameter points to memory not in a valid part of the process address space.
EINVAL
namelen%uA0is invalid (e.g., is negative).
ENOBUFS
%uA0
Insufficient resources were available in the system to perform the operation.
ENOTSOCK
%uA0
The argument%uA0s%uA0is a file, not a socket.
遵循于
SVr4, 4.4BSD (the%uA0getsockname() function call appeared in 4.2BSD), POSIX.1-2001.
注意
The third argument of%uA0getsockname() is in reality an ‘int *’ (and this is what 4.x BSD and libc4 and libc5 have). Some POSIX confusion resulted in the present socklen_t, also used by glibc. See also%uA0accept(2).