cmogstored 1.8.1 - use default system stack size
[cmogstored.git] / fadvise.h
blobe7a9ff99dc0096fa36a1861cba20a7e7b1982082
1 /*
2 * Copyright (C) 2012-2020 all contributors <cmogstored-public@yhbt.net>
3 * License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
4 */
5 #if defined(HAVE_POSIX_FADVISE)
6 static inline void mog_fadv_sequential(int fd, off_t offset, off_t len)
8 int rc = posix_fadvise(fd, offset, len, POSIX_FADV_SEQUENTIAL);
10 if (rc == 0) return;
12 assert(errno != EBADF && errno != ESPIPE &&
13 "BUG: posix_fadvise(POSIX_FADV_SEQUENTIAL) failed");
16 static inline void mog_fadv_noreuse(int fd, off_t offset, off_t len)
18 int rc = posix_fadvise(fd, offset, len, POSIX_FADV_NOREUSE);
20 if (rc == 0) return;
22 assert(errno != EBADF && errno != ESPIPE &&
23 "BUG: posix_fadvise(POSIX_FADV_NOREUSE) failed");
25 #else
26 static inline void mog_fadv_sequential(int fd, off_t offset, off_t len)
29 static inline void mog_fadv_noreuse(int fd, off_t offset, off_t len)
32 #endif