Skip to content
Miro Kropacek edited this page Jan 19, 2017 · 3 revisions

Pgetppid()

'''WORD Pgetppid( VOID ) '''

Pgetppid() returns the PID of parent of the calling process.
Opcode 268 (0x010c)
Availability If the MiNT cookie is present.
Parameters none.
Binding ``` asm
move.w #$010c,-(sp)
trap #1
addq.l #6,sp
| **Return Value** | The **WORD** returned contains the Process IDentifier (pid) of the calling processes' parent.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| **Comments**     | In the FreeMiNT kernel, processes are represented as a tree. The root of the tree is the kernel itself (PID 0). At boot time, the kernel launches another process (which can be 'init' in case of a Unix-like setup, or an AES, a shell or whatever) specified by the **INIT** or **GEM** keyword in the mint.cnf file. This process will launch other processes (daemons, accessories, programs etc) that are its so-called children. Therefore, every process (but the kernel, obviously) is created by its so-called parent. The **Pgetppid()** (get parent's PID) call allows to determine the PID of the parent of the calling process. To have a good illustration of this, you can use the 'ps' command in your shell. You will see that all accessories's parent is the AES, and that the daemons are started by the 'init' program. |
| **See Also**     | **[[Pgetpid|Pgetpid]]()**\]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |


Clone this wiki locally