getpid 671 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 exec (2),
  36. .IR cons (3),
  37. .IR proc (3)
  38. .SH DIAGNOSTICS
  39. Returns 0 and
  40. sets
  41. .I errstr
  42. if unsuccessful.