net: EAI_OVERFLOW does not exist on AIX

Issue golang/go#19200

Change-Id: Ifef0d8b0d5345c124ee03af8fed15dd4fd4ad232
Reviewed-on: https://go-review.googlesource.com/38266
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/libgo/go/net/cgo_aix.go b/libgo/go/net/cgo_aix.go
new file mode 100644
index 0000000..4f23d9b
--- /dev/null
+++ b/libgo/go/net/cgo_aix.go
@@ -0,0 +1,13 @@
+// Copyright 2011 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
+
+import (
+	"syscall"
+)
+
+const cgoAddrInfoFlags = syscall.AI_CANONNAME
diff --git a/libgo/go/net/cgo_unix.go b/libgo/go/net/cgo_unix.go
index a90aaa9..09cfb2a 100644
--- a/libgo/go/net/cgo_unix.go
+++ b/libgo/go/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
 
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index 72434d5..c641cd2 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -662,6 +662,11 @@
 grep '^const _NI_' gen-sysinfo.go | \
   sed -e 's/^\(const \)_\(NI_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
 
+# If nothing else defined EAI_OVERFLOW, make sure it has a value.
+if ! grep "const EAI_OVERFLOW " ${OUT} >/dev/null 2>&1; then
+  echo "const EAI_OVERFLOW = 0" >> ${OUT}
+fi
+
 # The passwd struct.
 grep '^type _passwd ' gen-sysinfo.go | \
     sed -e 's/_passwd/Passwd/' \