1explain_write_or_die(3) Library Functions Manual explain_write_or_die(3)
2
3
4
6 explain_write_or_die - write to a file descriptor and report errors
7
9 #include <libexplain/write.h>
10 void explain_write_or_die(int fildes, const void *data, long
11 data_size);
12
14 The explain_write_or_die function is used to call the write(2) system
15 call. On failure an explanation will be printed to stderr, obtained
16 from explain_write(3), and then the process terminates by calling
17 exit(EXIT_FAILURE).
18
19 This function is intended to be used in a fashion similar to the fol‐
20 lowing example:
21 ssize_t result = explain_write_or_die(fildes, data, data_size);
22
23 fildes The fildes, exactly as to be passed to the write(2) system
24 call.
25
26 data The data, exactly as to be passed to the write(2) system call.
27
28 data_size
29 The data_size, exactly as to be passed to the write(2) system
30 call.
31
32 Returns:
33 This function only returns on success. On failure, prints an
34 explanation and exits.
35
37 write(2)
38 write to a file descriptor
39
40 explain_write(3)
41 explain write(2) errors
42
43 exit(2) terminate the calling process
44
46 libexplain version 0.40
47 Copyright (C) 2008 Peter Miller
48
49
50
51 explain_write_or_die(3)