Coder Social home page Coder Social logo

happyfish100 / libfastcommon Goto Github PK

View Code? Open in Web Editor NEW
894.0 74.0 525.0 2.1 MB

c common functions library extracted from my open source project FastDFS. this library is very simple and stable. functions including: string, logger, chain, hash, socket, ini file reader, base64 encode / decode, url encode / decode, fast timer, skiplist, object pool etc. detail info please see the c header files.

Home Page: http://bbs.chinaunix.net/forum-240-1.html

License: GNU Lesser General Public License v3.0

Shell 0.46% C 98.51% PHP 0.59% Makefile 0.40% M4 0.04%
c-library fastdfs id-generator ini-parser skiplist avl-tree object-pool connection-pool socket-io process-control

libfastcommon's Introduction

Copyright (C) 2010 Happy Fish / YuQing

libfastcommon may be copied only under the terms of the Less GNU General
Public License(LGPL).
Please visit the libfastcommon Home Page for more detail.
English language: https://github.com/happyfish100/libfastcommon
Chinese language: http://www.fastken.com/


c common functions library extracted from my open source projects FastDFS and 
FastDHT. this library is very simple and stable.

some functions are wrappered into php extension, such as fastcommon_gethostaddrs,
     fastcommon_id_generator_xxx, fastcommon_get_ifconfigs, fastcommon_get_sysinfo etc.

C function including:
  logger: [logger.h] asynchronously sync to disk for high performance, thread safe,
          log rotate, auto delete old log files, compress log file etc.

  ini file reader: [ini_file_reader.h] support sections marked by [SectionName]
          support a config item ocurs multiple times for multiple values, such as:
             tracker_server = ip1
             tracker_server = ip2
          #include directive to include other ini file
          #@function directive for annotation
          #@set directive to set variables for condition of #@if directive
          support control statements for special purpose as:
              #@if, #@else, #@endif, #@for, #@endfor

  id generator: [id_generator.h] generate unique 64 bits integer ID for multi processes

  string operation: [shared_func.h] uppercase, lowercase, trim etc.

  base64 encode / decode: [base64.h] for standard base64 or variable base64

  url encode / decode: [shared_func.h]

  md5 encode: [md5.h]

  hash: [hash.h] hash table

  chain: [chain.h] singly linked list

  blocked queue: [fast_blocked_queue.h]

  avl tree: [avl_tree.h] AVL tree

  skiplist: [skiplist.h] [flat_skiplist.h] [multi_skiplist.h] flat skiplist and multi skiplist

  socket: [sockopt.h] socket wrapper for connect, recv, send etc. support IPv6

  ioevent: [ioevent.h] [ioevent_loop.h] like epoll (support Linux, FreeBSD and SunOS),

  io buffer management: [fast_task_queue.h] for network io buffer

  memory pool: [fast_mpool.h]

  object based allocator: [fast_mblock.h]

  connection pool: [connection_pool.h]

  time wheel based timer: [fast_timer.h] for network timeout management, very high performance

  local ip functions: [local_ip_func.h] get local ipv4 addresses

  system info functions: [system_info.h] get cpu count, memory size, system load,
          mounted filesystems and processes info etc.

  process control: [process_ctrl.h] for process start/stop/restart control

  task schedule: [sched_thread.h] task shedule management/thead for repeat tasks

  char convert: [char_converter.h] and [char_convert_loader.h] for fast char convert

detail info please see the c header files.

libfastcommon's People

Contributors

agile6v avatar hanyunqi avatar happyfish100 avatar lichhao avatar sunqiangwei1988 avatar tfzxyinhao avatar vazmin avatar zhangchunsheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libfastcommon's Issues

libfastcommon 编译 出现 nm: '/usr/lib/libc_r.so': No such file

