os: implement process related functions

This commit implements various process related functions like
os.Getuid() and os.Getpid(). It also implements or improves this support
in the syscall package if it isn't available yet.
This commit is contained in:
Ayke van Laethem
2021-06-25 15:06:17 +02:00
committed by Ron Evans
parent e65592599c
commit 75298bb84b
8 changed files with 99 additions and 15 deletions
+9
View File
@@ -5,6 +5,7 @@ import (
"math/rand"
"os"
"strings"
"syscall"
)
func main() {
@@ -13,6 +14,14 @@ func main() {
fmt.Println("stdout:", os.Stdout.Name())
fmt.Println("stderr:", os.Stderr.Name())
// Package syscall, this mostly checks whether the calls don't trigger an error.
syscall.Getuid()
syscall.Geteuid()
syscall.Getgid()
syscall.Getegid()
syscall.Getpid()
syscall.Getppid()
// package math/rand
fmt.Println("pseudorandom number:", rand.Int31())