1explain_getsockname_or_die(3L)ibrary Functions Manuaelxplain_getsockname_or_die(3)
2
3
4

NAME

6       explain_getsockname_or_die - get socket name and report errors
7

SYNOPSIS

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

DESCRIPTION

14       The explain_getsockname_or_die function is used to  call  the  getsock‐
15       name(2)  system  call.   On  failure  an explanation will be printed to
16       stderr, obtained from explain_getsockname(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 sockaddr sock_addr;
22              socklen_t sock_addr_size = sizeof(sock_addr);
23              explain_getsockname_or_die(fildes, &sock_addr, &sock_addr_size);
24
25       fildes  The fildes, exactly as to be passed to the getsockname(2)  sys‐
26               tem call.
27
28       sock_addr
29               The  sock_addr,  exactly  as to be passed to the getsockname(2)
30               system call.
31
32       sock_addr_size
33               The sock_addr_size, exactly as to be  passed  to  the  getsock‐
34               name(2) system call.
35
36       Returns:
37               This  function  only returns on success, see getsockaddr(1) for
38               more information.  On failure, prints an explanation and exits.
39

SEE ALSO

41       getsockname(2)
42               get socket name
43
44       explain_getsockname(3)
45               explain getsockname(2) errors
46
47       exit(2) terminate the calling process
48
50       libexplain version 1.4
51       Copyright (C) 2009 Peter Miller
52
53
54
55                                                 explain_getsockname_or_die(3)
Impressum