### Pgetpid()

WORD Pgetpid( VOID )

| Pgetpid() returns the PID of the calling process.

Opcode | 267 (0x010b)
Availability | If the MiNT cookie is present.
Parameters | none.
Binding |
    move.w  #$010b,-(sp)
    trap    #1
    addq.l  #6,sp
Return Value | The WORD returned contains the Process IDentifier (pid) of the calling process. This PID is unique and uniquely identifies the process among other processes within the system.
Comments | A PID is dynamically assigned to a process when it is created. You should make no assumption on the PID a process may have. For the kernel, the PID is a WORD but when you program in C, you should use the pid_t type, which complies with the POSIX standard. The FreeMiNT kernel's PID is always 0. The PID is useful when it is important to identify a process among others in the system. Knowing the PID of a program, it is possible to do a lot of things: send it a signal with Psignal(), look for its name in /proc by searching with a "*.xxx" mask (xxx is the PID of the program which name we wanna know), etc.
See Also | Pgetppid()