Subject: Re: itimer, pthreads, and checkpointing
To: Simon J. Gerraty <explorer@flame.org>
From: Dr. Lex Wennmacher <wennmach@geo.Uni-Koeln.DE>
List: tech-kern
Date: 11/16/1999 14:52:45
On Nov 16, 11:38pm, Simon J. Gerraty wrote:
> Subject: Re: itimer, pthreads, and checkpointing
> >Adding a general purpose timer allocation method (allocitimer, then
> >sigaction and setitimer):
>
> Is this the option that involved modifying struct sigaction?
> While it probably wouldn't break my libsig or any other code,
> I'd still be happier if we could leave that one alone.

No, that's my proposal. Michael's #2 implies the need for (at least) one new
syscall. I proposed (somewhere else) a way to get the functionality of his #2
by using the sigaction syscall, obviating the need for a new syscall.

In short:
#include <signal.h>
struct sigitimer {
        int sig;
        int itimer;
};
struct sigaction {
        void             (*sa_handler)(int);
        sigset_t         sa_mask;
        int              sa_flags;
        struct sigitimer *sa_st;
};

If the flag SA_ALLOCITIMER is set in sa_flags, sigaction allocates
a currently unused timer/signal pair. If sig == SIGALRM, a real timer is
allocated, if sig == SIGVTALRM, a virtual timer. sigaction installs a
signal handler for this signal, and returns the signal/timer pair in *sa_st.
sa_st.itimer can subsequently be used in calls to setitimer as first
argument.

The feedback on this proposal was negative. Criticism was:
1) needs name space protection (yes)
2) enlarges struct sigaction (yes, but only by one pointer)
3) counter-intuitive to use sigaction for timer/signal allocation

I don't insist on my sigaction proposal, I just proposed it because I thought
it would be a viable way around a new syscall.

So, my vote is for Michael's `#2'.

Lex