aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/net/cgo_aix.go24
-rw-r--r--src/net/cgo_sockold.go2
-rw-r--r--src/net/cgo_unix.go7
-rw-r--r--src/net/cgo_unix_test.go2
4 files changed, 32 insertions, 3 deletions
diff --git a/src/net/cgo_aix.go b/src/net/cgo_aix.go
new file mode 100644
index 0000000000..d0ad414a32
--- /dev/null
+++ b/src/net/cgo_aix.go
@@ -0,0 +1,24 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build cgo,!netgo
+
+package net
+
+/*
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netdb.h>
+*/
+import "C"
+
+import "unsafe"
+
+const cgoAddrInfoFlags = C.AI_CANONNAME
+
+func cgoNameinfoPTR(b []byte, sa *C.struct_sockaddr, salen C.socklen_t) (int, error) {
+ gerrno, err := C.getnameinfo(sa, C.size_t(salen), (*C.char)(unsafe.Pointer(&b[0])), C.size_t(len(b)), nil, 0, C.NI_NAMEREQD)
+ return int(gerrno), err
+}
diff --git a/src/net/cgo_sockold.go b/src/net/cgo_sockold.go
index e629a09f9c..e1e642bb41 100644
--- a/src/net/cgo_sockold.go
+++ b/src/net/cgo_sockold.go
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build cgo,!netgo
-// +build darwin dragonfly freebsd netbsd openbsd
+// +build aix darwin dragonfly freebsd netbsd openbsd
package net
diff --git a/src/net/cgo_unix.go b/src/net/cgo_unix.go
index b7cbcfe77a..6420fd05e7 100644
--- a/src/net/cgo_unix.go
+++ b/src/net/cgo_unix.go
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build cgo,!netgo
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
+// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net
@@ -14,6 +14,11 @@ package net
#include <netdb.h>
#include <unistd.h>
#include <string.h>
+
+// If nothing else defined EAI_OVERFLOW, make sure it has a value.
+#ifndef EAI_OVERFLOW
+#define EAI_OVERFLOW -12
+#endif
*/
import "C"
diff --git a/src/net/cgo_unix_test.go b/src/net/cgo_unix_test.go
index c3eab5b3b2..99d79a60c4 100644
--- a/src/net/cgo_unix_test.go
+++ b/src/net/cgo_unix_test.go
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build cgo,!netgo
-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
+// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net