github.com/zxy12/golang_with_comment@v0.0.0-20190701084843-0e6b2aff5ef3/os/user/getgrouplist_unix.go (about)

     1  // Copyright 2016 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  // +build dragonfly freebsd !android,linux netbsd openbsd
     6  
     7  package user
     8  
     9  /*
    10  #include <unistd.h>
    11  #include <sys/types.h>
    12  #include <grp.h>
    13  
    14  static int mygetgrouplist(const char* user, gid_t group, gid_t* groups, int* ngroups) {
    15  	return getgrouplist(user, group, groups, ngroups);
    16  }
    17  */
    18  import "C"
    19  
    20  func getGroupList(name *C.char, userGID C.gid_t, gids *C.gid_t, n *C.int) C.int {
    21  	return C.mygetgrouplist(name, userGID, gids, n)
    22  }