We have to write do_mygetpid function and make sure it is compiled into the pm process's executable file when Minix is recompiled.
The source files for the pm are in
/usr/src/servers/pm
One of the files already used to build the pm process is
/usr/src/servers/pm/misc.c
That is, the makefiles that control rebuilding Minix already build misc.o and link it into the pm executable file.
So misc.c is a "convenient" place to put a new implementation of do_xxxx so that it gets linked into the pm.
There are other choices, but they are mostly concerned with keeping related system call implementations in suitably chosen files.