Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b66fbd8

Browse files
committed
Use SIGNAL_ARGS consistently to declare signal handlers.
Various bits of code were declaring signal handlers manually, using "int signum" or variants of that. We evidently have no platforms where that's actually wrong, but let's use our SIGNAL_ARGS macro everywhere anyway. If nothing else, it's good for finding signal handlers easily. No need for back-patch, since this is just cosmetic AFAICS. Discussion: https://postgr.es/m/2684964.1663167995@sss.pgh.pa.us
1 parent ab39352 commit b66fbd8

File tree

9 files changed

+20
-20
lines changed

9 files changed

+20
-20
lines changed

src/backend/storage/ipc/pmsignal.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ NON_EXEC_STATIC volatile PMSignalData *PMSignalState = NULL;
8888
volatile sig_atomic_t postmaster_possibly_dead = false;
8989

9090
static void
91-
postmaster_death_handler(int signo)
91+
postmaster_death_handler(SIGNAL_ARGS)
9292
{
9393
postmaster_possibly_dead = true;
9494
}

src/bin/initdb/initdb.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static void load_plpgsql(FILE *cmdfd);
268268
static void vacuum_db(FILE *cmdfd);
269269
static void make_template0(FILE *cmdfd);
270270
static void make_postgres(FILE *cmdfd);
271-
static void trapsig(int signum);
271+
static void trapsig(SIGNAL_ARGS);
272272
static void check_ok(void);
273273
static char *escape_quotes(const char *src);
274274
static char *escape_quotes_bki(const char *src);
@@ -1848,10 +1848,10 @@ make_postgres(FILE *cmdfd)
18481848
* So this will need some testing on Windows.
18491849
*/
18501850
static void
1851-
trapsig(int signum)
1851+
trapsig(SIGNAL_ARGS)
18521852
{
18531853
/* handle systems that reset the handler, like Windows (grr) */
1854-
pqsignal(signum, trapsig);
1854+
pqsignal(postgres_signal_arg, trapsig);
18551855
caught_signal = true;
18561856
}
18571857

src/bin/pg_basebackup/pg_receivewal.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ StreamLog(void)
679679
#ifndef WIN32
680680

681681
static void
682-
sigexit_handler(int signum)
682+
sigexit_handler(SIGNAL_ARGS)
683683
{
684684
time_to_stop = true;
685685
}

src/bin/pg_basebackup/pg_recvlogical.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ StreamLogicalLog(void)
654654
* possible moment.
655655
*/
656656
static void
657-
sigexit_handler(int signum)
657+
sigexit_handler(SIGNAL_ARGS)
658658
{
659659
time_to_abort = true;
660660
}
@@ -663,7 +663,7 @@ sigexit_handler(int signum)
663663
* Trigger the output file to be reopened.
664664
*/
665665
static void
666-
sighup_handler(int signum)
666+
sighup_handler(SIGNAL_ARGS)
667667
{
668668
output_reopen = true;
669669
}

src/bin/pg_ctl/pg_ctl.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ read_post_opts(void)
850850
* waiting for the server to start up, the server launch is aborted.
851851
*/
852852
static void
853-
trap_sigint_during_startup(int sig)
853+
trap_sigint_during_startup(SIGNAL_ARGS)
854854
{
855855
if (postmasterPID != -1)
856856
{
@@ -863,8 +863,8 @@ trap_sigint_during_startup(int sig)
863863
* Clear the signal handler, and send the signal again, to terminate the
864864
* process as normal.
865865
*/
866-
pqsignal(SIGINT, SIG_DFL);
867-
raise(SIGINT);
866+
pqsignal(postgres_signal_arg, SIG_DFL);
867+
raise(postgres_signal_arg);
868868
}
869869

870870
static char *

src/bin/pg_test_fsync/pg_test_fsync.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ static void test_open_sync(const char *msg, int writes_size);
8181
static void test_file_descriptor_sync(void);
8282

8383
#ifndef WIN32
84-
static void process_alarm(int sig);
84+
static void process_alarm(SIGNAL_ARGS);
8585
#else
8686
static DWORD WINAPI process_alarm(LPVOID param);
8787
#endif
88-
static void signal_cleanup(int sig);
88+
static void signal_cleanup(SIGNAL_ARGS);
8989

9090
#ifdef HAVE_FSYNC_WRITETHROUGH
9191
static int pg_fsync_writethrough(int fd);
@@ -590,14 +590,14 @@ test_non_sync(void)
590590
}
591591

592592
static void
593-
signal_cleanup(int signum)
593+
signal_cleanup(SIGNAL_ARGS)
594594
{
595595
/* Delete the file if it exists. Ignore errors */
596596
if (needs_unlink)
597597
unlink(filename);
598598
/* Finish incomplete line on stdout */
599599
puts("");
600-
exit(signum);
600+
exit(1);
601601
}
602602

603603
#ifdef HAVE_FSYNC_WRITETHROUGH
@@ -632,7 +632,7 @@ print_elapse(struct timeval start_t, struct timeval stop_t, int ops)
632632

633633
#ifndef WIN32
634634
static void
635-
process_alarm(int sig)
635+
process_alarm(SIGNAL_ARGS)
636636
{
637637
alarm_triggered = true;
638638
}

src/bin/pg_waldump/pg_waldump.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ typedef struct XLogDumpConfig
8080
#ifndef WIN32
8181

8282
static void
83-
sigint_handler(int signum)
83+
sigint_handler(SIGNAL_ARGS)
8484
{
8585
time_to_stop = true;
8686
}

src/include/port.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ extern int pg_check_dir(const char *dir);
472472
extern int pg_mkdir_p(char *path, int omode);
473473

474474
/* port/pqsignal.c */
475-
typedef void (*pqsigfunc) (int signo);
475+
typedef void (*pqsigfunc) (SIGNAL_ARGS);
476476
extern pqsigfunc pqsignal(int signo, pqsigfunc func);
477477

478478
/* port/quotes.c */

src/test/regress/pg_regress.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,12 @@ remove_temp(void)
303303
* Signal handler that calls remove_temp() and reraises the signal.
304304
*/
305305
static void
306-
signal_remove_temp(int signum)
306+
signal_remove_temp(SIGNAL_ARGS)
307307
{
308308
remove_temp();
309309

310-
pqsignal(signum, SIG_DFL);
311-
raise(signum);
310+
pqsignal(postgres_signal_arg, SIG_DFL);
311+
raise(postgres_signal_arg);
312312
}
313313

314314
/*

0 commit comments

Comments
 (0)