1explain_accept_or_die(3) Library Functions Manual explain_accept_or_die(3)
2
3
4
6 explain_accept_or_die - accept a connection on a socket and report
7 errors
8
10 #include <libexplain/accept.h>
11 int explain_accept_or_die(int fildes, struct sockaddr *sock_addr,
12 socklen_t *sock_addr_size);
13
15 The explain_accept_or_die function is used to call the accept(2) system
16 call. On failure an explanation will be printed to stderr, obtained
17 from explain_accept(3), and then the process terminates by calling
18 exit(EXIT_FAILURE).
19
20 This function is intended to be used in a fashion similar to the fol‐
21 lowing example:
22 int fd = explain_accept_or_die(fildes, sock_addr, sock_addr_size);
23
24 fildes The fildes, exactly as to be passed to the accept(2) system
25 call.
26
27 sock_addr
28 The sock_addr, exactly as to be passed to the accept(2) system
29 call.
30
31 sock_addr_size
32 The sock_addr_size, exactly as to be passed to the accept(2)
33 system call.
34
35 Returns:
36 This function only returns on success, see accept(2) for more
37 information. On failure, prints an explanation and exits.
38
40 accept(2)
41 accept a connection on a socket
42
43 explain_accept(3)
44 explain accept(2) errors
45
46 exit(2) terminate the calling process
47
49 libexplain version 1.4
50 Copyright (C) 2008 Peter Miller
51
52
53
54 explain_accept_or_die(3)