eden/fs/fuse/privhelper/PrivHelperServer.cpp
// The osxfuse kernel doesn't automatically assign a device, so we have
// to loop through the different units and attempt to allocate them,
// one by one.  Returns the fd and its unit number on success, throws
// an exception on error.
The osxfuse kernel doesn't automatically assign a device, so we have
to loop through the different units and attempt to allocate them,
one by one.  Returns the fd and its unit number on success, throws
an exception on error.
The osxfuse kernel doesn ' t automatically assign a device so we have to loop through the different units and attempt to allocate them one by one . Returns the fd and its unit number on success throws an exception on error .
std::pair<folly::File, int> allocateFuseDevice() {
  ensureFuseKextIsLoaded();
  int fd = -1;
  const int nDevices = OSXFUSE_NDEVICES;
  int dindex;
  for (dindex = 0; dindex < nDevices; dindex++) {
    auto devName = folly::to<std::string>("/dev/osxfuse", dindex);
    fd = folly::openNoInt(devName.c_str(), O_RDWR | O_CLOEXEC);
    if (fd >= 0) {
      return std::make_pair(folly::File{fd, true}, dindex);
    }
    if (errno == EBUSY) {
      continue;
    }
    if (errno == ENODEV || errno == ENOENT) {
      throwSystemError(
          "failed to open ",
          devName,
          ": make sure the osxfuse kernel module is loaded");
    } else {
      throwSystemError("failed to open ", devName);
    }
  }
  throwSystemError(
      "unable to allocate an osxfuse device, "
      "either all instances are busy or the kernel module is not loaded");
}
std :: pair < folly :: File , int > allocateFuseDevice ( ) { ensureFuseKextIsLoaded ( ) ; int fd = -1 ; const int nDevices = OSXFUSE_NDEVICES ; int dindex ; for ( dindex = 0 ; dindex < nDevices ; dindex ++ ) { auto devName = folly :: to < std :: string > ( " " , dindex ) ; fd = folly :: openNoInt ( devName . c_str ( ) , O_RDWR | O_CLOEXEC ) ; if ( fd >= 0 ) { return std :: make_pair ( folly :: File { fd , true } , dindex ) ; } if ( errno == EBUSY ) { continue ; } if ( errno == ENODEV || errno == ENOENT ) { throwSystemError ( " " , devName , " " ) ; } else { throwSystemError ( " " , devName ) ; } } throwSystemError ( " " " " ) ; }
The osxfuse kernel doesn't automatically assign a device, so we have
to loop through the different units and attempt to allocate them,
one by one.
The osxfuse kernel doesn ' t automatically assign a device so we have to loop through the different units and attempt to allocate them one by one .