mirror of
https://github.com/postgres/postgres.git
synced 2025-11-16 15:02:33 +03:00
Remove dead pread and pwrite replacement code.
pread() and pwrite() are in SUSv2, and all targeted Unix systems have
them.
Previously, we defined pg_pread and pg_pwrite to emulate these function
with lseek() on old Unixen. The names with a pg_ prefix were a reminder
of a portability hazard: they might change the current file position.
That hazard is gone, so we can drop the prefixes.
Since the remaining replacement code is Windows-only, move it into
src/port/win32p{read,write}.c, and move the declarations into
src/include/port/win32_port.h.
No need for vestigial HAVE_PREAD, HAVE_PWRITE macros as they were only
used for declarations in port.h which have now moved into win32_port.h.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Greg Stark <stark@mit.edu>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com
This commit is contained in:
@@ -312,10 +312,10 @@ test_sync(int writes_per_op)
|
||||
for (ops = 0; alarm_triggered == false; ops++)
|
||||
{
|
||||
for (writes = 0; writes < writes_per_op; writes++)
|
||||
if (pg_pwrite(tmpfile,
|
||||
buf,
|
||||
XLOG_BLCKSZ,
|
||||
writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
|
||||
if (pwrite(tmpfile,
|
||||
buf,
|
||||
XLOG_BLCKSZ,
|
||||
writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
|
||||
die("write failed");
|
||||
}
|
||||
STOP_TIMER;
|
||||
@@ -338,10 +338,10 @@ test_sync(int writes_per_op)
|
||||
for (ops = 0; alarm_triggered == false; ops++)
|
||||
{
|
||||
for (writes = 0; writes < writes_per_op; writes++)
|
||||
if (pg_pwrite(tmpfile,
|
||||
buf,
|
||||
XLOG_BLCKSZ,
|
||||
writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
|
||||
if (pwrite(tmpfile,
|
||||
buf,
|
||||
XLOG_BLCKSZ,
|
||||
writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
|
||||
die("write failed");
|
||||
fdatasync(tmpfile);
|
||||
}
|
||||
@@ -363,10 +363,10 @@ test_sync(int writes_per_op)
|
||||
for (ops = 0; alarm_triggered == false; ops++)
|
||||
{
|
||||
for (writes = 0; writes < writes_per_op; writes++)
|
||||
if (pg_pwrite(tmpfile,
|
||||
buf,
|
||||
XLOG_BLCKSZ,
|
||||
writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
|
||||
if (pwrite(tmpfile,
|
||||
buf,
|
||||
XLOG_BLCKSZ,
|
||||
writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
|
||||
die("write failed");
|
||||
if (fsync(tmpfile) != 0)
|
||||
die("fsync failed");
|
||||
@@ -387,10 +387,10 @@ test_sync(int writes_per_op)
|
||||
for (ops = 0; alarm_triggered == false; ops++)
|
||||
{
|
||||
for (writes = 0; writes < writes_per_op; writes++)
|
||||
if (pg_pwrite(tmpfile,
|
||||
buf,
|
||||
XLOG_BLCKSZ,
|
||||
writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
|
||||
if (pwrite(tmpfile,
|
||||
buf,
|
||||
XLOG_BLCKSZ,
|
||||
writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
|
||||
die("write failed");
|
||||
if (pg_fsync_writethrough(tmpfile) != 0)
|
||||
die("fsync failed");
|
||||
@@ -419,10 +419,10 @@ test_sync(int writes_per_op)
|
||||
for (ops = 0; alarm_triggered == false; ops++)
|
||||
{
|
||||
for (writes = 0; writes < writes_per_op; writes++)
|
||||
if (pg_pwrite(tmpfile,
|
||||
buf,
|
||||
XLOG_BLCKSZ,
|
||||
writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
|
||||
if (pwrite(tmpfile,
|
||||
buf,
|
||||
XLOG_BLCKSZ,
|
||||
writes * XLOG_BLCKSZ) != XLOG_BLCKSZ)
|
||||
|
||||
/*
|
||||
* This can generate write failures if the filesystem has
|
||||
@@ -484,10 +484,10 @@ test_open_sync(const char *msg, int writes_size)
|
||||
for (ops = 0; alarm_triggered == false; ops++)
|
||||
{
|
||||
for (writes = 0; writes < 16 / writes_size; writes++)
|
||||
if (pg_pwrite(tmpfile,
|
||||
buf,
|
||||
writes_size * 1024,
|
||||
writes * writes_size * 1024) !=
|
||||
if (pwrite(tmpfile,
|
||||
buf,
|
||||
writes_size * 1024,
|
||||
writes * writes_size * 1024) !=
|
||||
writes_size * 1024)
|
||||
die("write failed");
|
||||
}
|
||||
@@ -586,7 +586,7 @@ test_non_sync(void)
|
||||
START_TIMER;
|
||||
for (ops = 0; alarm_triggered == false; ops++)
|
||||
{
|
||||
if (pg_pwrite(tmpfile, buf, XLOG_BLCKSZ, 0) != XLOG_BLCKSZ)
|
||||
if (pwrite(tmpfile, buf, XLOG_BLCKSZ, 0) != XLOG_BLCKSZ)
|
||||
die("write failed");
|
||||
}
|
||||
STOP_TIMER;
|
||||
|
||||
Reference in New Issue
Block a user