private static Status readCommStatus(FileDescriptor comm, byte[] buf) {
   try {
     int n = Os.read(comm, buf, 0, buf.length);
     if (n == 0) {
       return new Status(-2);
     }
     int status = Memory.peekInt(buf, 0, ByteOrder.BIG_ENDIAN);
     if (status == MODE_WORLD_READABLE) {
       return new Status(status, new String(buf, 4, n - 4));
     }
     return new Status(status);
   } catch (ErrnoException e) {
     if (e.errno == OsConstants.EAGAIN) {
       return null;
     }
     Log.d(TAG, "Failed to read status; assuming dead: " + e);
     return new Status(-2);
   } catch (ErrnoException e2) {
     Log.d(TAG, "Failed to read status; assuming dead: " + e2);
     return new Status(-2);
   }
 }