直接通过 git clone https://github.com/happyfish100/libfastcommon.git --depth 1
执行make.sh出现错误
./make.sh: line 172: warning: here-document at line 2 delimited by end-of-file (wanted `EOF')
./make.sh: line 2: ./a.out: No such file or directory
./make.sh: line 2: +: command not found
nm: '/usr/lib/libc_r.so': No such file

在国产麒麟操作系统中执行启动tracker命令报错

[2019-02-21 15:03:18] INFO - FastDFS v5.11, base_path=/data/fastdfs/tracker, run_by_group=, run_by_user=, connect_timeout=30s, network_timeout=60s, port=22122, bind_addr=, max_connections=256, accept_threads=1, work_threads=4, min_buff_size=8192, max_buff_size=131072, store_lookup=2, store_group=, store_server=0, store_path=0, reserved_storage_space=10.00%, download_server=0, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interval=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1, storage_sync_file_max_delay=86400s, storage_sync_file_max_time=300s, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size=64 MB, trunk_create_file_advance=0, trunk_create_file_time_base=02:00, trunk_create_file_interval=86400, trunk_create_file_space_threshold=20 GB, trunk_init_check_occupying=0, trunk_init_reload_from_binlog=0, trunk_compress_binlog_min_interval=0, use_storage_id=0, id_type_in_filename=ip, storage_id_count=0, rotate_error_log=0, error_log_rotate_time=00:00, rotate_error_log_size=0, log_file_keep_days=0, store_slave_file_use_link=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s
[2019-02-21 15:03:18] ERROR - file: pthread_func.c, line: 120, call pthread_attr_setstacksize to 65536 fail, errno: 22, error info: Invalid argument
[2019-02-21 15:03:18] ERROR - file: tracker_service.c, line: 78, init_pthread_attr fail, program exit!
[2019-02-21 15:03:18] CRIT - exit abnormally!

Got a SIGABRT when calling fds_client_init with a nonexistent conf file

auto result = fdfs_client_init("/etc/fdf/client.conf");
I compiled it on ubuntu with gcc 6.2, and my program crashed.
I guess there may be something wrong with your usage of calling sprintf.

The dump log is here:
*** buffer overflow detected ***: ./test_fdfs terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7329f)[0x7f56e4a7e29f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f56e4b15bbc]
/lib/x86_64-linux-gnu/libc.so.6(+0x109a90)[0x7f56e4b14a90]
/lib/x86_64-linux-gnu/libc.so.6(+0x108f99)[0x7f56e4b13f99]
/lib/x86_64-linux-gnu/libc.so.6(_IO_default_xsputn+0xbc)[0x7f56e4a8660c]
/lib/x86_64-linux-gnu/libc.so.6(_IO_vfprintf+0xd0)[0x7f56e4a54d10]
/lib/x86_64-linux-gnu/libc.so.6(__vsprintf_chk+0x84)[0x7f56e4b14024]
/lib/x86_64-linux-gnu/libc.so.6(__sprintf_chk+0x7d)[0x7f56e4b13f7d]
/usr/lib/libfastcommon.so(log_it_ex2+0x1a0)[0x7f56e45c9090]
/usr/lib/libfastcommon.so(logError+0x130)[0x7f56e45ca830]
/usr/lib/libfastcommon.so(getFileContent+0x214)[0x7f56e45bee64]
/usr/lib/libfastcommon.so(+0x12112)[0x7f56e45c4112]
/usr/lib/libfastcommon.so(iniLoadFromFileEx+0x4c2)[0x7f56e45c59c2]
/usr/lib/libfdfsclient.so(fdfs_client_init_ex+0x31)[0x7f56e50ef69c]
./test_fdfs(main+0x32)[0x400b78]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f56e4a2cf45]
./test_fdfs[0x400a79]
======= Memory map: ========
00400000-00401000 r-xp 00000000 08:02 6584315 /home/buke/programming/test/build/test_fdfs
00601000-00602000 r--p 00001000 08:02 6584315 /home/buke/programming/test/build/test_fdfs
00602000-00603000 rw-p 00002000 08:02 6584315 /home/buke/programming/test/build/test_fdfs
02135000-02167000 rw-p 00000000 00:00 0 [heap]
7f56e4095000-7f56e40ab000 r-xp 00000000 08:02 4195223 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f56e40ab000-7f56e42aa000 ---p 00016000 08:02 4195223 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f56e42aa000-7f56e42ab000 r--p 00015000 08:02 4195223 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f56e42ab000-7f56e42ac000 rw-p 00016000 08:02 4195223 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f56e42ac000-7f56e43b1000 r-xp 00000000 08:02 4194403 /lib/x86_64-linux-gnu/libm-2.19.so
7f56e43b1000-7f56e45b0000 ---p 00105000 08:02 4194403 /lib/x86_64-linux-gnu/libm-2.19.so
7f56e45b0000-7f56e45b1000 r--p 00104000 08:02 4194403 /lib/x86_64-linux-gnu/libm-2.19.so
7f56e45b1000-7f56e45b2000 rw-p 00105000 08:02 4194403 /lib/x86_64-linux-gnu/libm-2.19.so
7f56e45b2000-7f56e45eb000 r-xp 00000000 08:02 8150219 /usr/lib/libfastcommon.so
7f56e45eb000-7f56e47ea000 ---p 00039000 08:02 8150219 /usr/lib/libfastcommon.so
7f56e47ea000-7f56e47eb000 r--p 00038000 08:02 8150219 /usr/lib/libfastcommon.so
7f56e47eb000-7f56e47ec000 rw-p 00039000 08:02 8150219 /usr/lib/libfastcommon.so
7f56e47ec000-7f56e47ed000 rw-p 00000000 00:00 0
7f56e47ed000-7f56e4806000 r-xp 00000000 08:02 4195432 /lib/x86_64-linux-gnu/libpthread-2.19.so
7f56e4806000-7f56e4a05000 ---p 00019000 08:02 4195432 /lib/x86_64-linux-gnu/libpthread-2.19.so
7f56e4a05000-7f56e4a06000 r--p 00018000 08:02 4195432 /lib/x86_64-linux-gnu/libpthread-2.19.so
7f56e4a06000-7f56e4a07000 rw-p 00019000 08:02 4195432 /lib/x86_64-linux-gnu/libpthread-2.19.so
7f56e4a07000-7f56e4a0b000 rw-p 00000000 00:00 0
7f56e4a0b000-7f56e4bc5000 r-xp 00000000 08:02 4198551 /lib/x86_64-linux-gnu/libc-2.19.so
7f56e4bc5000-7f56e4dc5000 ---p 001ba000 08:02 4198551 /lib/x86_64-linux-gnu/libc-2.19.so
7f56e4dc5000-7f56e4dc9000 r--p 001ba000 08:02 4198551 /lib/x86_64-linux-gnu/libc-2.19.so
7f56e4dc9000-7f56e4dcb000 rw-p 001be000 08:02 4198551 /lib/x86_64-linux-gnu/libc-2.19.so
7f56e4dcb000-7f56e4dd0000 rw-p 00000000 00:00 0
7f56e4dd0000-7f56e4ed6000 r-xp 00000000 08:02 8135222 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7f56e4ed6000-7f56e50d5000 ---p 00106000 08:02 8135222 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7f56e50d5000-7f56e50dd000 r--p 00105000 08:02 8135222 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7f56e50dd000-7f56e50df000 rw-p 0010d000 08:02 8135222 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7f56e50df000-7f56e50e2000 rw-p 00000000 00:00 0
7f56e50e2000-7f56e50f9000 r-xp 00000000 08:02 8150271 /usr/lib/libfdfsclient.so
7f56e50f9000-7f56e52f9000 ---p 00017000 08:02 8150271 /usr/lib/libfdfsclient.so
7f56e52f9000-7f56e52fa000 r--p 00017000 08:02 8150271 /usr/lib/libfdfsclient.so
7f56e52fa000-7f56e52fb000 rw-p 00018000 08:02 8150271 /usr/lib/libfdfsclient.so
7f56e52fb000-7f56e531e000 r-xp 00000000 08:02 4195434 /lib/x86_64-linux-gnu/ld-2.19.so
7f56e54fd000-7f56e5504000 rw-p 00000000 00:00 0
7f56e551a000-7f56e551d000 rw-p 00000000 00:00 0
7f56e551d000-7f56e551e000 r--p 00022000 08:02 4195434 /lib/x86_64-linux-gnu/ld-2.19.so
7f56e551e000-7f56e551f000 rw-p 00023000 08:02 4195434 /lib/x86_64-linux-gnu/ld-2.19.so
7f56e551f000-7f56e5520000 rw-p 00000000 00:00 0
7ffe370f2000-7ffe37113000 rw-p 00000000 00:00 0 [stack]
7ffe3711d000-7ffe3711f000 r--p 00000000 00:00 0 [vvar]
7ffe3711f000-7ffe37121000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted (core dumped)

编译的时候总是报错

libserverframe-1.1.23

gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -fPIC -c -o sf_nio.lo sf_nio.c -Iinclude -I/usr/local/include
In file included from /usr/include/fastcommon/fast_task_queue.h:19:0,
from sf_nio.c:38:
/usr/include/fastcommon/ioevent.h:82:2: error: #error port me
#error port me


对于 libfastcommon libserverframe fastdfs 的版本对应关系和稳定版本, 请问在哪里的可以看到啊,下载最新的编译的时候总是报错

linux/errno.h: No such file or directory

在编译的时候报错,请问如何解决?
[root@vm1 libfastcommon-1.0.43]# ./make.sh
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o hash.o hash.c
In file included from /usr/include/errno.h:35:0,
from hash.c:12:
/usr/include/bits/errno.h:24:26: fatal error: linux/errno.h: No such file or directory
-# include <linux/errno.h>
^
compilation terminated.
make: *** [hash.o] Error 1

cenos7下无法make

cenos7下执行./make.sh 没有任何反眏.
系统版本:
Linux dfs-tracker 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
相关编译器版本:
Package 1:make-3.82-23.el7.x86_64 already installed and latest version
Package cmake-2.8.12.2-2.el7.x86_64 already installed and latest version
Package gcc-4.8.5-11.el7.x86_64 already installed and latest version
Package gcc-c++-4.8.5-11.el7.x86_64 already installed and latest version

fastdfs-nginx-module-1.20/src/common.c:637:对‘logWarning’未定义的引用

配置如下
ngx_addon_name=ngx_http_fastdfs_module

if test -n "${ngx_module_link}"; then
ngx_module_type=HTTP
ngx_module_name=$ngx_addon_name
ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
ngx_module_srcs="$ngx_addon_dir/ngx_http_fastdfs_module.c"
ngx_module_deps=
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='2561024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"'"
. auto/module
else
HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -lfastcommon -lfdfsclient"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256
1024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"'"
fi

在nginx目录下执行./configure --add-module=/usr/local/software/fastdfs-nginx-module-1.20/src后运行make指令报错如下:

objs/src/http/modules/ngx_http_upstream_ip_hash_module.o
objs/src/http/modules/ngx_http_upstream_least_conn_module.o
objs/src/http/modules/ngx_http_upstream_keepalive_module.o
objs/src/http/modules/ngx_http_upstream_zone_module.o
objs/addon/src/ngx_http_fastdfs_module.o
objs/ngx_modules.o
-ldl -lpthread -lcrypt -lpcre -lz
-Wl,-E
objs/addon/src/ngx_http_fastdfs_module.o:在函数‘fdfs_do_check_and_format_range’中:
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:637:对‘logWarning’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:646:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:659:对‘logWarning’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:668:对‘logError’未定义的引用
objs/addon/src/ngx_http_fastdfs_module.o:在函数‘fdfs_calc_content_length’中:
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:596:对‘get_current_time_us’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:603:对‘fdfs_http_get_content_type_by_extname’未定义的引用
objs/addon/src/ngx_http_fastdfs_module.o:在函数‘fdfs_send_file_buffer’中:
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:738:对‘logError’未定义的引用
objs/addon/src/ngx_http_fastdfs_module.o:在函数‘fdfs_mod_init’中:
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:156:对‘log_init’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:157:对‘trunk_shared_init’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:159:对‘iniLoadFromFile’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:161:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:169:对‘iniGetIntValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:172:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:178:对‘iniGetBoolValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:184:对‘logError’未定义的引用
objs/addon/src/ngx_http_fastdfs_module.o:在函数‘fdfs_load_groups_store_paths’中:
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:95:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:105:对‘iniGetStrValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:109:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:115:对‘iniGetIntValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:125:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:132:对‘storage_load_paths_from_conf_file_ex’未定义的引用
objs/addon/src/ngx_http_fastdfs_module.o:在函数‘fdfs_mod_init’中:
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:202:对‘iniGetStrValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:205:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:216:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:224:对‘storage_load_paths_from_conf_file’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:230:对‘iniGetIntValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:230:对‘g_fdfs_connect_timeout’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:237:对‘iniGetIntValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:237:对‘g_fdfs_network_timeout’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:244:对‘load_log_level’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:246:对‘iniGetStrValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:249:对‘g_log_context’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:249:对‘log_set_filename_ex’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:255:对‘iniGetIntValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:258:对‘fdfs_http_params_load’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:264:对‘iniGetStrValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:273:对‘iniGetStrValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:276:对‘g_if_alias_prefix’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:280:对‘g_if_alias_prefix’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:284:对‘iniGetBoolValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:289:对‘g_tracker_group’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:289:对‘fdfs_load_tracker_group_ex’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:294:对‘iniGetIntValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:297:对‘iniGetBoolValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:301:对‘fdfs_load_storage_ids_from_file’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:308:对‘iniGetBoolValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:313:对‘iniGetStrValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:326:对‘iniFreeContext’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:332:对‘load_local_host_ip_addrs’未定义的引用
objs/addon/src/ngx_http_fastdfs_module.o:在函数‘fdfs_get_params_from_tracker’中:
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1600:对‘g_tracker_group’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1600:对‘fdfs_get_ini_context_from_tracker’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1606:对‘iniGetIntValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1610:对‘iniGetBoolValue’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1612:对‘iniFreeContext’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1616:对‘g_tracker_group’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1616:对‘fdfs_get_storage_ids_from_tracker_group’未定义的引用
objs/addon/src/ngx_http_fastdfs_module.o:在函数‘fdfs_mod_init’中:
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:344:对‘g_fdfs_store_paths’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:347:对‘g_fdfs_store_paths’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:349:对‘g_fdfs_store_paths’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:347:对‘g_fdfs_store_paths’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:355:对‘g_storage_id_count’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:355:对‘g_local_host_ip_count’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:355:对‘g_if_alias_prefix’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:355:对‘g_tracker_group’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:355:对‘g_fdfs_network_timeout’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:355:对‘g_fdfs_connect_timeout’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:355:对‘g_fdfs_base_path’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:355:对‘logInfo’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:403:对‘logInfo’未定义的引用
objs/addon/src/ngx_http_fastdfs_module.o:在函数‘fdfs_http_request_handler’中:
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:804:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:815:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:832:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:851:对‘http_parse_query’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:860:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:866:对‘g_fdfs_store_paths’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:866:对‘g_fdfs_store_paths’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:866:对‘g_fdfs_store_paths’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:899:对‘g_fdfs_store_paths’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:908:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:922:对‘fdfs_http_get_parameter’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:923:对‘fdfs_http_get_parameter’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:926:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:934:对‘fdfs_http_check_token’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:939:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:969:对‘storage_split_filename_no_check’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:980:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:991:对‘fdfs_check_data_filename’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:997:对‘fdfs_get_file_info_ex1’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1027:对‘trunk_file_stat_func_ex’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1044:对‘fdfs_http_get_parameter’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1044:对‘fdfs_http_get_parameter’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1062:对‘is_local_host_ip’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1070:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1076:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1091:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1097:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1109:对‘fdfs_http_get_parameter’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1113:对‘logWarning’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1123:对‘logWarning’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1173:对‘logDebug’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1275:对‘fdfs_http_get_parameter’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1287:对‘fdfs_http_get_parameter’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1366:对‘storage_download_file_ex1’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1371:对‘logDebug’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1401:对‘storage_download_file_ex1’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1422:对‘trunk_get_full_filename_ex’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1463:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1474:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1489:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1557:对‘logError’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1191:对‘fdfs_http_get_file_extension’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1191:对‘fdfs_http_get_file_extension’未定义的引用
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1221:对‘fdfs_get_file_info_ex1’未定义的引用
objs/addon/src/ngx_http_fastdfs_module.o:在函数‘fdfs_parse_ranges’中:
/usr/local/software/fastdfs-nginx-module-1.20/src/common.c:1715:对‘splitEx’未定义的引用
collect2: 错误:ld 返回 1
make[1]: *** [objs/nginx] 错误 1
make[1]: 离开目录“/usr/local/software/nginx-1.12.0”
make: *** [build] 错误 2

tcprecvdata_ex 函数逻辑有问题。

第三个参数size,应该是接收buf长度,你默认为接收数据长度了。原来recv可以正常接收的。你可以测试下,你的接收过程中是有问题的。

Error in compile on FreeBSD

Hi!

I'm trying to compile this on FreeBSD as I'm going to upgrade from FastDFS 4.06 to FastDFS 5.08, but I'm running into these compile errors:

cc -Wall -D_FILE_OFFSET_BITS=64 -g -O3 -c -o system_info.o system_info.c
system_info.c:61:13: error: use of undeclared identifier 'HW_MEMSIZE'
mib[1] = HW_MEMSIZE;
^
system_info.c:595:20: error: invalid application of 'sizeof' to an incomplete type 'struct kinfo_proc'
nproc = size / sizeof(struct kinfo_proc);
^ ~~~~~~~~~~~~~~~~~~~
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
struct kinfo_proc *procs;
^
system_info.c:610:16: error: invalid application of 'sizeof' to an incomplete type 'struct kinfo_proc'
size = sizeof(struct kinfo_proc) * nproc;
^ ~~~~~~~~~~~~~~~~~~~
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
struct kinfo_proc *procs;
^
system_info.c:644:20: error: invalid application of 'sizeof' to an incomplete type 'struct kinfo_proc'
nproc = size / sizeof(struct kinfo_proc);
^ ~~~~~~~~~~~~~~~~~~~
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
struct kinfo_proc *procs;
^
system_info.c:661:28: error: subscript of pointer to incomplete type 'struct kinfo_proc'
"%s", procs[i].kp_proc.p_comm);
~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
struct kinfo_proc *procs;
^
system_info.c:662:29: error: subscript of pointer to incomplete type 'struct kinfo_proc'
process->pid = procs[i].kp_proc.p_pid;
~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
struct kinfo_proc *procs;
^
system_info.c:663:30: error: subscript of pointer to incomplete type 'struct kinfo_proc'
process->ppid = procs[i].kp_eproc.e_ppid;
~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
struct kinfo_proc *procs;
^
system_info.c:664:35: error: subscript of pointer to incomplete type 'struct kinfo_proc'
process->starttime = procs[i].kp_proc.p_starttime;
~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
struct kinfo_proc *procs;
^
system_info.c:665:31: error: subscript of pointer to incomplete type 'struct kinfo_proc'
process->flags = procs[i].kp_proc.p_flag;
~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
struct kinfo_proc *procs;
^
system_info.c:666:31: error: subscript of pointer to incomplete type 'struct kinfo_proc'
process->state = procs[i].kp_proc.p_stat;
~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
struct kinfo_proc *procs;
^
system_info.c:668:35: error: subscript of pointer to incomplete type 'struct kinfo_proc'
process->sigignore = procs[i].kp_proc.p_sigignore;
~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
struct kinfo_proc *procs;
^
system_info.c:669:34: error: subscript of pointer to incomplete type 'struct kinfo_proc'
process->sigcatch = procs[i].kp_proc.p_sigcatch;
~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
struct kinfo_proc *procs;
^
system_info.c:670:34: error: subscript of pointer to incomplete type 'struct kinfo_proc'
process->priority = procs[i].kp_proc.p_priority;
~~~~~^
system_info.c:569:12: note: forward declaration of 'struct kinfo_proc'
struct kinfo_proc *procs;
^
system_info.c:691:19: error: variable has incomplete type 'struct xsw_usage'
struct xsw_usage sw_usage;
^
system_info.c:691:9: note: forward declaration of 'struct xsw_usage'
struct xsw_usage sw_usage;
^
system_info.c:697:11: error: use of undeclared identifier 'VM_LOADAVG'
mib[1] = VM_LOADAVG;
^
system_info.c:727:24: error: invalid application of 'sizeof' to an incomplete type 'struct kinfo_proc'
info->procs = size / sizeof(struct kinfo_proc);
^ ~~~~~~~~~~~~~~~~~~~
system_info.c:727:38: note: forward declaration of 'struct kinfo_proc'
info->procs = size / sizeof(struct kinfo_proc);
^
system_info.c:734:11: error: use of undeclared identifier 'VM_METER'
mib[1] = VM_METER;
^
system_info.c:752:11: error: use of undeclared identifier 'VM_SWAPUSAGE'
mib[1] = VM_SWAPUSAGE;
^

Am I missing some dependencies or what can I do to solve this?

mac make error

./make.sh
cc -Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -DDARWIN -c -o shared_func.o shared_func.c
shared_func.c:2567:9: warning: 'syscall' is deprecated: first deprecated in macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface.
For SYS_kdebug_trace use kdebug_signpost(). [-Wdeprecated-declarations]
return syscall(__NR_gettid);
^
/usr/include/unistd.h:745:6: note: 'syscall' has been explicitly marked deprecated here
int syscall(int, ...);
^
shared_func.c:2567:17: error: use of undeclared identifier '__NR_gettid'
return syscall(__NR_gettid);
^
1 warning and 1 error generated.
make: *** [shared_func.o] Error 1

mac version:10.13.6

macos 10.12.3安装问题

sed: can't read s/$(CFLAGS)/-Wall -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -DDARWIN/g: No such file or directory
sed: can't read s/$(LIBS)/-lm/g: No such file or directory
sed: can't read s/$(LIB_VERSION)/lib64/g: No such file or directory
cc -c -o sockopt.o sockopt.c
sockopt.c:1329:69: error: too many arguments to function call, expected 6, have 7
if (sendfile(fd, sock, offset, remain_bytes, NULL, &sbytes, 0) != 0)
~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/sys/socket.h:706:1: note:
'sendfile' declared here
int sendfile(int, int, off_t, off_t *, struct sf_hdtr *, int);
^
1 error generated.
make: *** [sockopt.o] Error 1

执行./make.sh命令就会这样

日志初始化问题

日志初始化这里有调用init_pthread_lock函数,但是这个函数内部错误会利用日志打印,一旦函数内部错误,应该会崩溃吧。

libfastcommon的make.sh报错。

[root@localhost libfastcommon]# ./make.sh
./make.sh:行158: 警告:立即文档在第 2 行被文件结束符分隔 (需要 `EOF')
./make.sh:行2: ./a.out: 没有那个文件或目录
./make.sh:行2: +: 未找到命令
nm: '/usr/lib/libc_r.so': No such file

联系

作者可以留个联系方式吗?

alpine3.13-3.15编译报错

使用alpine:3.13(alpine:3.15都尝试了)编译 libcommon 报错

第一个警告点:

/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
    1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>

第二个报错点:

pthread_func.c: In function 'init_pthread_rwlock':
pthread_func.c:93:14: warning: implicit declaration of function 'pthread_rwlockattr_setkind_np'; did you mean 'pthread_rwlockattr_setpshared'? [-Wimplicit-function-declaration]
   93 |  if ((result=pthread_rwlockattr_setkind_np(attr.ptr,
  //... 省略一些....
error: 'PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP' undeclared (first use in this function)

以下是更具体的报错过程

+ cd /tmp/libfastcommon-1.0.55
+ ./make.sh
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o hash.o hash.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o chain.o chain.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o shared_func.o shared_func.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o ini_file_reader.o ini_file_reader.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o logger.o logger.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o sockopt.o sockopt.c  
In file included from sockopt.c:40:
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
    1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
      |  ^~~~~~~
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o base64.o base64.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o sched_thread.o sched_thread.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o http_func.o http_func.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o md5.o md5.c  
gcc -Wall -Wformat-truncation=0 -Wformat-overflow=0 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g -O3 -c -o pthread_func.o pthread_func.c  
pthread_func.c: In function 'init_pthread_rwlock':
pthread_func.c:93:14: warning: implicit declaration of function 'pthread_rwlockattr_setkind_np'; did you mean 'pthread_rwlockattr_setpshared'? [-Wimplicit-function-declaration]
   93 |  if ((result=pthread_rwlockattr_setkind_np(attr.ptr,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |              pthread_rwlockattr_setpshared
pthread_func.c:94:4: error: 'PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP' undeclared (first use in this function)
   94 |    PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)) != 0)
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pthread_func.c:94:4: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Makefile:69: pthread_func.o] Error 1
+ ./make.sh install


Conflicting Licenses

The project README says:

libfastcommon may be copied only under the terms of the Less GNU General
Public License(LGPL).

Whereas the headers in many of the source files (for example skiplist.h) says:

libfastcommon may be copied only under the terms of the GNU General
Public License V3

Which license in the project under?

iOS11废除了system问题

报错:
libfastcommon/src/logger.c:738:13: error: 'system' is unavailable: not available
on iOS
if (system(cmd) == -1)
^

Got error ./make.sh install on Mac OS

可以运行./make.sh 输出正常,但无法运行install命令。
系统 Mac OS 10.11.6

~/security/libfastcommon  master ✗                                                                                                                   4d ◒
▶ ./make.sh install
mkdir -p /usr/lib64
mkdir: /usr/lib64: Operation not permitted
make: *** [install] Error 1

libfastcommon编译不通过

common_define.h文件中:
#define st_atimensec st_atim.tv_nsec
#define st_mtimensec st_mtim.tv_nsec
#define st_ctimensec st_ctim.tv_nsec
这几行内容编译时报错:error: expected ':', ',', ';', '}' or 'attribute' before '.' token,这是什么原因呢,这些内容的作用是什么,注释掉有什么影响吗

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.