Xref: utzoo comp.sys.att:5574 unix-pc.general:2265 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ncar!boulder!sunybcs!rutgers!att!icus!lenny From: lenny@icus.islp.ny.us (Lenny Tropiano) Newsgroups: comp.sys.att,unix-pc.general Subject: Re: SIGPHONE on UNIXPC not working Message-ID: <612@icus.islp.ny.us> Date: 18 Feb 89 06:24:27 GMT References: <532@ivucsb.UUCP> Reply-To: lenny@icus.islp.ny.us (Lenny Tropiano) Distribution: usa Organization: ICUS Software Systems, Islip, New York Lines: 40 In article <532@ivucsb.UUCP> todd@ivucsb.UUCP (Todd Day) writes: |>I am having a problem getting a program to catch the SIGPHONE signal. |>Here is a short bit of my program: |> ... I did some testing with this a while back. As it turns out only ONE PROCESS will be sent a SIGPHONE signal on the change of the phone status. It is the last process to open the /dev/ph* devices. For your program to work, it will have to open("/dev/ph0",O_RDWR|O_NDELAY)... Here's your code ... with the appropriate modification ... extern int wakeup(); main() { int fd; signal(SIGPHONE, wakeup); /* catch SIGPHONE (SIG_IGN by default)*/ if ((fd = open("/dev/ph0",O_RDWR|O_NDELAY)) == -1) { perror("open()"); exit(1); } printf("before pause\n"); pause(); /* take a siesta until phone rings */ signal(SIGPHONE, SIG_IGN); /* ignore anymore phone changes */ } /* wakeup is a dummy so we can catch phone changes */ int wakeup() { printf("SIGPHONE\n"); } -- Lenny Tropiano ICUS Software Systems [w] +1 (516) 582-5525 lenny@icus.islp.ny.us Telex; 154232428 ICUS [h] +1 (516) 968-8576 {talcott,decuac,boulder,hombre,pacbell,sbcs}!icus!lenny attmail!icus!lenny ICUS Software Systems -- PO Box 1; Islip Terrace, NY 11752