Source file src/cmd/internal/osinfo/os_solaris.go

     1  // Copyright 2024 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  // Supporting definitions for os_uname.go on Solaris.
     6  
     7  package osinfo
     8  
     9  import (
    10  	"syscall"
    11  	"unsafe"
    12  )
    13  
    14  type utsname struct {
    15  	Sysname  [257]byte
    16  	Nodename [257]byte
    17  	Release  [257]byte
    18  	Version  [257]byte
    19  	Machine  [257]byte
    20  }
    21  
    22  //go:cgo_import_dynamic libc_uname uname "libc.so"
    23  //go:linkname procUname libc_uname
    24  
    25  var procUname uintptr
    26  
    27  //go:linkname rawsysvicall6 runtime.syscall_rawsysvicall6
    28  func rawsysvicall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err syscall.Errno)
    29  
    30  func uname(buf *utsname) error {
    31  	_, _, errno := rawsysvicall6(uintptr(unsafe.Pointer(&procUname)), 1, uintptr(unsafe.Pointer(buf)), 0, 0, 0, 0, 0)
    32  	if errno != 0 {
    33  		return errno
    34  	}
    35  	return nil
    36  }
    37  

View as plain text