[compiler-rt] e14ff22 - [compiler-rt] Sync NetBSD ioctl definitions with 9.99.26
Kamil Rytarowski via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 18 06:45:06 PST 2019
Author: Kamil Rytarowski
Date: 2019-12-18T15:44:01+01:00
New Revision: e14ff22694c28b5e731502bfc30192b3208d4d8d
URL: https://github.com/llvm/llvm-project/commit/e14ff22694c28b5e731502bfc30192b3208d4d8d
DIFF: https://github.com/llvm/llvm-project/commit/e14ff22694c28b5e731502bfc30192b3208d4d8d.diff
LOG: [compiler-rt] Sync NetBSD ioctl definitions with 9.99.26
Document the minimal version supported to 9.0.
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp
compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
compiler-rt/utils/generate_netbsd_ioctls.awk
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc b/compiler-rt/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
index 03ef7c1788cd..d0cc4da9755f 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
@@ -24,7 +24,7 @@ struct ioctl_desc {
const char *name;
};
-const unsigned ioctl_table_max = 1236;
+const unsigned ioctl_table_max = 1238;
static ioctl_desc ioctl_table[ioctl_table_max];
static unsigned ioctl_table_size = 0;
@@ -166,9 +166,6 @@ static void ioctl_table_fill() {
_(FE_ENABLE_HIGH_LNB_VOLTAGE, READ, sizeof(int));
_(FE_SET_FRONTEND_TUNE_MODE, READ, sizeof(unsigned int));
_(FE_DISHNETWORK_SEND_LEGACY_CMD, READ, sizeof(unsigned long));
- /* Entries from file: dev/filemon/filemon.h */
- _(FILEMON_SET_FD, READWRITE, sizeof(int));
- _(FILEMON_SET_PID, READWRITE, sizeof(int));
/* Entries from file: dev/hdaudio/hdaudioio.h */
_(HDAUDIO_FGRP_INFO, READWRITE, struct_plistref_sz);
_(HDAUDIO_FGRP_GETCONFIG, READWRITE, struct_plistref_sz);
@@ -653,6 +650,7 @@ static void ioctl_table_fill() {
_(NVMM_IOC_MACHINE_CONFIGURE, READ, struct_nvmm_ioc_machine_configure_sz);
_(NVMM_IOC_VCPU_CREATE, READ, struct_nvmm_ioc_vcpu_create_sz);
_(NVMM_IOC_VCPU_DESTROY, READ, struct_nvmm_ioc_vcpu_destroy_sz);
+ _(NVMM_IOC_VCPU_CONFIGURE, READ, struct_nvmm_ioc_vcpu_configure_sz);
_(NVMM_IOC_VCPU_SETSTATE, READ, struct_nvmm_ioc_vcpu_setstate_sz);
_(NVMM_IOC_VCPU_GETSTATE, READ, struct_nvmm_ioc_vcpu_getstate_sz);
_(NVMM_IOC_VCPU_INJECT, READ, struct_nvmm_ioc_vcpu_inject_sz);
@@ -735,6 +733,7 @@ static void ioctl_table_fill() {
_(IOC_NPF_SAVE, WRITE, struct_nvlist_ref_sz);
_(IOC_NPF_RULE, READWRITE, struct_nvlist_ref_sz);
_(IOC_NPF_CONN_LOOKUP, READWRITE, struct_nvlist_ref_sz);
+ _(IOC_NPF_TABLE_REPLACE, READWRITE, struct_nvlist_ref_sz);
/* Entries from file: net/if_pppoe.h */
_(PPPOESETPARMS, READ, struct_pppoediscparms_sz);
_(PPPOEGETPARMS, READWRITE, struct_pppoediscparms_sz);
@@ -1403,8 +1402,11 @@ static void ioctl_table_fill() {
_(SNDCTL_DSP_SETRECVOL, READ, sizeof(unsigned int));
_(SNDCTL_DSP_SKIP, NONE, 0);
_(SNDCTL_DSP_SILENCE, NONE, 0);
+ /* Entries from file: dev/filemon/filemon.h (compat <= 9.99.26) */
+ _(FILEMON_SET_FD, READWRITE, sizeof(int));
+ _(FILEMON_SET_PID, READWRITE, sizeof(int));
#undef _
-} // NOLINT
+} // NOLINT
static bool ioctl_initialized = false;
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp
index f01de6c995e6..716650f4a2a9 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp
@@ -109,7 +109,12 @@
#include <dev/dmover/dmover_io.h>
#include <dev/dtv/dtvio_demux.h>
#include <dev/dtv/dtvio_frontend.h>
+#if !__NetBSD_Prereq__(9,9,26)
#include <dev/filemon/filemon.h>
+#else
+#define FILEMON_SET_FD _IOWR('S', 1, int)
+#define FILEMON_SET_PID _IOWR('S', 2, pid_t)
+#endif
#include <dev/hdaudio/hdaudioio.h>
#include <dev/hdmicec/hdmicecio.h>
#include <dev/hpc/hpcfbio.h>
@@ -698,6 +703,7 @@ unsigned struct_nvmm_ioc_machine_configure_sz =
sizeof(nvmm_ioc_machine_configure);
unsigned struct_nvmm_ioc_vcpu_create_sz = sizeof(nvmm_ioc_vcpu_create);
unsigned struct_nvmm_ioc_vcpu_destroy_sz = sizeof(nvmm_ioc_vcpu_destroy);
+unsigned struct_nvmm_ioc_vcpu_configure_sz = sizeof(nvmm_ioc_vcpu_configure);
unsigned struct_nvmm_ioc_vcpu_setstate_sz = sizeof(nvmm_ioc_vcpu_destroy);
unsigned struct_nvmm_ioc_vcpu_getstate_sz = sizeof(nvmm_ioc_vcpu_getstate);
unsigned struct_nvmm_ioc_vcpu_inject_sz = sizeof(nvmm_ioc_vcpu_inject);
@@ -1458,6 +1464,7 @@ unsigned IOCTL_NVMM_IOC_MACHINE_DESTROY = NVMM_IOC_MACHINE_DESTROY;
unsigned IOCTL_NVMM_IOC_MACHINE_CONFIGURE = NVMM_IOC_MACHINE_CONFIGURE;
unsigned IOCTL_NVMM_IOC_VCPU_CREATE = NVMM_IOC_VCPU_CREATE;
unsigned IOCTL_NVMM_IOC_VCPU_DESTROY = NVMM_IOC_VCPU_DESTROY;
+unsigned IOCTL_NVMM_IOC_VCPU_CONFIGURE = NVMM_IOC_VCPU_CONFIGURE;
unsigned IOCTL_NVMM_IOC_VCPU_SETSTATE = NVMM_IOC_VCPU_SETSTATE;
unsigned IOCTL_NVMM_IOC_VCPU_GETSTATE = NVMM_IOC_VCPU_GETSTATE;
unsigned IOCTL_NVMM_IOC_VCPU_INJECT = NVMM_IOC_VCPU_INJECT;
@@ -1534,6 +1541,7 @@ unsigned IOCTL_IOC_NPF_STATS = IOC_NPF_STATS;
unsigned IOCTL_IOC_NPF_SAVE = IOC_NPF_SAVE;
unsigned IOCTL_IOC_NPF_RULE = IOC_NPF_RULE;
unsigned IOCTL_IOC_NPF_CONN_LOOKUP = IOC_NPF_CONN_LOOKUP;
+unsigned IOCTL_IOC_NPF_TABLE_REPLACE = IOC_NPF_TABLE_REPLACE;
unsigned IOCTL_PPPOESETPARMS = PPPOESETPARMS;
unsigned IOCTL_PPPOEGETPARMS = PPPOEGETPARMS;
unsigned IOCTL_PPPOEGETSESSION = PPPOEGETSESSION;
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
index 419d830c69ef..4d7628ec74c9 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
@@ -862,6 +862,7 @@ extern unsigned struct_nvmm_ioc_machine_destroy_sz;
extern unsigned struct_nvmm_ioc_machine_configure_sz;
extern unsigned struct_nvmm_ioc_vcpu_create_sz;
extern unsigned struct_nvmm_ioc_vcpu_destroy_sz;
+extern unsigned struct_nvmm_ioc_vcpu_configure_sz;
extern unsigned struct_nvmm_ioc_vcpu_setstate_sz;
extern unsigned struct_nvmm_ioc_vcpu_getstate_sz;
extern unsigned struct_nvmm_ioc_vcpu_inject_sz;
@@ -1611,6 +1612,7 @@ extern unsigned IOCTL_NVMM_IOC_MACHINE_DESTROY;
extern unsigned IOCTL_NVMM_IOC_MACHINE_CONFIGURE;
extern unsigned IOCTL_NVMM_IOC_VCPU_CREATE;
extern unsigned IOCTL_NVMM_IOC_VCPU_DESTROY;
+extern unsigned IOCTL_NVMM_IOC_VCPU_CONFIGURE;
extern unsigned IOCTL_NVMM_IOC_VCPU_SETSTATE;
extern unsigned IOCTL_NVMM_IOC_VCPU_GETSTATE;
extern unsigned IOCTL_NVMM_IOC_VCPU_INJECT;
@@ -1685,6 +1687,7 @@ extern unsigned IOCTL_IOC_NPF_STATS;
extern unsigned IOCTL_IOC_NPF_SAVE;
extern unsigned IOCTL_IOC_NPF_RULE;
extern unsigned IOCTL_IOC_NPF_CONN_LOOKUP;
+extern unsigned IOCTL_IOC_NPF_TABLE_REPLACE;
extern unsigned IOCTL_PPPOESETPARMS;
extern unsigned IOCTL_PPPOEGETPARMS;
extern unsigned IOCTL_PPPOEGETSESSION;
diff --git a/compiler-rt/utils/generate_netbsd_ioctls.awk b/compiler-rt/utils/generate_netbsd_ioctls.awk
index 0986eccf3d71..0d3f01a54b65 100755
--- a/compiler-rt/utils/generate_netbsd_ioctls.awk
+++ b/compiler-rt/utils/generate_netbsd_ioctls.awk
@@ -13,6 +13,12 @@
#
# This script reads public headers from a NetBSD host.
#
+# This script shall be executed only on the newest NetBSD version.
+# This script will emit compat code for the older releases.
+#
+# NetBSD minimal version supported 9.0.
+# NetBSD current version supported 9.99.26.
+#
#===------------------------------------------------------------------------===#
BEGIN {
@@ -247,6 +253,10 @@ END {
exit(abnormal_exit)
}
+ # Add compat entries
+ add_compat("dev/filemon/filemon.h (compat <= 9.99.26)", "FILEMON_SET_FD", "READWRITE", "sizeof(int)")
+ add_compat("", "FILEMON_SET_PID", "READWRITE", "sizeof(int)")
+
# Generate sanitizer_interceptors_ioctl_netbsd.inc
# open pipe
@@ -304,6 +314,9 @@ END {
pcmd("")
for (i = 0; i < ioctl_table_max; i++) {
+ if (i in fname && fname[i] == "dev/nvmm/nvmm_ioctl.h") {
+ pcmd("#if defined(__x86_64__)")
+ }
if (i in fname) {
pcmd(" /* Entries from file: " fname[i] " */")
}
@@ -315,10 +328,14 @@ END {
}
pcmd(" _(" ioctl_name[i] ", " ioctl_mode[i] "," type ");")
+
+ if (ioctl_name[i] == "NVMM_IOC_CTL") {
+ pcmd("#endif")
+ }
}
pcmd("#undef _")
- pcmd("}")
+ pcmd("} // NOLINT")
pcmd("")
pcmd("static bool ioctl_initialized = false;")
pcmd("")
@@ -638,3 +655,14 @@ function get_type(string)
return string
}
+
+function add_compat(path, name, mode, type)
+{
+ if (path != "") {
+ fname[ioctl_table_max] = path
+ }
+ ioctl_name[ioctl_table_max] = name
+ ioctl_mode[ioctl_table_max] = mode
+ ioctl_type[ioctl_table_max] = type
+ ioctl_table_max++
+}
More information about the llvm-commits
mailing list