service stop <PID> : Catching this in a driver. - Minix

This is a discussion on service stop <PID> : Catching this in a driver. - Minix ; Hello! What flag needs to be caught from a message's m_type when "service stop" is called on your driver or other service? I tried looking at some existing drivers and thought it was SYS_SIG, but that's apparently only for shutdowns. ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: service stop <PID> : Catching this in a driver.

  1. service stop <PID> : Catching this in a driver.

    Hello!

    What flag needs to be caught from a message's m_type when "service
    stop" is called on your driver or other service? I tried looking at
    some existing drivers and thought it was SYS_SIG, but that's apparently
    only for shutdowns. Right now I have some code (see below) that just
    catches non-HARD_INT messages in a "default" part of a case statement.

    Any help would be appreciated so I can maybe streamline the types of
    messages I catch before doing a shutdown of my service.

    P.S.: The code must be built using GCC (g++). I know that may sound
    odd to many of you, but it has something to do with the fact that I'm
    writing a driver framework in C++ that has some additions the existing
    framework doesn't have.

    Thanks in advance.

    ++++++++++++++ BEGIN PASTE +++++++++++++++

    #define _SYSTEM 1
    #define _MINIX 1

    #include
    #include
    #include
    #include
    #include
    #include
    #include
    #include

    #include
    #include
    #include

    using namespace std;

    static int i=0;

    int main()
    {
    int irq=CLOCK_IRQ;
    int id=irq+2;
    int ret = sys_irqsetpolicy(irq, 0, &id);
    if (ret) {
    panic("PANICER", "error setting policy", ret);
    }
    ret = sys_irqenable(&id);
    if (ret) {
    panic("PANICER", "problem enabling interrupts", ret);
    }

    while (1) {
    ofstream fout;
    message m;
    ret = receive(ANY, &m);
    if (ret) {
    panic("PANICER", "error receiving packet", ret);
    }
    switch(m.m_type) {
    case HARD_INT:
    ret = sys_irqenable(&id);
    if (ret) {
    panic("PANICER", "problem enabling interrupts", ret);
    }
    fout.open("/tmp/panicer.out");
    fout << ++i << '\n';
    fout.close();
    break;
    default:
    ret = sys_irqrmpolicy(irq, &id);
    if (ret) {
    panic("PANICER", "problem removing policy", ret);
    }
    }
    }

    return 0;
    }


  2. Re: service stop <PID> : Catching this in a driver.

    *Bumping back onto list.*


+ Reply to Thread