Comparison

util-src/pposix.c @ 5052:f1157cce5d7a

util.pposix: Warn about posix_fallocate
author Kim Alvefur <zash@zash.se>
date Sun, 29 Jul 2012 22:21:58 +0200
parent 5044:4ef0dbfead53
child 5067:7db1056c63a9
comparison
equal deleted inserted replaced
5051:71253db26fda 5052:f1157cce5d7a
662 len = luaL_checkinteger(L, 3); 662 len = luaL_checkinteger(L, 3);
663 663
664 #if defined(_GNU_SOURCE) 664 #if defined(_GNU_SOURCE)
665 if(fallocate(fileno(f), FALLOC_FL_KEEP_SIZE, offset, len) != 0) 665 if(fallocate(fileno(f), FALLOC_FL_KEEP_SIZE, offset, len) != 0)
666 #elif _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L 666 #elif _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L
667 #warning Using posix_fallocate() fallback. Linux fallocate() is strongly recommended if available: recompile with -D_GNU_SOURCE
667 if(posix_fallocate(fileno(f), offset, len) != 0) 668 if(posix_fallocate(fileno(f), offset, len) != 0)
668 #endif 669 #endif
669 { 670 {
670 #if ! defined(_GNU_SOURCE) 671 #if ! defined(_GNU_SOURCE)
671 /* posix_fallocate() can leave a bunch of NULs at the end, so we cut that 672 /* posix_fallocate() can leave a bunch of NULs at the end, so we cut that