diff options
author | Thomas Munro <tmunro@postgresql.org> | 2022-07-22 12:30:37 +1200 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2022-07-22 12:41:17 +1200 |
commit | a1b56090eb54544b8ae01b95b424c254c6b71678 (patch) | |
tree | b7750840d5c64e715c2f4bedd4cc980e5d1af013 /src/bin/pg_test_fsync | |
parent | 4f1f5a7f85cee932c417aef589b27574813a06c9 (diff) | |
download | postgresql-a1b56090eb54544b8ae01b95b424c254c6b71678.tar.gz postgresql-a1b56090eb54544b8ae01b95b424c254c6b71678.zip |
Remove O_FSYNC and associated macros.
O_FSYNC was a pre-POSIX way of spelling O_SYNC, supported since commit
9d645fd84c3 for non-conforming operating systems of the time. It's not
needed on any modern system. We can just use standard O_SYNC directly
if it exists (= all targeted systems except Windows), and get rid of our
OPEN_SYNC_FLAG macro.
Similarly for standard O_DSYNC, we can just use that directly if it
exists (= all targeted systems except DragonFlyBSD), and get rid of our
OPEN_DATASYNC_FLAG macro.
We still avoid choosing open_datasync as a default value for
wal_sync_method if O_DSYNC has the same value as O_SYNC (= only
OpenBSD), so there is no change in default behavior.
Discussion: https://postgr.es/m/CA%2BhUKGJE7y92NY7FG2ftUbZUaqohBU65_Ys_7xF5mUHo4wirTQ%40mail.gmail.com
Diffstat (limited to 'src/bin/pg_test_fsync')
-rw-r--r-- | src/bin/pg_test_fsync/pg_test_fsync.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bin/pg_test_fsync/pg_test_fsync.c b/src/bin/pg_test_fsync/pg_test_fsync.c index f7bc199a30a..6739214eb83 100644 --- a/src/bin/pg_test_fsync/pg_test_fsync.c +++ b/src/bin/pg_test_fsync/pg_test_fsync.c @@ -300,7 +300,7 @@ test_sync(int writes_per_op) printf(LABEL_FORMAT, "open_datasync"); fflush(stdout); -#ifdef OPEN_DATASYNC_FLAG +#ifdef O_DSYNC if ((tmpfile = open_direct(filename, O_RDWR | O_DSYNC | PG_BINARY, 0)) == -1) { printf(NA_FORMAT, _("n/a*")); @@ -407,8 +407,8 @@ test_sync(int writes_per_op) printf(LABEL_FORMAT, "open_sync"); fflush(stdout); -#ifdef OPEN_SYNC_FLAG - if ((tmpfile = open_direct(filename, O_RDWR | OPEN_SYNC_FLAG | PG_BINARY, 0)) == -1) +#ifdef O_SYNC + if ((tmpfile = open_direct(filename, O_RDWR | O_SYNC | PG_BINARY, 0)) == -1) { printf(NA_FORMAT, _("n/a*")); fs_warning = true; @@ -466,7 +466,7 @@ test_open_syncs(void) static void test_open_sync(const char *msg, int writes_size) { -#ifdef OPEN_SYNC_FLAG +#ifdef O_SYNC int tmpfile, ops, writes; @@ -475,8 +475,8 @@ test_open_sync(const char *msg, int writes_size) printf(LABEL_FORMAT, msg); fflush(stdout); -#ifdef OPEN_SYNC_FLAG - if ((tmpfile = open_direct(filename, O_RDWR | OPEN_SYNC_FLAG | PG_BINARY, 0)) == -1) +#ifdef O_SYNC + if ((tmpfile = open_direct(filename, O_RDWR | O_SYNC | PG_BINARY, 0)) == -1) printf(NA_FORMAT, _("n/a*")); else { |