From: sinster@dana.ucsc.edu (Darren Senn) Subject: Re: fun with gcc2.11c :-( Date: 9 Jun 1992 23:44:10 GMT
In article <bjl.707911252@freyr>, bjl@pttrnl.nl (Ben Lippolt) writes:
> The field "alarm" in "task_struct" has been replaced with a whole bunch
> of other fields. I don't know what the meaning of all these fields are, so
> I have no idea about the consequences, but I patched ps.c in the following
> way (see below).
I'm the one who wrote the itimer code, so let me explain. Under BSD,
each process has three "interval timers" defined:
ITIMER_REAL: runs in real time.
ITIMER_VIRTUAL: runs when the process is running.
ITIMER_PROF: runs when the process is running, or when the system
is running on behalf of the process.
These timers each have two values: a current value, and an increment. When
the current value reaches zero, a signal is sent to the process, and the
current value is reloaded with the interval.
ITIMER_REAL provides a more general function than the old alarm() setup,
so I rewrote the alarm() code to use ITIMER_REAL. This is why the alarm
field went away. The six fields that replace it are:
it_real_value: Current value for ITIMER_REAL
it_real_incr: Increment for ITIMER_REAL
it_virt_value: Current value for ITIMER_VIRTUAL
it_virt_incr: Increment for ITIMER_VIRTUAL
it_prof_value: Current value for ITIMER_PROF
it_prof_incr: Increment for ITIMER_PROF
The patch that you posted, which replaces the reference in ps.c to
the current alarm value with a reference to the current ITIMER_REAL
value is perfect.
Some of you may be asking yourselves, "But interval timers aren't POSIX
or ANSI, and alarm() is: why have interval timers?" The answer is that:
a) itimers are more general than alarm(), and neither POSIX nor
ANSI specifies implementation: only interface and function.
Since I was easily able to implement alarm() using the interval
timers (and that's how it's done on BSD systems anyway), we
haven't lost anything,
b) many of the more interesting programs out there require itimers.
Two examples I can name off the top of my head are xneko and
xtank.
-- Darren Senn Phone: (408) 479-1521 sinster@scintilla.capitola.ca.us Snail: 1785 Halterman #1 Wasurenaide -- doko e itte mo soko ni anata wa iru yo. Santa Cruz, Ca 95062