mproc[] slot number of a process - Minix

This is a discussion on mproc[] slot number of a process - Minix ; Hello everybody. I'm a newbie in MINIX programming and I'd like to ask you if there is a quick way to get the mproc[] slot for the current process, for example: /* this is part of the "setreply" function, usr/src/servers/pm/main.c ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: mproc[] slot number of a process

  1. mproc[] slot number of a process

    Hello everybody.

    I'm a newbie in MINIX programming and I'd like to ask you if there is a
    quick way to get the mproc[] slot for the current process, for example:

    /* this is part of the "setreply" function, usr/src/servers/pm/main.c
    */
    register struct mproc *rmp = &mproc[proc_nr];

    In this case I'd need to know the "proc_nr" param, which is needed to
    invoke the setreply function correctly on my process.

    I've tried to use the "who_p" global variable but it seems not to be
    the right "process number" to be used to identify it in the mporc[]
    array.

    Thanks a lot! :-)

    Max


  2. Re: mproc[] slot number of a process

    All,

    > In this case I'd need to know the "proc_nr" param, which is needed to
    > invoke the setreply function correctly on my process.
    >
    > I've tried to use the "who_p" global variable but it seems not to be
    > the right "process number" to be used to identify it in the mporc[]
    > array.


    Why not?

    > Thanks a lot! :-)


    who_p is the right variable. Take a look at how it's set in
    main.c:get_work(). One exception is when who_p is negative -
    then PM has received a message from a kernel task.

    Of course, you have to use who_p at the right time, i.e. after it's
    been set properly..

    =Ben



  3. Re: mproc[] slot number of a process

    Ben Gras ha scritto:

    > who_p is the right variable. Take a look at how it's set in
    > main.c:get_work(). One exception is when who_p is negative -
    > then PM has received a message from a kernel task.
    >
    > Of course, you have to use who_p at the right time, i.e. after it's
    > been set properly..
    >
    > =Ben


    Thank you, problem solved! ;-)


+ Reply to Thread