MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sys_getppid

Function sys_getppid

components/lwp/lwp_syscall.c:1527–1541  ·  view source on GitHub ↗

* @brief Retrieves the parent process ID of the calling process. * * This system call returns the process ID (PID) of the parent process of the calling process. * The parent process is the process that created the calling process, typically through a * system call like `fork()`. This information can be useful for process management and * for determining the hierarchy of processes. * * @retu

Source from the content-addressed store, hash-verified

1525 * @see getpid(), getuid(), getgid()
1526 */
1527sysret_t sys_getppid(void)
1528{
1529 rt_lwp_t process;
1530
1531 process = lwp_self();
1532 if (process->parent == RT_NULL)
1533 {
1534 LOG_E("%s: process %d has no parent process", __func__, lwp_to_pid(process));
1535 return 0;
1536 }
1537 else
1538 {
1539 return lwp_to_pid(process->parent);
1540 }
1541}
1542
1543/**
1544 * @brief Retrieves the priority of a process or process group.

Callers

nothing calls this directly

Calls 2

lwp_selfFunction · 0.85
lwp_to_pidFunction · 0.85

Tested by

no test coverage detected