From 08365170fe856b1fc080a960c3aac1eda17d8697 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 15 Feb 2014 09:48:08 +0000 Subject: 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(-) (limited to 'lib') 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++; } -- cgit v1.2.3