1
0

getpid 657 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. .TH GETPID 2
  2. .SH NAME
  3. getpid, getppid \- get process ids
  4. .SH SYNOPSIS
  5. .B #include <u.h>
  6. .br
  7. .B #include <libc.h>
  8. .PP
  9. .B
  10. int getpid(void)
  11. .PP
  12. .B
  13. int getppid(void)
  14. .SH DESCRIPTION
  15. .I Getpid
  16. reads
  17. .B /dev/pid
  18. (see
  19. .IR cons (3))
  20. and converts it to get the process id of the current process,
  21. a number guaranteed to be unique among all running processes on the machine
  22. executing
  23. .IR getpid .
  24. .PP
  25. .I Getppid
  26. reads
  27. .B /dev/ppid
  28. (see
  29. .IR cons (3))
  30. and converts it to get the id of the parent of the current process.
  31. .SH SOURCE
  32. .B /sys/src/libc/9sys
  33. .SH SEE ALSO
  34. .IR intro (2),
  35. .IR cons (3),
  36. .IR proc (3)
  37. .SH DIAGNOSTICS
  38. Returns 0 and
  39. sets
  40. .I errstr
  41. if unsuccessful.