summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Symonds <dsymonds@golang.org>2009-05-25 14:38:38 -0700
committerDavid Symonds <dsymonds@golang.org>2009-05-25 14:38:38 -0700
commit6c9871151f11a5310b6959d8fdc72b5fb21dc77e (patch)
tree7ff4e3d7825a5e97995075105a34c6adc85a9fa2 /src
parentef76cad303685617c3518d61d894b5f53a1a6c31 (diff)
downloadgolang-6c9871151f11a5310b6959d8fdc72b5fb21dc77e.tar.gz
Add os.Getpid and os.Getppid.
R=rsc APPROVED=rsc DELTA=11 (11 added, 0 deleted, 0 changed) OCL=29352 CL=29357
Diffstat (limited to 'src')
-rw-r--r--src/lib/os/exec.go11
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)
+}