BarsMonster
BarsMonster

Reputation: 6585

Perl: Opening file without write cache

I know that modern *nix OSes allow to open file so that data are not cached in system/disk writecache, so any write operation will finish only when data is phisically written to disk.

Could you suggest how can I do that in Perl?

OS is AIX/Solaris.

Upvotes: 2

Views: 677

Answers (1)

Optimal Cynic
Optimal Cynic

Reputation: 797

Use the sysopen function with O_SYNC as one of the flags. Check in the system manpages for the supported flags (man 2 open). I know it's there on Solaris 10, not sure about AIX. For example:

sysopen(FH, $path, O_SYNC | O_WRONLY | O_CREAT)

See http://perldoc.perl.org/functions/sysopen.html for more information.

Upvotes: 6

Related Questions