.Fa "socklen_t *restrict address_len"
.Fc
.Sh DESCRIPTION
-.Fn Getsockname
-returns the current
+The
+.Fn getsockname
+function returns the current
.Fa address
-for the specified socket. The
+for the specified socket.
+.Pp
+The
.Fa address_len
parameter should be initialized to indicate
the amount of space pointed to by
.Fa address .
-On return it contains the actual size of the name
+On return it contains the actual size of the address
returned (in bytes).
+.Pp
+The address is truncated if the buffer provided is too small.
+.Pp
+Note: For the UNIX domain, the address length returned is the
+.Fa address_len
+parameter passed to the previous
+.Xr bind 2
+system call and not the
+.Va sa_len
+field of the
+.Fa address
+parameter passed to
+.Xr bind 2 .
.Sh RETURN VALUES
.Rv -std getsockname
.Sh ERRORS
.Sh BUGS
Names bound to sockets in the UNIX domain are inaccessible;
.Fn getsockname
-returns a zero-length name.
+returns a zero-length address.
.Sh HISTORY
The
.Fn getsockname