PostgreSQL Source Code  git master
preadv.c File Reference
#include "c.h"
#include <unistd.h>
#include "port/pg_iovec.h"
Include dependency graph for preadv.c:

Go to the source code of this file.

Functions

ssize_t pg_preadv (int fd, const struct iovec *iov, int iovcnt, off_t offset)
 

Function Documentation

◆ pg_preadv()

ssize_t pg_preadv ( int  fd,
const struct iovec *  iov,
int  iovcnt,
off_t  offset 
)

Definition at line 22 of file preadv.c.

23 {
24  ssize_t sum = 0;
25  ssize_t part;
26 
27  for (int i = 0; i < iovcnt; ++i)
28  {
29  part = pg_pread(fd, iov[i].iov_base, iov[i].iov_len, offset);
30  if (part < 0)
31  {
32  if (i == 0)
33  return -1;
34  else
35  return sum;
36  }
37  sum += part;
38  offset += part;
39  if (part < iov[i].iov_len)
40  return sum;
41  }
42  return sum;
43 }
int i
Definition: isn.c:73
#define pg_pread
Definition: port.h:225
static int fd(const char *x, int i)
Definition: preproc-init.c:105

References fd(), i, and pg_pread.