开发者

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 phis开发者_如何学JAVAically written to disk.

Could you suggest how can I do that in Perl?

OS is AIX/Solaris.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