Autzoo.516 hacknews utzoo!henry Sun Apr 26 23:11:12 1981 CR driver, maybe /crunix is a Unix with the card reader driver installed. To avoid re-introducing an ugly kludge into the clock-interrupt handler, a general mechanism for having things done by the clock-interrupt routine at intervals was added; this will (later) be used to separate the device-dependent parts of clock.c (etc.) into a genuine clock driver which just calls things periodically. The mechanism is a table in c.c, clkjobs[], whose entries have two components: the address of a function (called j_routine by carelessness) and the address of a timer variable (an int). If the timer variable is zero, nothing is done. If it is nonzero, it is decremented; if it is then <= 0, it is set to zero and the routine is called. If a routine is to be called at intervals, its timer variable (which should be defined in the module that defines the routine) should be initialized to the interval and reset to the same value at the end of the routine. If (as for the card reader) it is sometimes desirable to call a routine at the next clock interrupt, its timer should be initialized to zero and set to one when such a situation occurs (and NOT reset to 1 at the end of the routine). The only defect of this arrangement is that the routines get called at very high priority, so routines which don't want to run if they may have interrupted (say) a priority-5 driver must check the priority themselves. This stuff has NOT BEEN TESTED, so the card-reader driver should be tried out single-user before attempting to run this as the production Unix.