What is the purpose of proc::p_endpoint - Minix

This is a discussion on What is the purpose of proc::p_endpoint - Minix ; Hello, I am confused about the `p_endpoint' element of the `proc' structure (defined in kernel/proc.h). What is its purpose? Is it meant to avoid choosing certain magic (ANY, ANY, SELF) process numbers? That might be indeed a problem. But I ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: What is the purpose of proc::p_endpoint

  1. What is the purpose of proc::p_endpoint

    Hello,

    I am confused about the `p_endpoint' element of the `proc' structure
    (defined in kernel/proc.h).

    What is its purpose? Is it meant to avoid choosing certain magic (ANY,
    ANY, SELF) process numbers? That might be indeed a problem. But I cannot
    figure out how "endpoints" could be helpful in that case.

    Cheers
    --
    Matej Kosik

  2. Re: What is the purpose of proc::p_endpoint

    All,

    > I am confused about the `p_endpoint' element of the `proc' structure
    > (defined in kernel/proc.h).
    >
    > What is its purpose? Is it meant to avoid choosing certain magic (ANY,
    > ANY, SELF) process numbers? That might be indeed a problem. But I cannot
    > figure out how "endpoints" could be helpful in that case.


    It is a number that identifies that process for ipc (for send(),
    receive(), sendrec() and notify()) and kernel calls (sys_fork(), signal
    functions, and many others) - previously slot numbers.

    When such an ipc number is given to refer to a process, a simple
    function obtains the slot number from that number. If the slot number
    is in range and the slot contains a living process, the given number is
    checked against the number in that slot. If it checks out, the endpoint
    number is valid. Otherwise, it's not.

    Every time a new process occupies a process slot number, the endpoint
    generation number is incremented, giving rise to a new endpoint
    number. So the endpoint number of the process previously occupying
    that slot won't work any more.

    That is its purpose. Slot numbers are always valid, even if the process
    that was the intended reference is dead. In the old days this wasn't
    a problem, as relevant processes (system servers and drivers) didn't
    really disappear or appear dynamically.

    =Ben



+ Reply to Thread