diff options
Diffstat (limited to 'lib/libc/sys/getpeername.2')
-rw-r--r-- | lib/libc/sys/getpeername.2 | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/lib/libc/sys/getpeername.2 b/lib/libc/sys/getpeername.2 index d89488c..b9b6a03 100644 --- a/lib/libc/sys/getpeername.2 +++ b/lib/libc/sys/getpeername.2 @@ -38,6 +38,8 @@ .Nm getpeername .Nd get name of connected peer .Sh SYNOPSIS +.Fd #include <sys/types.h> +.Fd #include <sys/socket.h> .Ft int .Fn getpeername "int s" "struct sockaddr *name" "int *namelen" .Sh DESCRIPTION @@ -53,7 +55,29 @@ the amount of space pointed to by On return it contains the actual size of the name returned (in bytes). The name is truncated if the buffer provided is too small. -.Sh DIAGNOSTICS +.Sh IMPLEMENTATION NOTES +.Pp +In the non-threaded library +.Fn getpeername +is implemented as the +.Va getpeername +syscall. +.Pp +In the threaded library, the +.Va getpeername +syscall is assembled to +.Fn _thread_sys_getpeername +and +.Fn getpeername +is implemented as a function which locks +.Va s +for read and write, then calls +.Fn _thread_sys_getpeername . +Before returning, +.Fn getpeername +unlocks +.Va s . +.Sh RETURN VALUES A 0 is returned if the call succeeds, -1 if it fails. .Sh ERRORS The call succeeds unless: @@ -80,10 +104,10 @@ process address space. .Sh SEE ALSO .Xr accept 2 , .Xr bind 2 , -.Xr socket 2 , -.Xr getsockname 2 +.Xr getsockname 2 , +.Xr socket 2 .Sh HISTORY The -.Nm +.Fn getpeername function call appeared in .Bx 4.2 . |