unix: add missing tpacket block (sub)header

This adds the missing tpacket_hdr_v1 struct, which is needed to read
tpacket_block_desc (hdr member, which is a union and therfore defined as
[40]byte). This doesn't modify block_desc so existing implementations
keep working.
Caveat: Although TpacketBDTS has a usec member, this will contain nsec
in case of tpacket v2 or v3.

Change-Id: I772939fe56cf56fc09cf4acf4013b23beb6e03c7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/174861
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/unix/linux/types.go b/unix/linux/types.go
index 9899cb1..2f7ffd1 100644
--- a/unix/linux/types.go
+++ b/unix/linux/types.go
@@ -1160,6 +1160,10 @@
 
 type TpacketBlockDesc C.struct_tpacket_block_desc
 
+type TpacketBDTS C.struct_tpacket_bd_ts
+
+type TpacketHdrV1 C.struct_tpacket_hdr_v1
+
 type TpacketReq C.struct_tpacket_req
 
 type TpacketReq3 C.struct_tpacket_req3
diff --git a/unix/ztypes_linux_386.go b/unix/ztypes_linux_386.go
index e09fe87..06471af 100644
--- a/unix/ztypes_linux_386.go
+++ b/unix/ztypes_linux_386.go
@@ -1452,6 +1452,21 @@
 	Hdr     [40]byte
 }
 
+type TpacketBDTS struct {
+	Sec  uint32
+	Usec uint32
+}
+
+type TpacketHdrV1 struct {
+	Block_status        uint32
+	Num_pkts            uint32
+	Offset_to_first_pkt uint32
+	Blk_len             uint32
+	Seq_num             uint64
+	Ts_first_pkt        TpacketBDTS
+	Ts_last_pkt         TpacketBDTS
+}
+
 type TpacketReq struct {
 	Block_size uint32
 	Block_nr   uint32
diff --git a/unix/ztypes_linux_amd64.go b/unix/ztypes_linux_amd64.go
index 45e6934..6bba58e 100644
--- a/unix/ztypes_linux_amd64.go
+++ b/unix/ztypes_linux_amd64.go
@@ -1464,6 +1464,21 @@
 	Hdr     [40]byte
 }
 
+type TpacketBDTS struct {
+	Sec  uint32
+	Usec uint32
+}
+
+type TpacketHdrV1 struct {
+	Block_status        uint32
+	Num_pkts            uint32
+	Offset_to_first_pkt uint32
+	Blk_len             uint32
+	Seq_num             uint64
+	Ts_first_pkt        TpacketBDTS
+	Ts_last_pkt         TpacketBDTS
+}
+
 type TpacketReq struct {
 	Block_size uint32
 	Block_nr   uint32
diff --git a/unix/ztypes_linux_arm.go b/unix/ztypes_linux_arm.go
index 093afab..07aa92b 100644
--- a/unix/ztypes_linux_arm.go
+++ b/unix/ztypes_linux_arm.go
@@ -1442,6 +1442,21 @@
 	Hdr     [40]byte
 }
 
+type TpacketBDTS struct {
+	Sec  uint32
+	Usec uint32
+}
+
+type TpacketHdrV1 struct {
+	Block_status        uint32
+	Num_pkts            uint32
+	Offset_to_first_pkt uint32
+	Blk_len             uint32
+	Seq_num             uint64
+	Ts_first_pkt        TpacketBDTS
+	Ts_last_pkt         TpacketBDTS
+}
+
 type TpacketReq struct {
 	Block_size uint32
 	Block_nr   uint32
diff --git a/unix/ztypes_linux_arm64.go b/unix/ztypes_linux_arm64.go
index 5402721..66dba9a 100644
--- a/unix/ztypes_linux_arm64.go
+++ b/unix/ztypes_linux_arm64.go
@@ -1443,6 +1443,21 @@
 	Hdr     [40]byte
 }
 
