0

I know that the PCB is a data structure which includes parent process id(pPID), process id(PID), pointers, and etc. Is there anyway to find the PID of parent process without using getppid function?

John Zwinck
  • 239,568
  • 38
  • 324
  • 436
Jason.P
  • 1
  • 1

1 Answers1

0

The fields of /proc/self/stat (as documented in proc(5)) include PPID. Take care in parsing as comm may contain spaces and other unusual characters.

(But I second @JohnZwinck's comment. Why?)

ephemient
  • 198,619
  • 38
  • 280
  • 391
  • To find a way to imply 'getppid'-like system call in a new shell which the getppid function is not implemented yet. – Jason.P Oct 11 '20 at 11:42