And fix pci_system_cleanup() to make it possible to call pci_system_init()
again.
ok kettenis at openbsd.
#include "pciaccess.h"
#include "pciaccess_private.h"
-static int pcifd;
+static int pcifd = -1;
static int aperturefd = -1;
static int
{
close(aperturefd);
close(pcifd);
+ aperturefd = -1;
+ pcifd = -1;
free(pci_sys);
pci_sys = NULL;
}
int bus, dev, func, ndevs, nfuncs;
uint32_t reg;
+ if (pcifd != -1)
+ return 0;
+
pcifd = open("/dev/pci", O_RDWR);
if (pcifd == -1)
return ENXIO;