Hi, There is a bug in the processing of signal handlers. To demonstrate this problem is necessary to have a functional ps command. The attached patch fixes this command. Greetings, Juan PREVIOUS OPERATION AND BUGS 1. It will be shown that installed signal handlers are not called if the signal is processed at the end of an interrupt. 2. To demonstrate this problem, it's necessary to have a functional ps command. The previous implementation did not produce any output under certain conditions. 3. The ps command ran through the task array, printing task information on used slots. However, this process was interrupted if it finds inconsistent information on a slot, even if that slot is unused. NEW OPERATION 1. The new ps only checks information of slots in use. 2. A header is printed with the meaning of each column. BUG IN SIGNAL HANDLER INSTALLATION 1. Edit and compile the following test program (I named it sigtst): #include <signal.h> #include <stdio.h> void hndlr(int sig) { printf("\nSignal received\n"); } int main(int argc, char ** argv) { int i; i = signal(SIGPIPE, hndlr); printf("Signal result = %d\n", i); for(;;); exit(0); } The infinite loop is to ensure that the signal handler will be installed at the end of interrupt processing, thus providing a repeatable bug test. 2. On the ELKS shell, run: ; ./sigtst & The signal handler should be installed succesfully and the test program will be running the infinite loop. Check the pid of the sigtst task with the ps command. 3. Now run this commands: ; kill -13 <pid of sigtst task> ; ps The message "Signal received" will NOT appear on the screen, demonstrating the bug. The kernel "believes" that the handler was invoked and according with V7 semantics, the handler is removed and the default action restored. Check that sigtst is still alive using the ps command. 4. Send again the kill -13 <> command. This time the default action is invoked and the sigtst task will be terminated. Confirm this with the ps command.
Attachment:
elksH.patch
Description: Binary data