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