...

Source file src/os/user/cgo_lookup_syscall.go

Documentation: os/user

     1  // Copyright 2011 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  //go:build !osusergo && darwin
     6  
     7  package user
     8  
     9  import (
    10  	"internal/syscall/unix"
    11  	"syscall"
    12  )
    13  
    14  type _C_char = byte
    15  type _C_int = int32
    16  type _C_gid_t = uint32
    17  type _C_uid_t = uint32
    18  type _C_size_t = uintptr
    19  type _C_struct_group = unix.Group
    20  type _C_struct_passwd = unix.Passwd
    21  type _C_long = int64
    22  
    23  func _C_pw_uid(p *_C_struct_passwd) _C_uid_t   { return p.Uid }
    24  func _C_pw_uidp(p *_C_struct_passwd) *_C_uid_t { return &p.Uid }
    25  func _C_pw_gid(p *_C_struct_passwd) _C_gid_t   { return p.Gid }
    26  func _C_pw_gidp(p *_C_struct_passwd) *_C_gid_t { return &p.Gid }
    27  func _C_pw_name(p *_C_struct_passwd) *_C_char  { return p.Name }
    28  func _C_pw_gecos(p *_C_struct_passwd) *_C_char { return p.Gecos }
    29  func _C_pw_dir(p *_C_struct_passwd) *_C_char   { return p.Dir }
    30  
    31  func _C_gr_gid(g *_C_struct_group) _C_gid_t  { return g.Gid }
    32  func _C_gr_name(g *_C_struct_group) *_C_char { return g.Name }
    33  
    34  func _C_GoString(p *_C_char) string { return unix.GoString(p) }
    35  
    36  func _C_getpwnam_r(name *_C_char, buf *_C_char, size _C_size_t) (pwd _C_struct_passwd, found bool, errno syscall.Errno) {
    37  	var result *_C_struct_passwd
    38  	errno = unix.Getpwnam(name, &pwd, buf, size, &result)
    39  	return pwd, result != nil, errno
    40  }
    41  
    42  func _C_getpwuid_r(uid _C_uid_t, buf *_C_char, size _C_size_t) (pwd _C_struct_passwd, found bool, errno syscall.Errno) {
    43  	var result *_C_struct_passwd
    44  	errno = unix.Getpwuid(uid, &pwd, buf, size, &result)
    45  	return pwd, result != nil, errno
    46  }
    47  
    48  func _C_getgrnam_r(name *_C_char, buf *_C_char, size _C_size_t) (grp _C_struct_group, found bool, errno syscall.Errno) {
    49  	var result *_C_struct_group
    50  	errno = unix.Getgrnam(name, &grp, buf, size, &result)
    51  	return grp, result != nil, errno
    52  }
    53  
    54  func _C_getgrgid_r(gid _C_gid_t, buf *_C_char, size _C_size_t) (grp _C_struct_group, found bool, errno syscall.Errno) {
    55  	var result *_C_struct_group
    56  	errno = unix.Getgrgid(gid, &grp, buf, size, &result)
    57  	return grp, result != nil, errno
    58  }
    59  
    60  const (
    61  	_C__SC_GETPW_R_SIZE_MAX = unix.SC_GETPW_R_SIZE_MAX
    62  	_C__SC_GETGR_R_SIZE_MAX = unix.SC_GETGR_R_SIZE_MAX
    63  )
    64  
    65  func _C_sysconf(key _C_int) _C_long { return unix.Sysconf(key) }
    66  

View as plain text