Software /
code /
prosody
Comparison
util-src/pposix.c @ 5814:5cf1c08805fb
Merge 0.9->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 03 Sep 2013 00:20:28 +0100 |
parent | 5777:c98f11bcd0ea |
parent | 5812:57ebf93ec720 |
child | 5928:1f6923702fc3 |
comparison
equal
deleted
inserted
replaced
5809:be997c6a69be | 5814:5cf1c08805fb |
---|---|
34 #include "lua.h" | 34 #include "lua.h" |
35 #include "lualib.h" | 35 #include "lualib.h" |
36 #include "lauxlib.h" | 36 #include "lauxlib.h" |
37 | 37 |
38 #include <fcntl.h> | 38 #include <fcntl.h> |
39 #if defined(_GNU_SOURCE) | 39 #if defined(__linux__) && defined(_GNU_SOURCE) |
40 #include <linux/falloc.h> | 40 #include <linux/falloc.h> |
41 #endif | 41 #endif |
42 | 42 |
43 #if (defined(_SVID_SOURCE) && !defined(WITHOUT_MALLINFO)) | 43 #if (defined(_SVID_SOURCE) && !defined(WITHOUT_MALLINFO)) |
44 #include <malloc.h> | 44 #include <malloc.h> |
678 FILE *f = *(FILE**) luaL_checkudata(L, 1, LUA_FILEHANDLE); | 678 FILE *f = *(FILE**) luaL_checkudata(L, 1, LUA_FILEHANDLE); |
679 | 679 |
680 offset = luaL_checkinteger(L, 2); | 680 offset = luaL_checkinteger(L, 2); |
681 len = luaL_checkinteger(L, 3); | 681 len = luaL_checkinteger(L, 3); |
682 | 682 |
683 #if defined(_GNU_SOURCE) | 683 #if defined(__linux__) && defined(_GNU_SOURCE) |
684 if(fallocate(fileno(f), FALLOC_FL_KEEP_SIZE, offset, len) == 0) | 684 if(fallocate(fileno(f), FALLOC_FL_KEEP_SIZE, offset, len) == 0) |
685 { | 685 { |
686 lua_pushboolean(L, 1); | 686 lua_pushboolean(L, 1); |
687 return 1; | 687 return 1; |
688 } | 688 } |