diff options
-rw-r--r-- | src/lib/os/exec.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/os/exec.go b/src/lib/os/exec.go index 1fbd7e7aa..9f0f01e0a 100644 --- a/src/lib/os/exec.go +++ b/src/lib/os/exec.go @@ -88,3 +88,14 @@ func Wait(pid int, options uint64) (w *Waitmsg, err Error) { return w, nil; } +// Getpid returns the process id of the caller. +func Getpid() int { + p, r2, e := syscall.Syscall(syscall.SYS_GETPID, 0, 0, 0); + return int(p) +} + +// Getppid returns the process id of the caller's parent. +func Getppid() int { + p, r2, e := syscall.Syscall(syscall.SYS_GETPPID, 0, 0, 0); + return int(p) +} |