1explain_socket_or_die(3) Library Functions Manual explain_socket_or_die(3)
2
3
4
6 explain_socket_or_die - create an endpoint and report errors
7
9 #include <libexplain/socket.h>
10 void explain_socket_or_die(int domain, int type, int protocol);
11
13 The explain_socket_or_die function is used to call the socket(2) system
14 call. On failure an explanation will be printed to stderr, obtained
15 from explain_socket(3), and then the process terminates by calling
16 exit(EXIT_FAILURE).
17
18 This function is intended to be used in a fashion similar to the fol‐
19 lowing example:
20 explain_socket_or_die(domain, type, protocol);
21
22 domain The domain, exactly as to be passed to the socket(2) system
23 call.
24
25 type The type, exactly as to be passed to the socket(2) system call.
26
27 protocol
28 The protocol, exactly as to be passed to the socket(2) system
29 call.
30
31 Returns:
32 This function only returns on success. On failure, prints an
33 explanation and exits.
34
36 socket(2)
37 create an endpoint for communication
38
39 explain_socket(3)
40 explain socket(2) errors
41
42 exit(2) terminate the calling process
43
45 libexplain version 0.40
46 Copyright (C) 2008 Peter Miller
47
48
49
50 explain_socket_or_die(3)