diff --git a/unix/mkall.sh b/unix/mkall.sh index d257fac5..d727cad1 100755 --- a/unix/mkall.sh +++ b/unix/mkall.sh @@ -199,7 +199,7 @@ illumos_amd64) mksyscall="go run mksyscall_solaris.go" mkerrors= mksysnum= - mktypes= + mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; *) echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2 diff --git a/unix/types_illumos.go b/unix/types_illumos.go new file mode 100644 index 00000000..a4860c77 --- /dev/null +++ b/unix/types_illumos.go @@ -0,0 +1,47 @@ +// Copyright 2021 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. + +//go:build ignore +// +build ignore + +/* +Input to cgo -godefs. See README.md +*/ + +package unix + +/* +#include +#include +#include + +// Many illumos distributions ship a 3rd party tun/tap driver +// from https://github.com/kaizawa/tuntap +// It supports a pair of IOCTLs defined at +// https://github.com/kaizawa/tuntap/blob/master/if_tun.h#L91-L93 +#define TUNNEWPPA (('T'<<16) | 0x0001) +#define TUNSETPPA (('T'<<16) | 0x0002) +*/ +import "C" + +const ( + TUNNEWPPA = C.TUNNEWPPA + TUNSETPPA = C.TUNSETPPA + + // sys/stropts.h: + I_STR = C.I_STR + I_POP = C.I_POP + I_PUSH = C.I_PUSH + I_PLINK = C.I_PLINK + I_PUNLINK = C.I_PUNLINK + + // sys/sockio.h: + IF_UNITSEL = C.IF_UNITSEL +) + +type strbuf C.struct_strbuf + +type strioctl C.struct_strioctl + +type lifreq C.struct_lifreq diff --git a/unix/ztypes_illumos_amd64.go b/unix/ztypes_illumos_amd64.go new file mode 100644 index 00000000..1137a5a1 --- /dev/null +++ b/unix/ztypes_illumos_amd64.go @@ -0,0 +1,40 @@ +// cgo -godefs types_illumos.go | go run mkpost.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build amd64 && illumos +// +build amd64,illumos + +package unix + +const ( + TUNNEWPPA = 0x540001 + TUNSETPPA = 0x540002 + + I_STR = 0x5308 + I_POP = 0x5303 + I_PUSH = 0x5302 + I_PLINK = 0x5316 + I_PUNLINK = 0x5317 + + IF_UNITSEL = -0x7ffb8cca +) + +type strbuf struct { + Maxlen int32 + Len int32 + Buf *int8 +} + +type strioctl struct { + Cmd int32 + Timout int32 + Len int32 + Dp *int8 +} + +type lifreq struct { + Name [32]int8 + Lifru1 [4]byte + Type uint32 + Lifru [336]byte +}