Software /
code /
prosody
Comparison
util-src/pposix.c @ 5812:57ebf93ec720
util.pposix: Fix building on non-Linux with glibc
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 02 Sep 2013 18:19:38 +0200 |
parent | 5717:bf98912a4f5b |
child | 5814:5cf1c08805fb |
child | 5927:49e3c49eb0d8 |
comparison
equal
deleted
inserted
replaced
5811:27ae988f5b70 | 5812:57ebf93ec720 |
---|---|
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> |
668 FILE *f = *(FILE**) luaL_checkudata(L, 1, LUA_FILEHANDLE); | 668 FILE *f = *(FILE**) luaL_checkudata(L, 1, LUA_FILEHANDLE); |
669 | 669 |
670 offset = luaL_checkinteger(L, 2); | 670 offset = luaL_checkinteger(L, 2); |
671 len = luaL_checkinteger(L, 3); | 671 len = luaL_checkinteger(L, 3); |
672 | 672 |
673 #if defined(_GNU_SOURCE) | 673 #if defined(__linux__) && defined(_GNU_SOURCE) |
674 if(fallocate(fileno(f), FALLOC_FL_KEEP_SIZE, offset, len) == 0) | 674 if(fallocate(fileno(f), FALLOC_FL_KEEP_SIZE, offset, len) == 0) |
675 { | 675 { |
676 lua_pushboolean(L, 1); | 676 lua_pushboolean(L, 1); |
677 return 1; | 677 return 1; |
678 } | 678 } |