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

Go to the source code of this file.

Functions

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

Function Documentation

◆ pg_pwritev()

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

Definition at line 22 of file pwritev.c.

23 {
24  ssize_t sum = 0;
25  ssize_t part;
26 
27  for (int i = 0; i < iovcnt; ++i)
28  {
29  part = pg_pwrite(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_pwrite
Definition: port.h:226
static int fd(const char *x, int i)
Definition: preproc-init.c:105

References fd(), i, and pg_pwrite.

Referenced by pg_pwritev_with_retry().