I implement syscall, which is called in user space, say foo. Syscall calls foo task_struct (through the current current pointer), prints its name and pid, then goes to the parent process foo, the parent parent foo, etc. Prints all its names and pids up to the init process. >
pid = 1 is reserved for init, pid = 0 is reserved for swapper.
According to swapper task_struct the parent process itself.
Swapper (or sched) always has pid = 0 and is always the parent init process?
Are all pids non-negative? Is it normal for me to make this assumption?
source share