github.com/spotify/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/src/pkg/os/proc.go (about)

     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  
     7  package os
     8  
     9  import "syscall"
    10  
    11  // Args hold the command-line arguments, starting with the program name.
    12  var Args []string
    13  
    14  // Getuid returns the numeric user id of the caller.
    15  func Getuid() int { return syscall.Getuid() }
    16  
    17  // Geteuid returns the numeric effective user id of the caller.
    18  func Geteuid() int { return syscall.Geteuid() }
    19  
    20  // Getgid returns the numeric group id of the caller.
    21  func Getgid() int { return syscall.Getgid() }
    22  
    23  // Getegid returns the numeric effective group id of the caller.
    24  func Getegid() int { return syscall.Getegid() }
    25  
    26  // Getgroups returns a list of the numeric ids of groups that the caller belongs to.
    27  func 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.
    36  func Exit(code int) { syscall.Exit(code) }