Project

General

Profile

Actions

Feature #1377

closed

Please provide constant File::NOATIME

Added by walles (Johan Walles) about 15 years ago. Updated about 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:23194]

Description

=begin
I would like to be able to specify File::NOATIME mode when opening a file through File.new():

irb(main):001:0> f = File.new("file", File::RDONLY|File::NOATIME)
NameError: uninitialized constant File::NOATIME
from (irb):1
from :0

From the open(2) man page:
O_NOATIME (Since Linux 2.6.8)
Do not update the file last access time (st_atime in the inode) when the file is read(2). This flag is intended for
use by indexing or backup programs, where its use can significantly reduce the amount of disk activity. This flag
may not be effective on all file systems. One example is NFS, where the server maintains the access time.

Here's the definition of O_NOATIME from /usr/include/bits/fcntl.h:
#ifdef __USE_GNU

define O_DIRECT 040000 /* Direct disk access. */

define O_DIRECTORY 0200000 /* Must be a directory. */

define O_NOFOLLOW 0400000 /* Do not follow links. */

define O_NOATIME 01000000 /* Do not set atime. */

define O_CLOEXEC 02000000 /* Set close_on_exec. */

#endif

Thanks //Johan

Note to self: This is the upstream report for http://bugs.debian.org/518716
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0