diff --git a/HISTORY b/HISTORY index fd99931..b745b96 100644 --- a/HISTORY +++ b/HISTORY @@ -1,8 +1,9 @@ -Version 5.12 2017-10-16 +Version 5.12 2018-05-23 * code refine for rare case * replace print format OFF_PRINTF_FORMAT to PRId64 * php_ext fix zend_object_store_get_object call in php5.5 + * make.sh uses macros define in /usr/include/fastcommon/_os_define.h Version 5.11 2017-05-26 * bug fixed: file_offset has no effect when use trunk file diff --git a/client/Makefile.in b/client/Makefile.in index 6140564..7d702ee 100644 --- a/client/Makefile.in +++ b/client/Makefile.in @@ -52,7 +52,7 @@ all: $(ALL_OBJS) $(ALL_PRGS) $(ALL_LIBS) libfdfsclient.so: $(COMPILE) -o $@ $< -shared $(FDFS_SHARED_OBJS) $(LIB_PATH) libfdfsclient.a: - ar cru $@ $< $(FDFS_STATIC_OBJS) + ar rcs $@ $< $(FDFS_STATIC_OBJS) .o: $(COMPILE) -o $@ $< $(STATIC_OBJS) $(LIB_PATH) $(INC_PATH) .c: diff --git a/make.sh b/make.sh index 2514884..4a3ed1e 100755 --- a/make.sh +++ b/make.sh @@ -1,51 +1,3 @@ -tmp_src_filename=fdfs_check_bits.c -cat < $tmp_src_filename -#include -#include -#include -int main() -{ - printf("%d\n", (int)sizeof(long)); - printf("%d\n", (int)sizeof(off_t)); - return 0; -} -EOF - -gcc -D_FILE_OFFSET_BITS=64 -o a.out $tmp_src_filename -output=$(./a.out) - -if [ -f /bin/expr ]; then - EXPR=/bin/expr -else - EXPR=/usr/bin/expr -fi - -count=0 -int_bytes=4 -off_bytes=8 -for col in $output; do - if [ $count -eq 0 ]; then - int_bytes=$col - else - off_bytes=$col - fi - - count=$($EXPR $count + 1) -done - -/bin/rm -f a.out $tmp_src_filename -if [ "$int_bytes" -eq 8 ]; then - OS_BITS=64 -else - OS_BITS=32 -fi - -if [ "$off_bytes" -eq 8 ]; then - OFF_BITS=64 -else - OFF_BITS=32 -fi - ENABLE_STATIC_LIB=0 ENABLE_SHARED_LIB=1 TARGET_PREFIX=$DESTDIR/usr @@ -58,16 +10,30 @@ DEBUG_FLAG=1 CFLAGS='-Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE' if [ "$DEBUG_FLAG" = "1" ]; then - CFLAGS="$CFLAGS -g -O -DDEBUG_FLAG" + CFLAGS="$CFLAGS -g -O1 -DDEBUG_FLAG" else CFLAGS="$CFLAGS -O3" fi +if [ -f /usr/include/fastcommon/_os_define.h ]; then + OS_BITS=$(fgrep OS_BITS /usr/include/fastcommon/_os_define.h | awk '{print $NF;}') +elif [ -f /usr/local/include/fastcommon/_os_define.h ]; then + OS_BITS=$(fgrep OS_BITS /usr/local/include/fastcommon/_os_define.h | awk '{print $NF;}') +else + OS_BITS=64 +fi + +if [ "$OS_BITS" -eq 64 ]; then + LIB_VERSION=lib64 +else + LIB_VERSION=lib +fi + LIBS='' uname=$(uname) if [ "$uname" = "Linux" ]; then - if [ $OS_BITS -eq 64 ]; then + if [ "$OS_BITS" -eq 64 ]; then LIBS="$LIBS -L/usr/lib64" else LIBS="$LIBS -L/usr/lib" diff --git a/storage/trunk_mgr/trunk_mem.c b/storage/trunk_mgr/trunk_mem.c index b0a051f..95d078a 100644 --- a/storage/trunk_mgr/trunk_mem.c +++ b/storage/trunk_mgr/trunk_mem.c @@ -1710,7 +1710,7 @@ static int trunk_wait_file_ready(const char *filename, const int64_t file_size, return 0; } - if (abs(g_current_time - file_mtime) > 10) + if (labs(g_current_time - file_mtime) > 10) { return ETIMEDOUT; }