1explain_getpeername_or_die(3L)ibrary Functions Manuaelxplain_getpeername_or_die(3)
2
3
4

NAME

6       explain_getpeername_or_die - get name of peer socket and report errors
7

SYNOPSIS

9       #include <libexplain/getpeername.h>
10       void explain_getpeername_or_die(int fildes, struct sockaddr *sock_addr,
11       socklen_t *sock_addr_size);
12

DESCRIPTION

14       The explain_getpeername_or_die function is used to  call  the  getpeer‐
15       name(2)  system  call.   On  failure  an explanation will be printed to
16       stderr, obtained from explain_getpeername(3), and then the process ter‐
17       minates by calling exit(EXIT_FAILURE).
18
19       This  function  is intended to be used in a fashion similar to the fol‐
20       lowing example:
21              struct sockadd sock_addr;
22              socklen_t sock_addr_size = sizeof(sock_addr);
23              explain_getpeername_or_die(fildes, &sock_addr, &sock_addr_size);
24
25       fildes  The fildes, exactly as to be passed to the getpeername(2)  sys‐
26               tem call.
27
28       sock_addr
29               The  sock_addr,  exactly  as to be passed to the getpeername(2)
30               system call.
31
32       sock_addr_size
33               The sock_addr_size, exactly as to be  passed  to  the  getpeer‐
34               name(2) system call.
35
36       Returns:
37               This  function  only returns on success, see getpeername(2) for
38               more information.  On failure, prints an explanation and exits.
39

SEE ALSO

41       getpeername(2)
42               get name of connected peer socket
43
44       explain_getpeername(3)
45               explain getpeername(2) errors
46
47       exit(2) terminate the calling process
48
50       libexplain version 0.40
51       Copyright (C) 2009 Peter Miller
52
53
54
55                                                 explain_getpeername_or_die(3)
Impressum