github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/os/proc.go (about)

     1  // Package os implements a subset of the Go "os" package. See
     2  // https://godoc.org/os for details.
     3  //
     4  // Note that the current implementation is blocking. This limitation should be
     5  // removed in a future version.
     6  package os
     7  
     8  import (
     9  	"syscall"
    10  )
    11  
    12  // Args hold the command-line arguments, starting with the program name.
    13  var Args []string
    14  
    15  func init() {
    16  	Args = runtime_args()
    17  }
    18  
    19  func runtime_args() []string // in package runtime
    20  
    21  // Exit causes the current program to exit with the given status code.
    22  // Conventionally, code zero indicates success, non-zero an error.
    23  // The program terminates immediately; deferred functions are not run.
    24  func Exit(code int) {
    25  	syscall.Exit(code)
    26  }
    27  
    28  // Getuid returns the numeric user id of the caller.
    29  //
    30  // On non-POSIX systems, it returns -1.
    31  func Getuid() int {
    32  	return syscall.Getuid()
    33  }
    34  
    35  // Geteuid returns the numeric effective user id of the caller.
    36  //
    37  // On non-POSIX systems, it returns -1.
    38  func Geteuid() int {
    39  	return syscall.Geteuid()
    40  }
    41  
    42  // Getgid returns the numeric group id of the caller.
    43  //
    44  // On non-POSIX systems, it returns -1.
    45  func Getgid() int {
    46  	return syscall.Getgid()
    47  }
    48  
    49  // Getegid returns the numeric effective group id of the caller.
    50  //
    51  // On non-POSIX systems, it returns -1.
    52  func Getegid() int {
    53  	return syscall.Getegid()
    54  }