/** * Basic constructor. */ protected NativeFile() { this(new NativeLibc()); }
/** * Create a NativeFile object and open the associated file/device * for native access. * * @param fname the name of the file to open * @param flags Linux style file access flags * @param mode Linux style file access mode * @throws LastErrorException when operations fails */ public NativeFile(@NonNull String fname, int flags, int mode) throws LastErrorException { this(fname, flags, mode, new NativeLibc()); }
/** * Create a NativeFile object and open the associated file/device * for native access. * * @param fname the name of the file to open * @param flags Linux style file access flags * @throws LastErrorException when operations fails */ public NativeFile(@NonNull String fname, int flags) throws LastErrorException { this(fname, flags, new NativeLibc()); }
/** * <p>Initialize real on-brick display.</p> * <p><b>BEWARE:</b> this function may be called only once, * otherwise the behavior is undefined.</p> * * @return new instance of display appropriate for the current session * @throws RuntimeException initialization of the display fails */ public static DisplayInterface initializeRealDisplay() { ILibc libc = new NativeLibc(); LOGGER.debug("initializing new real display"); try { return new OwnedDisplay(libc); } catch (LastErrorException e) { int errno = e.getErrorCode(); if (errno == NativeConstants.ENOTTY || errno == NativeConstants.ENXIO) { LOGGER.debug("real display init failed, but it was caused by not having a real TTY, using fake console"); // we do not run from Brickman return new StolenDisplay(libc); } else { throw e; } } }