src/os.cc
// Open a PCI bus-dev-func as a file and return its file descriptor.
// Error is indicated by return value less than zero.
Open a PCI bus-dev-func as a file and return its file descriptor.
Error is indicated by return value less than zero.
Open a PCI bus - dev - func as a file and return its file descriptor . Error is indicated by return value less than zero .
int OsLayer::PciOpen(int bus, int device, int function) {
  char dev_file[256];
  snprintf(dev_file, sizeof(dev_file), "/proc/bus/pci/%02x/%02x.%x",
           bus, device, function);
  int fd = open(dev_file, O_RDWR);
  if (fd == -1) {
    logprintf(0, "Process Error: Unable to open PCI bus %d, device %d, "
                 "function %d (errno %d).\n",
              bus, device, function, errno);
    return -1;
  }
  return fd;
}
int OsLayer :: PciOpen ( int bus , int device , int function ) { char dev_file [ 256 ] ; snprintf ( dev_file , sizeof ( dev_file ) , " " , bus , device , function ) ; int fd = open ( dev_file , O_RDWR ) ; if ( fd == -1 ) { logprintf ( 0 , " " " \n " , bus , device , function , errno ) ; return -1 ; } return fd ; }
Open a PCI bus-dev-func as a file and return its file descriptor.
Open a PCI bus - dev - func as a file and return its file descriptor .