#include <limits.h>
#include <sys/uio.h>
#include <unistd.h>
Go to the source code of this file.
◆ IOV_MAX
◆ PG_IOV_MAX
◆ pg_preadv()
| static ssize_t pg_preadv |
( |
int |
fd, |
|
|
const struct iovec * |
iov, |
|
|
int |
iovcnt, |
|
|
pgoff_t |
offset |
|
) |
| |
|
inlinestatic |
Definition at line 54 of file pg_iovec.h.
55{
56#if HAVE_DECL_PREADV
57
58
59
60
61 if (iovcnt == 1)
62 return pread(
fd, iov[0].iov_base, iov[0].iov_len, offset);
63 else
64 return preadv(
fd, iov, iovcnt, offset);
65#else
66 ssize_t sum = 0;
67 ssize_t part;
68
69 for (
int i = 0;
i < iovcnt; ++
i)
70 {
71 part =
pg_pread(
fd, iov[
i].iov_base, iov[
i].iov_len, offset);
72 if (part < 0)
73 {
75 return -1;
76 else
77 return sum;
78 }
79 sum += part;
80 offset += part;
81 if ((
size_t) part < iov[
i].iov_len)
82 return sum;
83 }
84 return sum;
85#endif
86}
static int fd(const char *x, int i)
References fd(), i, and pg_pread.
Referenced by FileReadV(), and pgaio_io_perform_synchronously().
◆ pg_pwritev()
| static ssize_t pg_pwritev |
( |
int |
fd, |
|
|
const struct iovec * |
iov, |
|
|
int |
iovcnt, |
|
|
pgoff_t |
offset |
|
) |
| |
|
inlinestatic |
Definition at line 93 of file pg_iovec.h.
94{
95#if HAVE_DECL_PWRITEV
96
97
98
99
100 if (iovcnt == 1)
101 return pwrite(
fd, iov[0].iov_base, iov[0].iov_len, offset);
102 else
103 return pwritev(
fd, iov, iovcnt, offset);
104#else
105 ssize_t sum = 0;
106 ssize_t part;
107
108 for (
int i = 0;
i < iovcnt; ++
i)
109 {
110 part =
pg_pwrite(
fd, iov[
i].iov_base, iov[
i].iov_len, offset);
111 if (part < 0)
112 {
114 return -1;
115 else
116 return sum;
117 }
118 sum += part;
119 offset += part;
120 if ((
size_t) part < iov[
i].iov_len)
121 return sum;
122 }
123 return sum;
124#endif
125}
References fd(), i, and pg_pwrite.
Referenced by FileWriteV(), pg_pwritev_with_retry(), and pgaio_io_perform_synchronously().