aboutsummaryrefslogtreecommitdiffstats
path: root/man/man7/aio.7
diff options
context:
space:
mode:
Diffstat (limited to 'man/man7/aio.7')
-rw-r--r--man/man7/aio.717
1 files changed, 8 insertions, 9 deletions
diff --git a/man/man7/aio.7 b/man/man7/aio.7
index 931247a580..a3937206bf 100644
--- a/man/man7/aio.7
+++ b/man/man7/aio.7
@@ -226,6 +226,7 @@ aio_return():
.SS Program source
\&
.EX
+#include <err.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
@@ -236,8 +237,6 @@ aio_return():
\&
#define BUF_SIZE 20 /* Size of buffers for read operations */
\&
-#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0)
-\&
struct ioRequest { /* Application\-defined structure for tracking
I/O requests */
int reqNum;
@@ -290,11 +289,11 @@ main(int argc, char *argv[])
\&
struct ioRequest *ioList = calloc(numReqs, sizeof(*ioList));
if (ioList == NULL)
- errExit("calloc");
+ err(EXIT_FAILURE, "calloc");
\&
struct aiocb *aiocbList = calloc(numReqs, sizeof(*aiocbList));
if (aiocbList == NULL)
- errExit("calloc");
+ err(EXIT_FAILURE, "calloc");
\&
/* Establish handlers for SIGQUIT and the I/O completion signal. */
\&
@@ -303,12 +302,12 @@ main(int argc, char *argv[])
\&
sa.sa_handler = quitHandler;
if (sigaction(SIGQUIT, &sa, NULL) == \-1)
- errExit("sigaction");
+ err(EXIT_FAILURE, "sigaction");
\&
sa.sa_flags = SA_RESTART | SA_SIGINFO;
sa.sa_sigaction = aioSigHandler;
if (sigaction(IO_SIGNAL, &sa, NULL) == \-1)
- errExit("sigaction");
+ err(EXIT_FAILURE, "sigaction");
\&
/* Open each file specified on the command line, and queue
a read request on the resulting file descriptor. */
@@ -320,13 +319,13 @@ main(int argc, char *argv[])
\&
ioList[j].aiocbp\->aio_fildes = open(argv[j + 1], O_RDONLY);
if (ioList[j].aiocbp\->aio_fildes == \-1)
- errExit("open");
+ err(EXIT_FAILURE, "open");
printf("opened %s on descriptor %d\[rs]n", argv[j + 1],
ioList[j].aiocbp\->aio_fildes);
\&
ioList[j].aiocbp\->aio_buf = malloc(BUF_SIZE);
if (ioList[j].aiocbp\->aio_buf == NULL)
- errExit("malloc");
+ err(EXIT_FAILURE, "malloc");
\&
ioList[j].aiocbp\->aio_nbytes = BUF_SIZE;
ioList[j].aiocbp\->aio_reqprio = 0;
@@ -338,7 +337,7 @@ main(int argc, char *argv[])
\&
s = aio_read(ioList[j].aiocbp);
if (s == \-1)
- errExit("aio_read");
+ err(EXIT_FAILURE, "aio_read");
}
\&
openReqs = numReqs;