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
volatile sig_atomic_t postmaster_possibly_dead = false;
static void
-postmaster_death_handler(int signo)
+postmaster_death_handler(SIGNAL_ARGS)
{
postmaster_possibly_dead = true;
}
static void vacuum_db(FILE *cmdfd);
static void make_template0(FILE *cmdfd);
static void make_postgres(FILE *cmdfd);
-static void trapsig(int signum);
+static void trapsig(SIGNAL_ARGS);
static void check_ok(void);
static char *escape_quotes(const char *src);
static char *escape_quotes_bki(const char *src);
* So this will need some testing on Windows.
*/
static void
-trapsig(int signum)
+trapsig(SIGNAL_ARGS)
{
/* handle systems that reset the handler, like Windows (grr) */
- pqsignal(signum, trapsig);
+ pqsignal(postgres_signal_arg, trapsig);
caught_signal = true;
}
#ifndef WIN32
static void
-sigexit_handler(int signum)
+sigexit_handler(SIGNAL_ARGS)
{
time_to_stop = true;
}
* possible moment.
*/
static void
-sigexit_handler(int signum)
+sigexit_handler(SIGNAL_ARGS)
{
time_to_abort = true;
}
* Trigger the output file to be reopened.
*/
static void
-sighup_handler(int signum)
+sighup_handler(SIGNAL_ARGS)
{
output_reopen = true;
}
* waiting for the server to start up, the server launch is aborted.
*/
static void
-trap_sigint_during_startup(int sig)
+trap_sigint_during_startup(SIGNAL_ARGS)
{
if (postmasterPID != -1)
{
* Clear the signal handler, and send the signal again, to terminate the
* process as normal.
*/
- pqsignal(SIGINT, SIG_DFL);
- raise(SIGINT);
+ pqsignal(postgres_signal_arg, SIG_DFL);
+ raise(postgres_signal_arg);
}
static char *
static void test_file_descriptor_sync(void);
#ifndef WIN32
-static void process_alarm(int sig);
+static void process_alarm(SIGNAL_ARGS);
#else
static DWORD WINAPI process_alarm(LPVOID param);
#endif
-static void signal_cleanup(int sig);
+static void signal_cleanup(SIGNAL_ARGS);
#ifdef HAVE_FSYNC_WRITETHROUGH
static int pg_fsync_writethrough(int fd);
}
static void
-signal_cleanup(int signum)
+signal_cleanup(SIGNAL_ARGS)
{
/* Delete the file if it exists. Ignore errors */
if (needs_unlink)
unlink(filename);
/* Finish incomplete line on stdout */
puts("");
- exit(signum);
+ exit(1);
}
#ifdef HAVE_FSYNC_WRITETHROUGH
#ifndef WIN32
static void
-process_alarm(int sig)
+process_alarm(SIGNAL_ARGS)
{
alarm_triggered = true;
}
#ifndef WIN32
static void
-sigint_handler(int signum)
+sigint_handler(SIGNAL_ARGS)
{
time_to_stop = true;
}
extern int pg_mkdir_p(char *path, int omode);
/* port/pqsignal.c */
-typedef void (*pqsigfunc) (int signo);
+typedef void (*pqsigfunc) (SIGNAL_ARGS);
extern pqsigfunc pqsignal(int signo, pqsigfunc func);
/* port/quotes.c */
* Signal handler that calls remove_temp() and reraises the signal.
*/
static void
-signal_remove_temp(int signum)
+signal_remove_temp(SIGNAL_ARGS)
{
remove_temp();
- pqsignal(signum, SIG_DFL);
- raise(signum);
+ pqsignal(postgres_signal_arg, SIG_DFL);
+ raise(postgres_signal_arg);
}
/*