From: Michael Paquier Date: Thu, 29 Sep 2022 05:28:13 +0000 (+0900) Subject: Mark sigint_interrupt_enabled as sig_atomic_t X-Git-Tag: REL_16_BETA1~1574 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=5ac9e869191148741539e626b84ba7e77dc71670;p=postgresql.git Mark sigint_interrupt_enabled as sig_atomic_t This is a continuation of 78fdb1e, where this flag is set in the psql callback handler used for SIGINT. This was previously a boolean but the C standard recommends the use of sig_atomic_t. Note that this influences PromptInterruptContext in string.h, where the same flag is tracked. Author: Hayato Kuroda Discussion: https://postgr.es/m/TYAPR01MB58669A9EC96AA3078C2CD938F5549@TYAPR01MB5866.jpnprd01.prod.outlook.com --- diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index e611e3266d0..4f426760662 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -246,7 +246,7 @@ NoticeProcessor(void *arg, const char *message) * On Windows, currently this does not work, so control-C is less useful * there. */ -volatile bool sigint_interrupt_enabled = false; +volatile sig_atomic_t sigint_interrupt_enabled = false; sigjmp_buf sigint_interrupt_jmp; diff --git a/src/bin/psql/common.h b/src/bin/psql/common.h index d84c3a007cf..f0820dd7d59 100644 --- a/src/bin/psql/common.h +++ b/src/bin/psql/common.h @@ -9,6 +9,7 @@ #define COMMON_H #include +#include #include "fe_utils/print.h" #include "fe_utils/psqlscan.h" @@ -22,7 +23,7 @@ extern char *psql_get_variable(const char *varname, PsqlScanQuoteType quote, extern void NoticeProcessor(void *arg, const char *message); -extern volatile bool sigint_interrupt_enabled; +extern volatile sig_atomic_t sigint_interrupt_enabled; extern sigjmp_buf sigint_interrupt_jmp; diff --git a/src/include/common/string.h b/src/include/common/string.h index 3d59172151b..32a923cf231 100644 --- a/src/include/common/string.h +++ b/src/include/common/string.h @@ -10,13 +10,15 @@ #ifndef COMMON_STRING_H #define COMMON_STRING_H +#include + struct StringInfoData; /* avoid including stringinfo.h here */ typedef struct PromptInterruptContext { /* To avoid including here, jmpbuf is declared "void *" */ void *jmpbuf; /* existing longjmp buffer */ - volatile bool *enabled; /* flag that enables longjmp-on-interrupt */ + volatile sig_atomic_t *enabled; /* flag that enables longjmp-on-interrupt */ bool canceled; /* indicates whether cancellation occurred */ } PromptInterruptContext;