diff options
author | Daniel Black <daniel@linux.ibm.com> | 2019-09-27 08:48:27 +1000 |
---|---|---|
committer | Daniel Black <daniel@mariadb.org> | 2020-10-15 18:44:02 +1100 |
commit | d84d146d9d09c97a6a068f76a669dbd2f405fe98 (patch) | |
tree | 2312b4b6e17dd3e96c458b3e6da2faa33adccceb | |
parent | a6f956488c712bef3b13660584d1b905e0c676cc (diff) | |
download | mariadb-git-bb-10.4-danielblack-MDEV-19508-unix-sighup-origin.tar.gz |
MDEV-19508: signal handler SI_KERNEL not defined on Solaris/AIXbb-10.4-danielblack-MDEV-19508-unix-sighup-origin
Solaris and AIX doesn't have a SI_KERNEL code for its siginfo code
structure. But they define sigwaitinfo. For these we can use
SI_USER and values <= aren't kernel.
SI_USER is defined on AIX (since AIX 6.1 at least) as:
/usr/include/sys/signal.h
#define SI_USER 0 /* signal sent by another process with kill */
So its effectively not kernel.
Linux also uses SI_USER as its highest user code.
FreeBSD-12.1 available defines are:
#if __POSIX_VISIBLE || __XSI_VISIBLE
#define SI_NOINFO 0 /* No signal info besides si_signo. */
#define SI_USER 0x10001 /* Signal sent by kill(). */
#define SI_QUEUE 0x10002 /* Signal sent by the sigqueue(). */
#define SI_TIMER 0x10003 /* Signal generated by expiration of */
/* a timer set by timer_settime(). */
#define SI_ASYNCIO 0x10004 /* Signal generated by completion of */
/* an asynchronous I/O request.*/
#define SI_MESGQ 0x10005 /* Signal generated by arrival of a */
/* message on an empty message queue. */
#define SI_KERNEL 0x10006
#define SI_LWP 0x10007 /* Signal sent by thr_kill */
#endif
Original commit 07e9b1389857 showed an explicit desire to catch user
signals aka kill(SI_USER). So for FreeBSD != SI_KERNEL is too broad and
should be <= SI_USER too.
ref: https://docs.oracle.com/cd/E36784_01/html/E36873/siginfo.h-3head.html
ref: https://github.com/omniosorg/illumos-omnios/blob/master/usr/src/uts/common/sys/siginfo.h#L130
-rw-r--r-- | include/my_pthread.h | 4 | ||||
-rw-r--r-- | sql/mysqld.cc | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h index 81dd63ee331..878d88414df 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -197,7 +197,9 @@ static inline int my_sigwait(sigset_t *set, int *sig, int *code) *code= siginfo.si_code; return *sig < 0 ? errno : 0; #else -#define SI_KERNEL 128 +#ifndef SI_USER +#define SI_USER 0 +#endif *code= 0; return sigwait(set, sig); #endif diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 26012f317f9..f96eaa4176f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3288,7 +3288,7 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused))) } break; case SIGHUP: - if (!abort_loop && origin != SI_KERNEL) + if (!abort_loop && origin <= SI_USER) { int not_used; mysql_print_status(); // Print some debug info |