[comp.sys.isis] work-around for SUN OS problem, not needed on other systems

ken@cs.cornell.edu (Ken Birman) (06/11/91)

The following seems to be a useable work-around for the SUN OS
problem mentioned above, namely a failure to detect client termination
using the SIGPIPE method.

In protos/pr_client.c, add the following at the end of client_init.c,
right after the listen() system call:

#	if (SUN)
	{
	    void client_check();
	    (void)timeout(10000, client_check, 0);
	}
#	endif

Now, after the procedure called client_lookup add the following new code:

/* Only needed on SUN OS */
void
check_clients()
  {
#ifdef  SUN
        register sd;
        (void)timeout(10000, check_clients, 0);
        for(sd = 0; sd < max_cl; sd++)
            if(cl[sd].cl_pid > 0 &&
                kill(cl[sd].cl_pid, SIGIO) == -1 && errno == ESRCH)
                    client_failed(sd, TRUE);
#endif  SUN
  }

Rebuild protos with this change, and within 10 seconds after a 
program that uses ISIS has terminated, the system should notice.
Obviously, detection will be faster if the SIGPIPE occurs normally.
-- 
Kenneth P. Birman                              E-mail:  ken@cs.cornell.edu
4105 Upson Hall, Dept. of Computer Science     TEL:     607 255-9199 (office)
Cornell University Ithaca, NY 14853 (USA)      FAX:     607 255-4428