+type TpacketBDTS struct {
+	Sec  uint32
+	Usec uint32
+}
+
+type TpacketHdrV1 struct {
+	Block_status        uint32
+	Num_pkts            uint32
+	Offset_to_first_pkt uint32
+	Blk_len             uint32
+	Seq_num             uint64
+	Ts_first_pkt        TpacketBDTS
+	Ts_last_pkt         TpacketBDTS
+}
+
 type TpacketReq struct {
 	Block_size uint32
 	Block_nr   uint32
diff --git a/unix/ztypes_linux_mips.go b/unix/ztypes_linux_mips.go
index 19c8351..b11b77d 100644
--- a/unix/ztypes_linux_mips.go
+++ b/unix/ztypes_linux_mips.go
@@ -1448,6 +1448,21 @@
 	Hdr     [40]byte
 }
 
+type TpacketBDTS struct {
+	Sec  uint32
+	Usec uint32
+}
+
+type TpacketHdrV1 struct {
+	Block_status        uint32
+	Num_pkts            uint32
+	Offset_to_first_pkt uint32
+	Blk_len             uint32
+	Seq_num             uint64
+	Ts_first_pkt        TpacketBDTS
+	Ts_last_pkt         TpacketBDTS
+}
+
 type TpacketReq struct {
 	Block_size uint32
 	Block_nr   uint32
diff --git a/unix/ztypes_linux_mips64.go b/unix/ztypes_linux_mips64.go
index 1431b26..ccfd952 100644
--- a/unix/ztypes_linux_mips64.go
+++ b/unix/ztypes_linux_mips64.go
@@ -1445,6 +1445,21 @@
 	Hdr     [40]byte
 }
 
+type TpacketBDTS struct {
+	Sec  uint32
+	Usec uint32
+}
+
+type TpacketHdrV1 struct {
+	Block_status        uint32
+	Num_pkts            uint32
+	Offset_to_first_pkt uint32
+	Blk_len             uint32
+	Seq_num             uint64
+	Ts_first_pkt        TpacketBDTS
+	Ts_last_pkt         TpacketBDTS
+}
+
 type TpacketReq struct {
 	Block_size uint32
 	Block_nr   uint32
diff --git a/unix/ztypes_linux_mips64le.go b/unix/ztypes_linux_mips64le.go
index 181e370..95374fd 100644
--- a/unix/ztypes_linux_mips64le.go
+++ b/unix/ztypes_linux_mips64le.go
@@ -1445,6 +1445,21 @@
 	Hdr     [40]byte
 }
 
+type TpacketBDTS struct {
+	Sec  uint32
+	Usec uint32
+}
+
+type TpacketHdrV1 struct {
+	Block_status        uint32
+	Num_pkts            uint32
+	Offset_to_first_pkt uint32
+	Blk_len             uint32
+	Seq_num             uint64
+	Ts_first_pkt        TpacketBDTS
+	Ts_last_pkt         TpacketBDTS
+}
+
 type TpacketReq struct {
 	Block_size uint32
 	Block_nr   uint32
diff --git a/unix/ztypes_linux_mipsle.go b/unix/ztypes_linux_mipsle.go
index 8c037ca..9d4953d 100644
--- a/unix/ztypes_linux_mipsle.go
+++ b/unix/ztypes_linux_mipsle.go
@@ -1448,6 +1448,21 @@
 	Hdr     [40]byte
 }
 
+type TpacketBDTS struct {
+	Sec  uint32
+	Usec uint32
+}
+
+type TpacketHdrV1 struct {
+	Block_status        uint32
+	Num_pkts            uint32
+	Offset_to_first_pkt uint32
+	Blk_len             uint32
+	Seq_num             uint64
+	Ts_first_pkt        TpacketBDTS
+	Ts_last_pkt         TpacketBDTS
+}
+
 type TpacketReq struct {
 	Block_size uint32
 	Block_nr   uint32
diff --git a/unix/ztypes_linux_ppc64.go b/unix/ztypes_linux_ppc64.go
index 97a2f8d..a436410 100644
--- a/unix/ztypes_linux_ppc64.go
+++ b/unix/ztypes_linux_ppc64.go
@@ -1453,6 +1453,21 @@
 	Hdr     [40]byte
 }
 
