|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1983 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: */ ! 6: ! 7: #if defined(LIBC_SCCS) && !defined(lint) ! 8: static char sccsid[] = "@(#)alarm.c 5.2 (Berkeley) 3/9/86"; ! 9: #endif LIBC_SCCS and not lint ! 10: ! 11: /* ! 12: * Backwards compatible alarm. ! 13: */ ! 14: #include <sys/time.h> ! 15: ! 16: alarm(secs) ! 17: int secs; ! 18: { ! 19: struct itimerval it, oitv; ! 20: register struct itimerval *itp = ⁢ ! 21: ! 22: timerclear(&itp->it_interval); ! 23: itp->it_value.tv_sec = secs; ! 24: itp->it_value.tv_usec = 0; ! 25: if (setitimer(ITIMER_REAL, itp, &oitv) < 0) ! 26: return (-1); ! 27: if (oitv.it_value.tv_usec) ! 28: oitv.it_value.tv_sec++; ! 29: return (oitv.it_value.tv_sec); ! 30: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.