4444if (CreateThread(NULL, 0, process_alarm, NULL, 0, NULL) == \
4545INVALID_HANDLE_VALUE) \
4646{ \
47- fprintf(stderr, "Cannot create thread for alarm\n"); \
47+ fprintf(stderr,_( "Cannot create thread for alarm\n") ); \
4848exit(1); \
4949} \
5050gettimeofday(&start_t, NULL); \
@@ -96,6 +96,7 @@ static void die(const char *str);
9696int
9797main (int argc ,char * argv [])
9898{
99+ set_pglocale_pgservice (argv [0 ],PG_TEXTDOMAIN ("pg_test_fsync" ));
99100progname = get_progname (argv [0 ]);
100101
101102handle_args (argc ,argv );
@@ -148,7 +149,7 @@ handle_args(int argc, char *argv[])
148149{
149150if (strcmp (argv [1 ],"--help" )== 0 || strcmp (argv [1 ],"-?" )== 0 )
150151{
151- printf ("Usage: %s [-f FILENAME] [-s SECS-PER-TEST]\n" ,progname );
152+ printf (_ ( "Usage: %s [-f FILENAME] [-s SECS-PER-TEST]\n" ) ,progname );
152153exit (0 );
153154}
154155if (strcmp (argv [1 ],"--version" )== 0 || strcmp (argv [1 ],"-V" )== 0 )
@@ -172,7 +173,7 @@ handle_args(int argc, char *argv[])
172173break ;
173174
174175default :
175- fprintf (stderr ,"Try \"%s --help\" for more information.\n" ,
176+ fprintf (stderr ,_ ( "Try \"%s --help\" for more information.\n" ) ,
176177progname );
177178exit (1 );
178179break ;
@@ -182,18 +183,18 @@ handle_args(int argc, char *argv[])
182183if (argc > optind )
183184{
184185fprintf (stderr ,
185- "%s: too many command-line arguments (first is \"%s\")\n" ,
186+ _ ( "%s: too many command-line arguments (first is \"%s\")\n" ) ,
186187progname ,argv [optind ]);
187- fprintf (stderr ,"Try \"%s --help\" for more information.\n" ,
188+ fprintf (stderr ,_ ( "Try \"%s --help\" for more information.\n" ) ,
188189progname );
189190exit (1 );
190191}
191192
192- printf ("%d seconds per test\n" ,secs_per_test );
193+ printf (_ ( "%d seconds per test\n" ) ,secs_per_test );
193194#if PG_O_DIRECT != 0
194- printf ("O_DIRECT supported on this platform for open_datasync and open_sync.\n" );
195+ printf (_ ( "O_DIRECT supported on this platform for open_datasync and open_sync.\n" ) );
195196#else
196- printf ("Direct I/O is not supported on this platform.\n" );
197+ printf (_ ( "Direct I/O is not supported on this platform.\n" ) );
197198#endif
198199}
199200
@@ -239,10 +240,10 @@ test_sync(int writes_per_op)
239240bool fs_warning = false;
240241
241242if (writes_per_op == 1 )
242- printf ("\nCompare file sync methods using one %dkB write:\n" ,XLOG_BLCKSZ_K );
243+ printf (_ ( "\nCompare file sync methods using one %dkB write:\n" ) ,XLOG_BLCKSZ_K );
243244else
244- printf ("\nCompare file sync methods using two %dkB writes:\n" ,XLOG_BLCKSZ_K );
245- printf ("(in wal_sync_method preference order, except fdatasync is Linux's default)\n" );
245+ printf (_ ( "\nCompare file sync methods using two %dkB writes:\n" ) ,XLOG_BLCKSZ_K );
246+ printf (_ ( "(in wal_sync_method preference order, except fdatasync is Linux's default)\n" ) );
246247
247248/*
248249 * Test open_datasync if available
@@ -253,7 +254,7 @@ test_sync(int writes_per_op)
253254#ifdef OPEN_DATASYNC_FLAG
254255if ((tmpfile = open (filename ,O_RDWR |O_DSYNC |PG_O_DIRECT ,0 ))== -1 )
255256{
256- printf (NA_FORMAT ,"n/a*\n" );
257+ printf (NA_FORMAT ,_ ( "n/a*\n" ) );
257258fs_warning = true;
258259}
259260else
@@ -271,7 +272,7 @@ test_sync(int writes_per_op)
271272close (tmpfile );
272273}
273274#else
274- printf (NA_FORMAT ,"n/a\n" );
275+ printf (NA_FORMAT ,_ ( "n/a\n" ) );
275276#endif
276277
277278/*
@@ -296,7 +297,7 @@ test_sync(int writes_per_op)
296297STOP_TIMER ;
297298close (tmpfile );
298299#else
299- printf (NA_FORMAT ,"n/a\n" );
300+ printf (NA_FORMAT ,_ ( "n/a\n" ) );
300301#endif
301302
302303/*
@@ -344,7 +345,7 @@ test_sync(int writes_per_op)
344345STOP_TIMER ;
345346close (tmpfile );
346347#else
347- printf (NA_FORMAT ,"n/a\n" );
348+ printf (NA_FORMAT ,_ ( "n/a\n" ) );
348349#endif
349350
350351/*
@@ -356,7 +357,7 @@ test_sync(int writes_per_op)
356357#ifdef OPEN_SYNC_FLAG
357358if ((tmpfile = open (filename ,O_RDWR |OPEN_SYNC_FLAG |PG_O_DIRECT ,0 ))== -1 )
358359{
359- printf (NA_FORMAT ,"n/a*\n" );
360+ printf (NA_FORMAT ,_ ( "n/a*\n" ) );
360361fs_warning = true;
361362}
362363else
@@ -381,28 +382,28 @@ test_sync(int writes_per_op)
381382close (tmpfile );
382383}
383384#else
384- printf (NA_FORMAT ,"n/a\n" );
385+ printf (NA_FORMAT ,_ ( "n/a\n" ) );
385386#endif
386387
387388if (fs_warning )
388389{
389- printf ("* This file system and its mount options do not support direct\n" );
390- printf ( " I/O, e.g. ext4 in journaled mode.\n" );
390+ printf (_ ( "* This file system and its mount options do not support direct\n"
391+ " I/O, e.g. ext4 in journaled mode.\n") );
391392}
392393}
393394
394395static void
395396test_open_syncs (void )
396397{
397- printf ("\nCompare open_sync with different write sizes:\n" );
398- printf ("(This is designed to compare the cost of writing 16kB in different write\n"
399- "open_sync sizes.)\n" );
400-
401- test_open_sync (" 1 * 16kB open_sync write" ,16 );
402- test_open_sync (" 2 * 8kB open_sync writes" ,8 );
403- test_open_sync (" 4 * 4kB open_sync writes" ,4 );
404- test_open_sync (" 8 * 2kB open_sync writes" ,2 );
405- test_open_sync ("16 * 1kB open_sync writes" ,1 );
398+ printf (_ ( "\nCompare open_sync with different write sizes:\n" ) );
399+ printf (_ ( "(This is designed to compare the cost of writing 16kB in different write\n"
400+ "open_sync sizes.)\n" ) );
401+
402+ test_open_sync (_ ( " 1 * 16kB open_sync write" ) ,16 );
403+ test_open_sync (_ ( " 2 * 8kB open_sync writes" ) ,8 );
404+ test_open_sync (_ ( " 4 * 4kB open_sync writes" ) ,4 );
405+ test_open_sync (_ ( " 8 * 2kB open_sync writes" ) ,2 );
406+ test_open_sync (_ ( "16 * 1kB open_sync writes" ) ,1 );
406407}
407408
408409/*
@@ -422,7 +423,7 @@ test_open_sync(const char *msg, int writes_size)
422423
423424#ifdef OPEN_SYNC_FLAG
424425if ((tmpfile = open (filename ,O_RDWR |OPEN_SYNC_FLAG |PG_O_DIRECT ,0 ))== -1 )
425- printf (NA_FORMAT ,"n/a*\n" );
426+ printf (NA_FORMAT ,_ ( "n/a*\n" ) );
426427else
427428{
428429START_TIMER ;
@@ -439,7 +440,7 @@ test_open_sync(const char *msg, int writes_size)
439440close (tmpfile );
440441}
441442#else
442- printf (NA_FORMAT ,"n/a\n" );
443+ printf (NA_FORMAT ,_ ( "n/a\n" ) );
443444#endif
444445}
445446
@@ -455,9 +456,9 @@ test_file_descriptor_sync(void)
455456 * against the same file. Possibly this should be done with writethrough
456457 * on platforms which support it.
457458 */
458- printf ("\nTest if fsync on non-write file descriptor is honored:\n" );
459- printf ("(If the times are similar, fsync() can sync data written on a different\n"
460- "descriptor.)\n" );
459+ printf (_ ( "\nTest if fsync on non-write file descriptor is honored:\n" ) );
460+ printf (_ ( "(If the times are similar, fsync() can sync data written on a different\n"
461+ "descriptor.)\n" ) );
461462
462463/*
463464 * first write, fsync and close, which is the normal behavior without
@@ -521,7 +522,7 @@ test_non_sync(void)
521522/*
522523 * Test a simple write without fsync
523524 */
524- printf ("\nNon-sync'ed %dkB writes:\n" ,XLOG_BLCKSZ_K );
525+ printf (_ ( "\nNon-sync'ed %dkB writes:\n" ) ,XLOG_BLCKSZ_K );
525526printf (LABEL_FORMAT ,"write" );
526527fflush (stdout );
527528
@@ -598,6 +599,6 @@ process_alarm(LPVOID param)
598599static void
599600die (const char * str )
600601{
601- fprintf (stderr ,"%s: %s\n" , str ,strerror (errno ));
602+ fprintf (stderr ,_ ( "%s: %s\n" ), _ ( str ) ,strerror (errno ));
602603exit (1 );
603604}