public static ParcelFileDescriptor fromFd(int fd) throws IOException {
   FileDescriptor original = new FileDescriptor();
   original.setInt$(fd);
   try {
     return new ParcelFileDescriptor(Os.dup(original));
   } catch (ErrnoException e) {
     throw e.rethrowAsIOException();
   }
 }
  /**
   * Registers a server socket for zygote command connections
   *
   * @throws RuntimeException when open fails
   */
  private static void registerZygoteSocket(String socketName) {
    if (sServerSocket == null) {
      int fileDesc;
      final String fullSocketName = ANDROID_SOCKET_PREFIX + socketName;
      try {
        String env = System.getenv(fullSocketName);
        fileDesc = Integer.parseInt(env);
      } catch (RuntimeException ex) {
        throw new RuntimeException(fullSocketName + " unset or invalid", ex);
      }

      try {
        FileDescriptor fd = new FileDescriptor();
        fd.setInt$(fileDesc);
        sServerSocket = new LocalServerSocket(fd);
      } catch (IOException ex) {
        throw new RuntimeException("Error binding to local socket '" + fileDesc + "'", ex);
      }
    }
  }
 public static ParcelFileDescriptor adoptFd(int fd) {
   FileDescriptor fdesc = new FileDescriptor();
   fdesc.setInt$(fd);
   return new ParcelFileDescriptor(fdesc);
 }