mirror of
				https://github.com/isar/libmdbx.git
				synced 2025-11-01 03:48:57 +08:00 
			
		
		
		
	mdbx-test: output the signal name if killed/coredumped.
Change-Id: I51e70daf89149ecbe72924fc9f105ea072574a23
This commit is contained in:
		
							
								
								
									
										35
									
								
								.github/actions/spelling/expect.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										35
									
								
								.github/actions/spelling/expect.txt
									
									
									
									
										vendored
									
									
								
							| @@ -2,6 +2,7 @@ aarch | |||||||
| abcdef | abcdef | ||||||
| abf | abf | ||||||
| abra | abra | ||||||
|  | ABRT | ||||||
| abstime | abstime | ||||||
| ACI | ACI | ||||||
| acision | acision | ||||||
| @@ -32,6 +33,7 @@ allones | |||||||
| ALLPOSTMESSAGE | ALLPOSTMESSAGE | ||||||
| allthrough | allthrough | ||||||
| alphabase | alphabase | ||||||
|  | ALRM | ||||||
| altlinux | altlinux | ||||||
| AMAX | AMAX | ||||||
| amd | amd | ||||||
| @@ -159,6 +161,7 @@ CHECKOWNER | |||||||
| CHECKPID | CHECKPID | ||||||
| chipitsine | chipitsine | ||||||
| chk | chk | ||||||
|  | CHLD | ||||||
| chrono | chrono | ||||||
| ci | ci | ||||||
| cifs | cifs | ||||||
| @@ -1426,6 +1429,7 @@ searchdata | |||||||
| SEARCHENGINE | SEARCHENGINE | ||||||
| sebastien | sebastien | ||||||
| segfault | segfault | ||||||
|  | SEGV | ||||||
| sema | sema | ||||||
| sembuf | sembuf | ||||||
| semctl | semctl | ||||||
| @@ -1459,23 +1463,45 @@ showinitializer | |||||||
| showned | showned | ||||||
| shrinked | shrinked | ||||||
| sideeffect | sideeffect | ||||||
|  | SIGABRT | ||||||
| sigaction | sigaction | ||||||
| sigaddset | sigaddset | ||||||
| sigalarm | sigalarm | ||||||
| SIGALRM | SIGALRM | ||||||
|  | SIGBUS | ||||||
| SIGCHLD | SIGCHLD | ||||||
|  | SIGCONT | ||||||
| sigemptyset | sigemptyset | ||||||
|  | SIGEMT | ||||||
|  | SIGFPE | ||||||
| SIGHUP | SIGHUP | ||||||
| SIGINT | SIGINT | ||||||
|  | SIGIO | ||||||
| SIGKILL | SIGKILL | ||||||
| sigmask | sigmask | ||||||
| SIGPIPE | SIGPIPE | ||||||
|  | SIGPOLL | ||||||
| sigprocmask | sigprocmask | ||||||
|  | SIGPROF | ||||||
|  | SIGPWR | ||||||
|  | SIGQUIT | ||||||
| SIGSEGV | SIGSEGV | ||||||
| sigset | sigset | ||||||
|  | SIGSTKFLT | ||||||
|  | SIGSTOP | ||||||
|  | SIGSYS | ||||||
| SIGTERM | SIGTERM | ||||||
|  | SIGTRAP | ||||||
|  | SIGTSTP | ||||||
|  | SIGTTIN | ||||||
|  | SIGTTOU | ||||||
|  | SIGURG | ||||||
| sigusr | sigusr | ||||||
|  | SIGVTALRM | ||||||
| sigwait | sigwait | ||||||
|  | SIGWINCH | ||||||
|  | SIGXCPU | ||||||
|  | SIGXFSZ | ||||||
| singlemode | singlemode | ||||||
| singleprocess | singleprocess | ||||||
| sizeof | sizeof | ||||||
| @@ -1542,6 +1568,7 @@ stdio | |||||||
| stdlib | stdlib | ||||||
| stdout | stdout | ||||||
| stepbystep | stepbystep | ||||||
|  | STKFLT | ||||||
| storz | storz | ||||||
| stoull | stoull | ||||||
| strcasecmp | strcasecmp | ||||||
| @@ -1671,8 +1698,11 @@ trywait | |||||||
| tsan | tsan | ||||||
| tsd | tsd | ||||||
| tsize | tsize | ||||||
|  | TSTP | ||||||
| ttf | ttf | ||||||
|  | TTIN | ||||||
| ttl | ttl | ||||||
|  | TTOU | ||||||
| TVvqnwctdis | TVvqnwctdis | ||||||
| tw | tw | ||||||
| twistylittlepassagesallalike | twistylittlepassagesallalike | ||||||
| @@ -1730,6 +1760,7 @@ updation | |||||||
| upsert | upsert | ||||||
| UPSERTING | UPSERTING | ||||||
| upsertion | upsertion | ||||||
|  | URG | ||||||
| url | url | ||||||
| usec | usec | ||||||
| usedbytes | usedbytes | ||||||
| @@ -1782,6 +1813,7 @@ vromanov | |||||||
| Vrq | Vrq | ||||||
| vscprintf | vscprintf | ||||||
| vsnprintf | vsnprintf | ||||||
|  | VTALRM | ||||||
| vvn | vvn | ||||||
| vvnw | vvnw | ||||||
| vvv | vvv | ||||||
| @@ -1844,6 +1876,7 @@ WSL | |||||||
| wsl | wsl | ||||||
| wstr | wstr | ||||||
| wstring | wstring | ||||||
|  | WTERMSIG | ||||||
| WUNTRACED | WUNTRACED | ||||||
| www | www | ||||||
| WX | WX | ||||||
| @@ -1852,10 +1885,12 @@ xappend | |||||||
| xargs | xargs | ||||||
| xcode | xcode | ||||||
| XCONCAT | XCONCAT | ||||||
|  | XCPU | ||||||
| xcursor | xcursor | ||||||
| xdata | xdata | ||||||
| xf | xf | ||||||
| xflags | xflags | ||||||
|  | XFSZ | ||||||
| xhtml | xhtml | ||||||
| xkeep | xkeep | ||||||
| XLB | XLB | ||||||
|   | |||||||
| @@ -393,6 +393,110 @@ void osal_killall_actors(void) { | |||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static const char *signal_name(const int sig) { | ||||||
|  |   if (sig == SIGHUP) | ||||||
|  |     return "HUP"; | ||||||
|  |   if (sig == SIGINT) | ||||||
|  |     return "INT"; | ||||||
|  |   if (sig == SIGQUIT) | ||||||
|  |     return "QUIT"; | ||||||
|  |   if (sig == SIGILL) | ||||||
|  |     return "ILL"; | ||||||
|  |   if (sig == SIGTRAP) | ||||||
|  |     return "TRAP"; | ||||||
|  |   if (sig == SIGABRT) | ||||||
|  |     return "ABRT"; | ||||||
|  |   if (sig == SIGBUS) | ||||||
|  |     return "BUS"; | ||||||
|  |   if (sig == SIGKILL) | ||||||
|  |     return "KILL"; | ||||||
|  |   if (sig == SIGUSR1) | ||||||
|  |     return "USR1"; | ||||||
|  |   if (sig == SIGSEGV) | ||||||
|  |     return "SEGV"; | ||||||
|  |   if (sig == SIGUSR2) | ||||||
|  |     return "USR2"; | ||||||
|  |   if (sig == SIGPIPE) | ||||||
|  |     return "PIPE"; | ||||||
|  |   if (sig == SIGALRM) | ||||||
|  |     return "ALRM"; | ||||||
|  |   if (sig == SIGTERM) | ||||||
|  |     return "TERM"; | ||||||
|  |   if (sig == SIGCHLD) | ||||||
|  |     return "CHLD"; | ||||||
|  |   if (sig == SIGCONT) | ||||||
|  |     return "CONT"; | ||||||
|  |   if (sig == SIGSTOP) | ||||||
|  |     return "STOP"; | ||||||
|  | #ifdef SIGPOLL | ||||||
|  |   if (sig == SIGPOLL) | ||||||
|  |     return "POLL"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGFPE | ||||||
|  |   if (sig == SIGFPE) | ||||||
|  |     return "FPE"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGEMT | ||||||
|  |   if (sig == SIGEMT) | ||||||
|  |     return "EMT"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGSTKFLT | ||||||
|  |   if (sig == SIGSTKFLT) | ||||||
|  |     return "STKFLT"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGTSTP | ||||||
|  |   if (sig == SIGTSTP) | ||||||
|  |     return "TSTP"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGTTIN | ||||||
|  |   if (sig == SIGTTIN) | ||||||
|  |     return "TTIN"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGTTOU | ||||||
|  |   if (sig == SIGTTOU) | ||||||
|  |     return "TTOU"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGURG | ||||||
|  |   if (sig == SIGURG) | ||||||
|  |     return "URG"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGXCPU | ||||||
|  |   if (sig == SIGXCPU) | ||||||
|  |     return "XCPU"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGXFSZ | ||||||
|  |   if (sig == SIGXFSZ) | ||||||
|  |     return "XFSZ"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGVTALRM | ||||||
|  |   if (sig == SIGVTALRM) | ||||||
|  |     return "VTALRM"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGPROF | ||||||
|  |   if (sig == SIGPROF) | ||||||
|  |     return "PROF"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGWINCH | ||||||
|  |   if (sig == SIGWINCH) | ||||||
|  |     return "WINCH"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGIO | ||||||
|  |   if (sig == SIGIO) | ||||||
|  |     return "IO"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGPWR | ||||||
|  |   if (sig == SIGPWR) | ||||||
|  |     return "PWR"; | ||||||
|  | #endif | ||||||
|  | #ifdef SIGSYS | ||||||
|  |   if (sig == SIGSYS) | ||||||
|  |     return "SYS"; | ||||||
|  | #endif | ||||||
|  |   static char buf[32]; | ||||||
|  |   snprintf(buf, sizeof(buf), "%u", sig); | ||||||
|  |   return buf; | ||||||
|  | } | ||||||
|  |  | ||||||
| int osal_actor_poll(mdbx_pid_t &pid, unsigned timeout) { | int osal_actor_poll(mdbx_pid_t &pid, unsigned timeout) { | ||||||
|   static sig_atomic_t sigalarm_tail; |   static sig_atomic_t sigalarm_tail; | ||||||
|   alarm(0) /* cancel prev timeout */; |   alarm(0) /* cancel prev timeout */; | ||||||
| @@ -420,11 +524,28 @@ int osal_actor_poll(mdbx_pid_t &pid, unsigned timeout) { | |||||||
|       if (WIFEXITED(status)) |       if (WIFEXITED(status)) | ||||||
|         children[pid] = |         children[pid] = | ||||||
|             (WEXITSTATUS(status) == EXIT_SUCCESS) ? as_successful : as_failed; |             (WEXITSTATUS(status) == EXIT_SUCCESS) ? as_successful : as_failed; | ||||||
|       else if (WCOREDUMP(status)) |       else if (WIFSIGNALED(status)) { | ||||||
|         children[pid] = as_coredump; | #ifdef WCOREDUMP | ||||||
|       else if (WIFSIGNALED(status)) |         if (WCOREDUMP(status)) | ||||||
|         children[pid] = as_killed; |           children[pid] = as_coredump; | ||||||
|       else if (WIFSTOPPED(status)) |         else | ||||||
|  | #endif /* WCOREDUMP */ | ||||||
|  |           switch (WTERMSIG(status)) { | ||||||
|  |           case SIGABRT: | ||||||
|  |           case SIGBUS: | ||||||
|  |           case SIGFPE: | ||||||
|  |           case SIGILL: | ||||||
|  |           case SIGSEGV: | ||||||
|  |             log_notice("child pid %u terminated by SIG%s", pid, | ||||||
|  |                        signal_name(WTERMSIG(status))); | ||||||
|  |             children[pid] = as_coredump; | ||||||
|  |             break; | ||||||
|  |           default: | ||||||
|  |             log_notice("child pid %u killed by SIG%s", pid, | ||||||
|  |                        signal_name(WTERMSIG(status))); | ||||||
|  |             children[pid] = as_killed; | ||||||
|  |           } | ||||||
|  |       } else if (WIFSTOPPED(status)) | ||||||
|         children[pid] = as_debugging; |         children[pid] = as_debugging; | ||||||
|       else if (WIFCONTINUED(status)) |       else if (WIFCONTINUED(status)) | ||||||
|         children[pid] = as_running; |         children[pid] = as_running; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user