On Sun, May 30, 2021 at 04:39:48PM +1200, Thomas Munro wrote:
> +BasicOpenFilePermDirect(const char *fileName, int fileFlags, mode_t fileMode,
> + bool direct)
> ...
> +#if !defined(O_DIRECT) && defined(F_NOCACHE)
> + /* macOS requires an extra step. */
> + if (direct && fcntl(fd, F_NOCACHE, 1) < 0)
> + {
> + int save_errno = errno;
> +
> + close(fd);
> + errno = save_errno;
> + ereport(ERROR,
> + (errcode_for_file_access(),
> + errmsg("could not disable kernel file caching for file \"%s\": %m",
> + fileName)));
> + }
> +#endif
Should there be an "else" to warn/error in the case that "direct" is requested
but not supported?
--
Justin