From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,3f9b80985528965,start X-Google-Attributes: gidfee84,public From: john@comet.msd.measurex.com (John Pletikapich) Subject: Signal Handling in OSF/1 v3.0B Date: 1995/05/30 Message-ID: <1995May30.195936.14140@msd.measurex.com>#1/1 X-Deja-AN: 103491030 sender: usenet@msd.measurex.com (USENET News System) organization: Measurex Management Systems reply-to: john@msd.measurex.com newsgroups: comp.unix.osf.osf1 I have some C code which is operational under Ultrix v2.2 and I was hoping I could get it working on OSF/1 V3.0B . The code was fairly basic - read a tty and timeout if no input is given. I replaced the Ultrix signal function with the OSF/1 sigaction syscall, but have not made any headway. The ALARM signal is deferred once , but seemingly ingnored the second time around, i.e. No Timeout! I have checked all statuses (stati) that I could think of but I can't see what's going wraong. I have included a snippet of the code below and would appreciate any intelligent advice anyone can offer. One thousand thanks! #include #include #include #include #include #include jmp_buf jump_alrm; read_robo() { char c; int red; int len; int j; int jjpstat; struct sigaction newaction, saveaction, jjpaction; void _catch(); unsigned int save_time; for (;;) { if (setjmp(jump_alrm)) { jjpstat = sigaction(SIGALRM, &saveaction, 0); if (save_time) alarm((unsigned int)(j = save_time - 10) < 0 ? 1 : j); return(3); } newaction.sa_handler = _catch; newaction.sa_mask = 0; newaction.sa_flags = 0; jjpstat = sigaction(SIGALRM, &newaction, &saveaction); save_time = alarm((unsigned int)15); red = read(rt, &c, 1); jjpstat = sigaction(SIGALRM, &saveaction, 0); if (save_time) alarm((unsigned int)(j = save_time - 10) < 0 ? 1 : j); else alarm((unsigned int)0); if (red < 1) { return(2); /* code deleted for brevity */ } process_it(); /* code deleted for brevity */ } } void _catch() { longjmp(jump_alrm, 1); } -- john.msd.measurex.com John J. Pletikapich