The handler for the system call in the process manager will need to copy some of its data (in the mproc table). So the source process is the process manager. So you either need to determine the endpoint value of the process manager or you can use the macro SELF. This is defined as:
/* These may not be any valid endpoint (see <minix/endpoint.h>). */ #define ANY 0x7ace /* used to indicate 'any process' */ #define NONE 0x6ace /* used to indicate 'no process at all' */ #define SELF 0x8ace /* used to indicate 'own process' */ #define _MAX_MAGIC_PROC (SELF) /* used by <minix/endpoint.h> to determine generation size */
Notice that SELF is not a valid endpoint! So how can it be used where one is expected? E.g., by sys_vircopy?
The code in sys_vircopy checks for the SELF value in the source or destination. If so, sys_vircopy, uses the message source for the endpoint value. In particular SELF is not used to translate to a process number.
This isn't a big deal for our problem. It isn't hard to find out the endpoint value of say the process manager (its 0).