if (CreateThread(NULL, 0, process_alarm, NULL, 0, NULL) == \
INVALID_HANDLE_VALUE) \
{ \
- fprintf(stderr, "Cannot create thread for alarm\n"); \
+ fprintf(stderr, _("Cannot create thread for alarm\n")); \
exit(1); \
} \
gettimeofday(&start_t, NULL); \
int
main(int argc, char *argv[])
{
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_test_fsync"));
progname = get_progname(argv[0]);
handle_args(argc, argv);
{
if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
{
- printf("Usage: %s [-f FILENAME] [-s SECS-PER-TEST]\n", progname);
+ printf(_("Usage: %s [-f FILENAME] [-s SECS-PER-TEST]\n"), progname);
exit(0);
}
if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
break;
default:
- fprintf(stderr, "Try \"%s --help\" for more information.\n",
+ fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
progname);
exit(1);
break;
if (argc > optind)
{
fprintf(stderr,
- "%s: too many command-line arguments (first is \"%s\")\n",
+ _("%s: too many command-line arguments (first is \"%s\")\n"),
progname, argv[optind]);
- fprintf(stderr, "Try \"%s --help\" for more information.\n",
+ fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
progname);
exit(1);
}
- printf("%d seconds per test\n", secs_per_test);
+ printf(_("%d seconds per test\n"), secs_per_test);
#if PG_O_DIRECT != 0
- printf("O_DIRECT supported on this platform for open_datasync and open_sync.\n");
+ printf(_("O_DIRECT supported on this platform for open_datasync and open_sync.\n"));
#else
- printf("Direct I/O is not supported on this platform.\n");
+ printf(_("Direct I/O is not supported on this platform.\n"));
#endif
}
bool fs_warning = false;
if (writes_per_op == 1)
- printf("\nCompare file sync methods using one %dkB write:\n", XLOG_BLCKSZ_K);
+ printf(_("\nCompare file sync methods using one %dkB write:\n"), XLOG_BLCKSZ_K);
else
- printf("\nCompare file sync methods using two %dkB writes:\n", XLOG_BLCKSZ_K);
- printf("(in wal_sync_method preference order, except fdatasync is Linux's default)\n");
+ printf(_("\nCompare file sync methods using two %dkB writes:\n"), XLOG_BLCKSZ_K);
+ printf(_("(in wal_sync_method preference order, except fdatasync is Linux's default)\n"));
/*
* Test open_datasync if available
#ifdef OPEN_DATASYNC_FLAG
if ((tmpfile = open(filename, O_RDWR | O_DSYNC | PG_O_DIRECT, 0)) == -1)
{
- printf(NA_FORMAT, "n/a*\n");
+ printf(NA_FORMAT, _("n/a*\n"));
fs_warning = true;
}
else
close(tmpfile);
}
#else
- printf(NA_FORMAT, "n/a\n");
+ printf(NA_FORMAT, _("n/a\n"));
#endif
/*
STOP_TIMER;
close(tmpfile);
#else
- printf(NA_FORMAT, "n/a\n");
+ printf(NA_FORMAT, _("n/a\n"));
#endif
/*
STOP_TIMER;
close(tmpfile);
#else
- printf(NA_FORMAT, "n/a\n");
+ printf(NA_FORMAT, _("n/a\n"));
#endif
/*
#ifdef OPEN_SYNC_FLAG
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG | PG_O_DIRECT, 0)) == -1)
{
- printf(NA_FORMAT, "n/a*\n");
+ printf(NA_FORMAT, _("n/a*\n"));
fs_warning = true;
}
else
close(tmpfile);
}
#else
- printf(NA_FORMAT, "n/a\n");
+ printf(NA_FORMAT, _("n/a\n"));
#endif
if (fs_warning)
{
- printf("* This file system and its mount options do not support direct\n");
- printf("I/O, e.g. ext4 in journaled mode.\n");
+ printf(_("* This file system and its mount options do not support direct\n"
+ " I/O, e.g. ext4 in journaled mode.\n"));
}
}
static void
test_open_syncs(void)
{
- printf("\nCompare open_sync with different write sizes:\n");
- printf("(This is designed to compare the cost of writing 16kB in different write\n"
- "open_sync sizes.)\n");
-
- test_open_sync(" 1 * 16kB open_sync write", 16);
- test_open_sync(" 2 * 8kB open_sync writes", 8);
- test_open_sync(" 4 * 4kB open_sync writes", 4);
- test_open_sync(" 8 * 2kB open_sync writes", 2);
- test_open_sync("16 * 1kB open_sync writes", 1);
+ printf(_("\nCompare open_sync with different write sizes:\n"));
+ printf(_("(This is designed to compare the cost of writing 16kB in different write\n"
+ "open_sync sizes.)\n"));
+
+ test_open_sync(_(" 1 * 16kB open_sync write"), 16);
+ test_open_sync(_(" 2 * 8kB open_sync writes"), 8);
+ test_open_sync(_(" 4 * 4kB open_sync writes"), 4);
+ test_open_sync(_(" 8 * 2kB open_sync writes"), 2);
+ test_open_sync(_("16 * 1kB open_sync writes"), 1);
}
/*
#ifdef OPEN_SYNC_FLAG
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG | PG_O_DIRECT, 0)) == -1)
- printf(NA_FORMAT, "n/a*\n");
+ printf(NA_FORMAT, _("n/a*\n"));
else
{
START_TIMER;
close(tmpfile);
}
#else
- printf(NA_FORMAT, "n/a\n");
+ printf(NA_FORMAT, _("n/a\n"));
#endif
}
* against the same file. Possibly this should be done with writethrough
* on platforms which support it.
*/
- printf("\nTest if fsync on non-write file descriptor is honored:\n");
- printf("(If the times are similar, fsync() can sync data written on a different\n"
- "descriptor.)\n");
+ printf(_("\nTest if fsync on non-write file descriptor is honored:\n"));
+ printf(_("(If the times are similar, fsync() can sync data written on a different\n"
+ "descriptor.)\n"));
/*
* first write, fsync and close, which is the normal behavior without
/*
* Test a simple write without fsync
*/
- printf("\nNon-sync'ed %dkB writes:\n", XLOG_BLCKSZ_K);
+ printf(_("\nNon-sync'ed %dkB writes:\n"), XLOG_BLCKSZ_K);
printf(LABEL_FORMAT, "write");
fflush(stdout);
static void
die(const char *str)
{
- fprintf(stderr, "%s: %s\n", str, strerror(errno));
+ fprintf(stderr, _("%s: %s\n"), _(str), strerror(errno));
exit(1);
}