aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/storage/file/fd.c4
-rw-r--r--src/include/pg_config.h.in6
-rw-r--r--src/include/port/pg_iovec.h12
-rw-r--r--src/port/preadv.c17
-rw-r--r--src/port/pwritev.c17
-rw-r--r--src/tools/msvc/Solution.pm2
6 files changed, 8 insertions, 50 deletions
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 3d1a9733549..5a2eb012381 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3762,7 +3762,7 @@ data_sync_elevel(int elevel)
}
/*
- * A convenience wrapper for pg_pwritev() that retries on partial write. If an
+ * A convenience wrapper for pwritev() that retries on partial write. If an
* error is returned, it is unspecified how much has been written.
*/
ssize_t
@@ -3782,7 +3782,7 @@ pg_pwritev_with_retry(int fd, const struct iovec *iov, int iovcnt, off_t offset)
for (;;)
{
/* Write as much as we can. */
- part = pg_pwritev(fd, iov, iovcnt, offset);
+ part = pwritev(fd, iov, iovcnt, offset);
if (part < 0)
return -1;
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 4d61ecd9142..dfee47a1a45 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -412,9 +412,6 @@
/* Define to 1 if you have the <readline/readline.h> header file. */
#undef HAVE_READLINE_READLINE_H
-/* Define to 1 if you have the `readv' function. */
-#undef HAVE_READV
-
/* Define to 1 if you have the `rl_completion_matches' function. */
#undef HAVE_RL_COMPLETION_MATCHES
@@ -643,9 +640,6 @@
/* Define to 1 if you have the <winldap.h> header file. */
#undef HAVE_WINLDAP_H
-/* Define to 1 if you have the `writev' function. */
-#undef HAVE_WRITEV
-
/* Define to 1 if you have the `X509_get_signature_nid' function. */
#undef HAVE_X509_GET_SIGNATURE_NID
diff --git a/src/include/port/pg_iovec.h b/src/include/port/pg_iovec.h
index f0b1a71bcb8..f0a50c0e015 100644
--- a/src/include/port/pg_iovec.h
+++ b/src/include/port/pg_iovec.h
@@ -39,16 +39,12 @@ struct iovec
/* Define a reasonable maximum that is safe to use on the stack. */
#define PG_IOV_MAX Min(IOV_MAX, 32)
-#if HAVE_DECL_PREADV
-#define pg_preadv preadv
-#else
-extern ssize_t pg_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset);
+#if !HAVE_DECL_PREADV
+extern ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset);
#endif
-#if HAVE_DECL_PWRITEV
-#define pg_pwritev pwritev
-#else
-extern ssize_t pg_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset);
+#if !HAVE_DECL_PWRITEV
+extern ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset);
#endif
#endif /* PG_IOVEC_H */
diff --git a/src/port/preadv.c b/src/port/preadv.c
index aa7537503fb..48b64d4593d 100644
--- a/src/port/preadv.c
+++ b/src/port/preadv.c
@@ -8,33 +8,19 @@
* IDENTIFICATION
* src/port/preadv.c
*
- * Note that this implementation changes the current file position, unlike
- * the POSIX-like function, so we use the name pg_preadv().
- *
*-------------------------------------------------------------------------
*/
#include "postgres.h"
-#ifdef WIN32
-#include <windows.h>
-#else
#include <unistd.h>
-#endif
#include "port/pg_iovec.h"
ssize_t
-pg_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
+preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
{
-#ifdef HAVE_READV
- if (iovcnt == 1)
- return pread(fd, iov[0].iov_base, iov[0].iov_len, offset);
- if (lseek(fd, offset, SEEK_SET) < 0)
- return -1;
- return readv(fd, iov, iovcnt);
-#else
ssize_t sum = 0;
ssize_t part;
@@ -54,5 +40,4 @@ pg_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
return sum;
}
return sum;
-#endif
}
diff --git a/src/port/pwritev.c b/src/port/pwritev.c
index cb7421381e4..8b303fcbcdc 100644
--- a/src/port/pwritev.c
+++ b/src/port/pwritev.c
@@ -8,33 +8,19 @@
* IDENTIFICATION
* src/port/pwritev.c
*
- * Note that this implementation changes the current file position, unlike
- * the POSIX-like function, so we use the name pg_pwritev().
- *
*-------------------------------------------------------------------------
*/
#include "postgres.h"
-#ifdef WIN32
-#include <windows.h>
-#else
#include <unistd.h>
-#endif
#include "port/pg_iovec.h"
ssize_t
-pg_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
+pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
{
-#ifdef HAVE_WRITEV
- if (iovcnt == 1)
- return pwrite(fd, iov[0].iov_base, iov[0].iov_len, offset);
- if (lseek(fd, offset, SEEK_SET) < 0)
- return -1;
- return writev(fd, iov, iovcnt);
-#else
ssize_t sum = 0;
ssize_t part;
@@ -54,5 +40,4 @@ pg_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
return sum;
}
return sum;
-#endif
}
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 5a461a5212c..dd9d1a58ad6 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -332,7 +332,6 @@ sub GenerateFiles
HAVE_READLINE_H => undef,
HAVE_READLINE_HISTORY_H => undef,
HAVE_READLINE_READLINE_H => undef,
- HAVE_READV => undef,
HAVE_RL_COMPLETION_MATCHES => undef,
HAVE_RL_COMPLETION_SUPPRESS_QUOTE => undef,
HAVE_RL_FILENAME_COMPLETION_FUNCTION => undef,
@@ -408,7 +407,6 @@ sub GenerateFiles
HAVE_WINLDAP_H => undef,
HAVE_WCSTOMBS_L => 1,
HAVE_VISIBILITY_ATTRIBUTE => undef,
- HAVE_WRITEV => undef,
HAVE_X509_GET_SIGNATURE_NID => 1,
HAVE_X86_64_POPCNTQ => undef,
HAVE__BOOL => undef,