Java Code Examples for android.system.OsConstants#EINVAL

The following examples show how to use android.system.OsConstants#EINVAL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IpSecManager.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private static void maybeHandleServiceSpecificException(ServiceSpecificException sse) {
    // OsConstants are late binding, so switch statements can't be used.
    if (sse.errorCode == OsConstants.EINVAL) {
        throw new IllegalArgumentException(sse);
    } else if (sse.errorCode == OsConstants.EAGAIN) {
        throw new IllegalStateException(sse);
    } else if (sse.errorCode == OsConstants.EOPNOTSUPP) {
        throw new UnsupportedOperationException(sse);
    }
}
 
Example 2
Source File: SysUtil.java    From SoLoader with Apache License 2.0 5 votes vote down vote up
@DoNotOptimize
public static void fallocateIfSupported(FileDescriptor fd, long length) throws IOException {
  try {
    Os.posix_fallocate(fd, 0, length);
  } catch (ErrnoException ex) {
    if (ex.errno != OsConstants.EOPNOTSUPP
        && ex.errno != OsConstants.ENOSYS
        && ex.errno != OsConstants.EINVAL) {
      throw new IOException(ex.toString(), ex);
    }
  }
}
 
Example 3
Source File: ProxyFileDescriptorCallback.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Ensures all the written data are stored in permanent storage device.
 * For example, if it has data stored in on memory cache, it needs to flush data to storage
 * device.
 * @throws ErrnoException ErrnoException containing E constants in OsConstants.
 */
public void onFsync() throws ErrnoException {
    throw new ErrnoException("onFsync", OsConstants.EINVAL);
}