echo "const $m = 0" >> ${OUT}
fi
done
+for m in SOCK_CLOEXEC SOCK_NONBLOCK; do
+ if ! grep "^const $m " ${OUT} >/dev/null 2>&1; then
+ echo "const $m = -1" >> ${OUT}
+ fi
+done
+
+# The syscall package requires AF_LOCAL.
+if ! grep '^const AF_LOCAL ' ${OUT} >/dev/null 2>&1; then
+ if grep '^const AF_UNIX ' ${OUT} >/dev/null 2>&1; then
+ echo "const AF_LOCAL = AF_UNIX" >> ${OUT}
+ fi
+fi
# pathconf constants.
grep '^const __PC' gen-sysinfo.go |
echo "type Gid_t _gid_t" >> ${OUT}
echo "type Socklen_t _socklen_t" >> ${OUT}
-# The long type, needed because that is the type that ptrace returns.
+# The C int type.
+sizeof_int=`grep '^const ___SIZEOF_INT__ = ' gen-sysinfo.go | sed -e 's/.*= //'`
+if test "$sizeof_int" = "4"; then
+ echo "type _C_int int32" >> ${OUT}
+ echo "type _C_uint uint32" >> ${OUT}
+elif test "$sizeof_int" = "8"; then
+ echo "type _C_int int64" >> ${OUT}
+ echo "type _C_uint uint64" >> ${OUT}
+else
+ echo 1>&2 "mksysinfo.sh: could not determine size of int (got $sizeof_int)"
+ exit 1
+fi
+
+# The C long type, needed because that is the type that ptrace returns.
sizeof_long=`grep '^const ___SIZEOF_LONG__ = ' gen-sysinfo.go | sed -e 's/.*= //'`
if test "$sizeof_long" = "4"; then
echo "type _C_long int32" >> ${OUT}