summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2022-01-09 01:09:04 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-01-09 01:09:04 +0100
commit740d2f29700af38b01ca68e3e834db164cc1b789 (patch)
tree3eea0177fd21765de583c59bac2a71dfc3bf2166
parent3e0d1cde01872d605c267c61094e44315a3e7467 (diff)
downloadlibpciaccess-740d2f29700af38b01ca68e3e834db164cc1b789.tar.gz
hurd: Restore initialization order
3e0d1cde0187 ("hurd: Implement device memory mapping") was making root-running processes insist on using the pci device, and never try the fs-provided translator. This reverts back to trying the pci device first, but completely, and then revert to the fs-provided translator.
-rw-r--r--src/hurd_pci.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/hurd_pci.c b/src/hurd_pci.c
index ce96cbe..70a9f89 100644
--- a/src/hurd_pci.c
+++ b/src/hurd_pci.c
@@ -637,18 +637,20 @@ pci_system_hurd_create(void)
pci_sys->num_devices = 0;
- if ((err = get_privileged_ports (NULL, &device_master))
- || (device_master == MACH_PORT_NULL)) {
- root = file_name_lookup (_SERVERS_BUS_PCI, O_RDONLY, 0);
- } else {
- err = device_open (device_master, D_READ, "pci", &pci_port);
- mach_port_deallocate (mach_task_self (), device_master);
- if (!err) {
- root = file_name_lookup_under (pci_port, ".",
- O_DIRECTORY | O_RDONLY | O_EXEC, 0);
- device_close (pci_port);
- mach_port_deallocate (mach_task_self (), pci_port);
- }
+ if ((err = get_privileged_ports (NULL, &device_master)) || (device_master == MACH_PORT_NULL)) {
+ pci_system_cleanup();
+ return err;
+ }
+
+ err = device_open (device_master, D_READ|D_WRITE, "pci", &pci_port);
+ if (!err) {
+ root = file_name_lookup_under (pci_port, ".", O_DIRECTORY | O_RDWR | O_EXEC, 0);
+ device_close (pci_port);
+ mach_port_deallocate (mach_task_self (), pci_port);
+ }
+
+ if (!root) {
+ root = file_name_lookup (_SERVERS_BUS_PCI, O_RDWR, 0);
}
if (!root) {