From 3a200f3f2e52e671b8d9911e3724d6b11dbbbe08 Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Fri, 31 Jan 2020 14:54:30 +0100 Subject: [PATCH] [compiler-rt] Fix build on NetBSD 9.99.44 Fix build on >= 9.99.44 after the removal of urio(4). Add compat code for the device as NetBSD-9.0 is supported. --- .../sanitizer_interceptors_ioctl_netbsd.inc | 6 +++--- .../sanitizer_platform_limits_netbsd.cpp | 14 ++++++++++++++ compiler-rt/utils/generate_netbsd_ioctls.awk | 2 ++ 3 files changed, 19 insertions(+), 3 deletions(-) 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 d0cc4da9755f..576807ea3a6a 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc @@ -446,9 +446,6 @@ static void ioctl_table_fill() { _(STICIO_STOPQ, NONE, 0); /* Entries from file: dev/usb/ukyopon.h */ _(UKYOPON_IDENTIFY, WRITE, struct_ukyopon_identify_sz); - /* Entries from file: dev/usb/urio.h */ - _(URIO_SEND_COMMAND, READWRITE, struct_urio_command_sz); - _(URIO_RECV_COMMAND, READWRITE, struct_urio_command_sz); /* Entries from file: dev/usb/usb.h */ _(USB_REQUEST, READWRITE, struct_usb_ctl_request_sz); _(USB_SETDEBUG, READ, sizeof(int)); @@ -1405,6 +1402,9 @@ static void ioctl_table_fill() { /* Entries from file: dev/filemon/filemon.h (compat <= 9.99.26) */ _(FILEMON_SET_FD, READWRITE, sizeof(int)); _(FILEMON_SET_PID, READWRITE, sizeof(int)); + /* Entries from file: dev/usb/urio.h (compat <= 9.99.43) */ + _(URIO_SEND_COMMAND, READWRITE, struct_urio_command_sz); + _(URIO_RECV_COMMAND, READWRITE, struct_urio_command_sz); #undef _ } // NOLINT 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 48a78c8998a2..066502bd0099 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp @@ -190,7 +190,21 @@ #include #include #include +#if !__NetBSD_Prereq__(9, 99, 44) #include +#else +struct urio_command { + unsigned short length; + int request; + int requesttype; + int value; + int index; + void *buffer; + int timeout; +}; +#define URIO_SEND_COMMAND _IOWR('U', 200, struct urio_command) +#define URIO_RECV_COMMAND _IOWR('U', 201, struct urio_command) +#endif #include #include #include diff --git a/compiler-rt/utils/generate_netbsd_ioctls.awk b/compiler-rt/utils/generate_netbsd_ioctls.awk index 0d3f01a54b65..29840c99068f 100755 --- a/compiler-rt/utils/generate_netbsd_ioctls.awk +++ b/compiler-rt/utils/generate_netbsd_ioctls.awk @@ -256,6 +256,8 @@ END { # 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)") + add_compat("dev/usb/urio.h (compat <= 9.99.43)", "URIO_SEND_COMMAND", "READWRITE", "struct_urio_command_sz") + add_compat("", "URIO_RECV_COMMAND", "READWRITE", "struct_urio_command_sz") # Generate sanitizer_interceptors_ioctl_netbsd.inc