Source file src/net/cgo_resnew.go

     1  // Copyright 2015 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 cgo && !netgo && ((linux && !android) || netbsd || solaris)
     6  
     7  package net
     8  
     9  /*
    10  #include <sys/types.h>
    11  #include <sys/socket.h>
    12  
    13  #include <netdb.h>
    14  */
    15  import "C"
    16  
    17  import "unsafe"
    18  
    19  func cgoNameinfoPTR(b []byte, sa *C.struct_sockaddr, salen C.socklen_t) (int, error) {
    20  	gerrno, err := C.getnameinfo(sa, salen, (*C.char)(unsafe.Pointer(&b[0])), C.socklen_t(len(b)), nil, 0, C.NI_NAMEREQD)
    21  	return int(gerrno), err
    22  }
    23  

View as plain text