From 6dbbb49403c1bf84d6a5b45a80c5fd61868c3957 Mon Sep 17 00:00:00 2001 From: kettenis Date: Sat, 15 Feb 2014 09:48:07 +0000 Subject: [PATCH] If opening /dev/pciN read-write fails, try opening it read-only. This allows X to run with machdep.allowaperture=0 on inteldrm(4) and radeondrm(4). ok matthieu@ --- lib/libpciaccess/src/openbsd_pci.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/libpciaccess/src/openbsd_pci.c b/lib/libpciaccess/src/openbsd_pci.c index 24759dd8c..a93832cee 100644 --- a/lib/libpciaccess/src/openbsd_pci.c +++ b/lib/libpciaccess/src/openbsd_pci.c @@ -599,8 +599,11 @@ pci_system_openbsd_create(void) for (domain = 0; domain < sizeof(pcifd) / sizeof(pcifd[0]); domain++) { snprintf(path, sizeof(path), "/dev/pci%d", domain); pcifd[domain] = open(path, O_RDWR | O_CLOEXEC); - if (pcifd[domain] == -1) - break; + if (pcifd[domain] == -1) { + pcifd[domain] = open(path, O_RDONLY | O_CLOEXEC); + if (pcifd[domain] == -1) + break; + } ndomains++; }