1// Copyright 2009 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Process etc.
6
7package os
8
9import "syscall"
10
11// Args hold the command-line arguments, starting with the program name.
12var Args []string
13
14// Getuid returns the numeric user id of the caller.
15func Getuid() int { return syscall.Getuid() }
16
17// Geteuid returns the numeric effective user id of the caller.
18func Geteuid() int { return syscall.Geteuid() }
19
20// Getgid returns the numeric group id of the caller.
21func Getgid() int { return syscall.Getgid() }
22
23// Getegid returns the numeric effective group id of the caller.
24func Getegid() int { return syscall.Getegid() }
25
26// Getgroups returns a list of the numeric ids of groups that the caller belongs to.
27func Getgroups() ([]int, error) {
28	gids, e := syscall.Getgroups()
29	return gids, NewSyscallError("getgroups", e)
30}
31
32// Exit causes the current program to exit with the given status code.
33// Conventionally, code zero indicates success, non-zero an error.
34// The program terminates immediately; deferred functions are
35// not run.
36func Exit(code int) { syscall.Exit(code) }
37