#include <netinet/in.h>
/* <netinet/tcp.h> needs u_char/u_short, but <sys/bsd_types> is only
included by <netinet/in.h> if _SGIAPI (i.e. _SGI_SOURCE
- && !_XOPEN_SOURCE. */
+ && !_XOPEN_SOURCE.
+ <sys/termios.h> only defines TIOCNOTTY if !_XOPEN_SOURCE, while
+ <sys/ttold.h> does so unconditionally. */
#ifdef __sgi__
#include <sys/bsd_types.h>
+#include <sys/ttold.h>
#endif
#include <netinet/tcp.h>
#include <signal.h>
echo 'package syscall' > ${OUT}
echo 'import "unsafe"' >> ${OUT}
+echo 'type _ unsafe.Pointer' >> ${OUT}
# Get all the consts and types, skipping ones which could not be
# represented in Go and ones which we need to rewrite. We also skip
grep '^const _TIOC' gen-sysinfo.go | \
sed -e 's/^\(const \)_\(TIOC[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
+# ioctl constants. Might fall back to 0 if TIOCNXCL is missing, too, but
+# needs handling in syscalls.exec.go.
+if ! grep '^const _TIOCSCTTY ' gen-sysinfo.go >/dev/null 2>&1; then
+ if grep '^const _TIOCNXCL ' gen-sysinfo.go >/dev/null 2>&1; then
+ echo "const TIOCSCTTY = TIOCNXCL" >> ${OUT}
+ fi
+fi
+
# The nlmsghdr struct.
grep '^type _nlmsghdr ' gen-sysinfo.go | \
sed -e 's/_nlmsghdr/NlMsghdr/' \