aboutsummaryrefslogtreecommitdiff
path: root/src/lib/os
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
commitce5bcbe37ff766b9fc6102a8e71925461af746ee (patch)
tree7ff4e3d7825a5e97995075105a34c6adc85a9fa2 /src/lib/os
parent5a12b1828d0e07079a6e4a8d1b1f44502e014639 (diff)
downloadgo-ce5bcbe37ff766b9fc6102a8e71925461af746ee.tar.xz
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/lib/os')
-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 1fbd7e7aae..9f0f01e0a8 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)
+}