idle ttys
rusty c. wright
rusty at sdcarl.UUCP
Thu Aug 1 00:03:23 AEST 1985
here's my candidate for making the tty appear to be in use. it
doesn't use any special or magic system calls; it just depends upon
the ability to keep re-initiating a read on the tty.
# include <setjmp.h>
# include <signal.h>
jmp_buf jbuf;
main() {
extern int sigalrm();
char ch;
setjmp(jbuf);
for (;;) {
signal(SIGALRM, sigalrm);
alarm(60);
read(0, &ch, sizeof(ch));
}
}
sigalrm() {
signal(SIGALRM, sigalrm);
longjmp(jbuf, 1);
}
--
rusty c. wright
{ucbvax,ihnp4,akgua,hplabs,sdcsvax}!sdcarl!rusty
More information about the Comp.sources.unix
mailing list