diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2014-02-15 09:48:08 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2014-02-15 09:48:08 +0000 |
commit | 08365170fe856b1fc080a960c3aac1eda17d8697 (patch) | |
tree | 678594056fc8e4e56e3d9d9c4e405a8c14205026 /lib | |
parent | 937a539c87f0bf191990b7e98e0b027226807e89 (diff) |
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@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libpciaccess/src/openbsd_pci.c | 7 |
1 files 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++; } |