summaryrefslogtreecommitdiff
path: root/luxio.c
diff options
context:
space:
mode:
authorRob Kendrick (trite) <rjek@rjek.com>2014-05-15 18:55:02 +0100
committerRob Kendrick (trite) <rjek@rjek.com>2014-05-15 18:55:02 +0100
commit135b5b5ba023df9ee675b82e322fe4963adc3e83 (patch)
tree00a837631299c064eb4a76eb8d969fb909d12b57 /luxio.c
parente0e45e8ed374d1b3d9b8dc817b8168a069225ef1 (diff)
downloadluxio-135b5b5ba023df9ee675b82e322fe4963adc3e83.tar.bz2
posix_fadvise binding, fix indentation
Diffstat (limited to 'luxio.c')
-rw-r--r--luxio.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/luxio.c b/luxio.c
index 919ff6d..69e86b6 100644
--- a/luxio.c
+++ b/luxio.c
@@ -1885,6 +1885,20 @@ luxio_fcntl(lua_State *L) /* 6.5.2 */
return 0; /* never get here, but keep compiler happy */
}
+#if _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L
+static int
+luxio_posix_fadvise(lua_State *L)
+{
+ int fd = luaL_checkint(L, 1);
+ off_t offset = luaL_checkint(L, 2);
+ off_t len = luaL_checkint(L, 3);
+ int advice = luaL_checkint(L, 4);
+
+ lua_pushinteger(L, posix_fadvise(fd, offset, len, advice));
+ return 1;
+}
+#endif
+
#ifdef _LARGEFILE64_SOURCE
static int
luxio_lseek(lua_State *L) /* 6.5.3 */
@@ -3911,6 +3925,10 @@ luxio_functions[] = {
{ "iconv_open", luxio_iconv_open },
{ "iconv_close", luxio_iconv_close },
{ "iconv", luxio_iconv },
+
+#if _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L
+ { "posix_fadvise", luxio_posix_fadvise },
+#endif
{ NULL, NULL }
};