G'day bernuli,
Welcome to the Monastery.
I haven't had a macOS system for some years, so I'm unable to test this for you; also, I don't recall ever using F_NOCACHE or seeing it documented.
The following is a possible workaround. This is on v5.36 but using Cygwin; I'm not expecting F_NOCACHE to be found. I ran some demo tests using this common alias of mine which reports many types of problems:
$ alias perle alias perle='perl -Mstrict -Mwarnings -Mautodie=:all -MCarp::Always -E +'
O_RDONLY is exported by default but F_NOCACHE is not:
$ perle 'use Fcntl; say O_RDONLY' 0 $ perle 'use Fcntl; say O_RDONLY; say F_NOCACHE' Name "main::F_NOCACHE" used only once: possible typo at -e line 1. 0 say() on unopened filehandle F_NOCACHE at -e line 1.
F_NOCACHE cannot be explicitly imported:
$ perle 'use Fcntl qw{O_RDONLY F_NOCACHE}; say O_RDONLY; say F_NOCACHE +' "F_NOCACHE" is not exported by the Fcntl module Can't continue after import errors at -e line 1. main::BEGIN() called at -e line 1 eval {...} called at -e line 1 BEGIN failed--compilation aborted at -e line 1.
I can fake it like this (i.e. the "possible workaround"):
$ perle 'use Fcntl; use constant F_NOCACHE => 48; say O_RDONLY; say F_ +NOCACHE' 0 48 $ perle 'use Fcntl; use constant F_NOCACHE => 48; say O_RDONLY | F_NOC +ACHE' 48 $ perle 'use Fcntl; use enum qw{F_NOCACHE=48}; say O_RDONLY; say F_NOC +ACHE' 0 48 $ perle 'use Fcntl; use enum qw{F_NOCACHE=48}; say O_RDONLY | F_NOCACH +E' 48
I've no idea idea if sysopen will accept that on your system. Curiously, it doesn't complain on mine:
$ perle 'use Fcntl; use enum qw{F_NOCACHE=48}; sysopen my $fh, "dummy_ +file", O_RDONLY | F_NOCACHE; close $fh'
I don't know if there's a way to build Perl such that F_NOCACHE is recognised but someone else might. To help with that, tell us how you built the current Perl you're using. It may also be helpful to show the output of `perl -V` (that's a capital V).
— Ken
In reply to Re: macOS Fcntl.pm missing F_NOCACHE
by kcott
in thread macOS Fcntl.pm missing F_NOCACHE
by bernuli
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |