- 论坛徽章:
- 0
|
回复 #1 basten54188 的帖子
我的版本不支持O_NOATIME。但是从网上的一些资料可以看到:
O_NOATIME
(Since Linux 2.6. Do not update the file last access time 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
filesystems. One example is NFS, where the server maintains the
access time.
The O_NOATIME, O_NOFOLLOW, and O_DIRECTORY flags are Linux-specific.
One may have to define the _GNU_SOURCE macro to get their definitions.
来自:https://mailman.cs.tut.fi/pipermail/aide/2005-August/000149.html
通过这个来看,应该是2.6.8以后的内核才支持的功能。
来自:http://sourceware.org/ml/libc-hacker/2004-08/msg00068.html
这个是04年的帖子,说明04年以后发布的C库才支持。
我的系统里:
#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. */
#endif
对应的头文件为: /usr/include/bits/fcntl.h
不知道你的系统里是否支持,可以通过fcntl.h这个头文件判断。
同时注意到其前后的 #ifdef ,在你的代码中把那个宏#define一下就应该可以。 |
|