public int oDirectOpen(String pathname, boolean readOnly) throws IOException {
        int flags = OpenFlags.INSTANCE.oDIRECT();
        if (readOnly) {
            flags |= OpenFlags.INSTANCE.oRDONLY();
        } else {
            flags |= OpenFlags.INSTANCE.oRDWR() | OpenFlags.INSTANCE.oCREAT();
        }
        int fd = open(pathname, flags, 00644);
        if (fd < 0) {
            throw new IOException("Error opening " + pathname + ", got " + getLastError());
        }
        return fd;
    }
Use the <tt>open</tt> Linux system call and pass in the <tt>O_DIRECT</tt> flag.
Currently the only other flags passed in are <tt>O_RDONLY</tt> if <tt>readOnly</tt>
is <tt>true</tt>, and (if not) <tt>O_RDWR</tt> and <tt>O_CREAT</tt>.

@param pathname The path to the file to open. If file does not exist and we are opening
                with <tt>readOnly</tt>, this will throw an error. Otherwise, if it does
                not exist but we have <tt>readOnly</tt> set to false, create the file.
@param readOnly Whether to pass in <tt>O_RDONLY</tt>
@return An integer file descriptor for the opened file
s3stream/src/main/java/com/automq/stream/thirdparty/moe/cnkirito/kdio/DirectIOLib.java