+type TpacketBDTS struct {
+	Sec  uint32
+	Usec uint32
+}
+
+type TpacketHdrV1 struct {
+	Block_status        uint32
+	Num_pkts            uint32
+	Offset_to_first_pkt uint32
+	Blk_len             uint32
+	Seq_num             uint64
+	Ts_first_pkt        TpacketBDTS
+	Ts_last_pkt         TpacketBDTS
+}
+
 type TpacketReq struct {
 	Block_size uint32
 	Block_nr   uint32
diff --git a/unix/ztypes_linux_ppc64le.go b/unix/ztypes_linux_ppc64le.go
index 8c2cdd7..dbe32bb 100644
--- a/unix/ztypes_linux_ppc64le.go
+++ b/unix/ztypes_linux_ppc64le.go
@@ -1453,6 +1453,21 @@
 	Hdr     [40]byte
 }
 
+type TpacketBDTS struct {
+	Sec  uint32
+	Usec uint32
+}
+
+type TpacketHdrV1 struct {
+	Block_status        uint32
+	Num_pkts            uint32
+	Offset_to_first_pkt uint32
+	Blk_len             uint32
+	Seq_num             uint64
+	Ts_first_pkt        TpacketBDTS
+	Ts_last_pkt         TpacketBDTS
+}
+
 type TpacketReq struct {
 	Block_size uint32
 	Block_nr   uint32
diff --git a/unix/ztypes_linux_riscv64.go b/unix/ztypes_linux_riscv64.go
index cd3a2d0..774d5c3 100644
--- a/unix/ztypes_linux_riscv64.go
+++ b/unix/ztypes_linux_riscv64.go
@@ -1470,6 +1470,21 @@
 	Hdr     [40]byte
 }
 
+type TpacketBDTS struct {
+	Sec  uint32
+	Usec uint32
+}
+
+type TpacketHdrV1 struct {
+	Block_status        uint32
+	Num_pkts            uint32
+	Offset_to_first_pkt uint32
+	Blk_len             uint32
+	Seq_num             uint64
+	Ts_first_pkt        TpacketBDTS
+	Ts_last_pkt         TpacketBDTS
+}
+
 type TpacketReq struct {
 	Block_size uint32
 	Block_nr   uint32
diff --git a/unix/ztypes_linux_s390x.go b/unix/ztypes_linux_s390x.go
index 0d459c7..3b7747e 100644
--- a/unix/ztypes_linux_s390x.go
+++ b/unix/ztypes_linux_s390x.go
@@ -1467,6 +1467,21 @@
 	Hdr     [40]byte
 }
 
+type TpacketBDTS struct {
+	Sec  uint32
+	Usec uint32
+}
+
+type TpacketHdrV1 struct {
+	Block_status        uint32
+	Num_pkts            uint32
+	Offset_to_first_pkt uint32
+	Blk_len             uint32
+	Seq_num             uint64
+	Ts_first_pkt        TpacketBDTS
+	Ts_last_pkt         TpacketBDTS
+}
+
 type TpacketReq struct {
 	Block_size uint32
 	Block_nr   uint32
diff --git a/unix/ztypes_linux_sparc64.go b/unix/ztypes_linux_sparc64.go
index 71e3b40..c606f47 100644
--- a/unix/ztypes_linux_sparc64.go
+++ b/unix/ztypes_linux_sparc64.go
@@ -1448,6 +1448,21 @@
 	Hdr     [40]byte
 }
 
+type TpacketBDTS struct {
+	Sec  uint32
+	Usec uint32
+}
+
+type TpacketHdrV1 struct {
+	Block_status        uint32
+	Num_pkts            uint32
+	Offset_to_first_pkt uint32
+	Blk_len             uint32
+	Seq_num             uint64
+	Ts_first_pkt        TpacketBDTS
+	Ts_last_pkt         TpacketBDTS
+}
+
 type TpacketReq struct {
 	Block_size uint32
 	Block_nr   uint32