aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_bsd.h
diff options
context:
space:
mode:
authorm00nbsd <42475391+m00nbsd@users.noreply.github.com>2020-06-13 12:10:16 +0200
committerGitHub <noreply@github.com>2020-06-13 12:10:16 +0200
commitdbce178a0e6997a799ba38247059dcb8213f4572 (patch)
tree44c8bf22f223f1a9f2d3f37012fdbf0d9bb0a624 /executor/common_bsd.h
parent205b2ba41849749529bce61d21862f8c86ed12a4 (diff)
sys/netbsd: support multiple vHCI buses (#1822)
Diffstat (limited to 'executor/common_bsd.h')
-rw-r--r--executor/common_bsd.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/executor/common_bsd.h b/executor/common_bsd.h
index 82aef4211..070c512bf 100644
--- a/executor/common_bsd.h
+++ b/executor/common_bsd.h
@@ -17,10 +17,28 @@
#include "common_usb_netbsd.h"
#endif
#if SYZ_EXECUTOR || SYZ_USB
+#include <dirent.h>
static void setup_usb(void)
{
- if (chmod("/dev/vhci", 0666))
- fail("failed to chmod /dev/vhci");
+ struct dirent* ent;
+ char path[1024];
+ DIR* dir;
+
+ dir = opendir("/dev");
+ if (dir == NULL)
+ fail("failed to open /dev");
+
+ while ((ent = readdir(dir)) != NULL) {
+ if (ent->d_type != DT_CHR)
+ continue;
+ if (strncmp(ent->d_name, "vhci", 4))
+ continue;
+ snprintf(path, sizeof(path), "/dev/%s", ent->d_name);
+ if (chmod(path, 0666))
+ fail("failed to chmod %s", path);
+ }
+
+ closedir(dir);
}
#endif