SIGPHONE on UNIXPC not working

Lenny Tropiano lenny at icus.islp.ny.us
Sat Feb 18 16:24:27 AEST 1989


In article <532 at ivucsb.UUCP> todd at 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 at 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



More information about the Unix-pc.general mailing list