├── LICENSE ├── Makefile ├── README.md ├── cpp ├── 3party │ ├── ae.h │ ├── async.h │ ├── config.h │ ├── gtest │ │ ├── gtest-death-test.h │ │ ├── gtest-message.h │ │ ├── gtest-param-test.h │ │ ├── gtest-param-test.h.pump │ │ ├── gtest-printers.h │ │ ├── gtest-spi.h │ │ ├── gtest-test-part.h │ │ ├── gtest-typed-test.h │ │ ├── gtest.h │ │ ├── gtest_pred_impl.h │ │ ├── gtest_prod.h │ │ └── internal │ │ │ ├── gtest-death-test-internal.h │ │ │ ├── gtest-filepath.h │ │ │ ├── gtest-internal.h │ │ │ ├── gtest-linked_ptr.h │ │ │ ├── gtest-param-util-generated.h │ │ │ ├── gtest-param-util-generated.h.pump │ │ │ ├── gtest-param-util.h │ │ │ ├── gtest-port.h │ │ │ ├── gtest-string.h │ │ │ ├── gtest-tuple.h │ │ │ ├── gtest-tuple.h.pump │ │ │ ├── gtest-type-util.h │ │ │ └── gtest-type-util.h.pump │ ├── hiredis.h │ ├── hiredis_ae.h │ ├── libgtest.so │ ├── libgtest.so.0 │ ├── libgtest.so.0.0.0 │ ├── libgtest_main.so │ ├── libgtest_main.so.0 │ ├── libgtest_main.so.0.0.0 │ ├── libhiredis.a │ ├── libjemalloc.a │ └── zmalloc.h ├── Makefile ├── RedisClientTest.Makefile ├── RedisCommandTool.Makefile ├── RedistributeTool.Makefile ├── include │ ├── Command.h │ ├── KetamaHasher.h │ ├── Log.h │ ├── MD5Util.h │ ├── RedisClient.h │ ├── RedisClientPool.h │ ├── RedisDB.h │ ├── RedisSentinelManager.h │ ├── Reply.h │ ├── ScopedLock.h │ └── Utils.h ├── src │ ├── Command.cpp │ ├── KetamaHasher.cpp │ ├── RedisClient.cpp │ ├── RedisClientPool.cpp │ ├── RedisDB.cpp │ ├── RedisSentinelManager.cpp │ ├── Reply.cpp │ ├── ae.c │ ├── ae_epoll.c │ ├── ae_select.c │ └── zmalloc.c ├── test │ └── RedisClientTest.cpp └── tools │ ├── RedisCommandTool.cpp │ └── RedistributeTool.cpp ├── java ├── build.xml ├── buildtest.xml ├── jni │ ├── JNI.cpp │ ├── JNI.h │ ├── Makefile │ ├── com_redis_sentinel_client_RedisClient.cpp │ └── com_redis_sentinel_client_RedisClient.h ├── lib │ ├── libjnikvdb.so │ └── libkvdb.a └── src │ ├── com │ └── redis │ │ └── sentinel │ │ └── client │ │ ├── RedisClient.java │ │ ├── Reply.java │ │ └── type_t.java │ └── test │ └── RedisClientTest.java ├── proxy ├── LICENSE ├── Makefile ├── build.sh ├── deps │ ├── gperftools2 │ │ ├── AUTHORS │ │ ├── COPYING │ │ ├── ChangeLog │ │ ├── INSTALL │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── NEWS │ │ ├── README │ │ ├── README_windows.txt │ │ ├── TODO │ │ ├── aclocal.m4 │ │ ├── compile │ │ ├── config.guess │ │ ├── config.sub │ │ ├── configure │ │ ├── configure.ac │ │ ├── depcomp │ │ ├── doc │ │ │ ├── cpuprofile-fileformat.html │ │ │ ├── cpuprofile.html │ │ │ ├── designstyle.css │ │ │ ├── heap-example1.png │ │ │ ├── heap_checker.html │ │ │ ├── heapprofile.html │ │ │ ├── index.html │ │ │ ├── overview.dot │ │ │ ├── overview.gif │ │ │ ├── pageheap.dot │ │ │ ├── pageheap.gif │ │ │ ├── pprof-test-big.gif │ │ │ ├── pprof-test.gif │ │ │ ├── pprof-vsnprintf-big.gif │ │ │ ├── pprof-vsnprintf.gif │ │ │ ├── pprof.1 │ │ │ ├── pprof_remote_servers.html │ │ │ ├── spanmap.dot │ │ │ ├── spanmap.gif │ │ │ ├── t-test1.times.txt │ │ │ ├── tcmalloc-opspercpusec.vs.threads.1024.bytes.png │ │ │ ├── tcmalloc-opspercpusec.vs.threads.128.bytes.png │ │ │ ├── tcmalloc-opspercpusec.vs.threads.131072.bytes.png │ │ │ ├── tcmalloc-opspercpusec.vs.threads.16384.bytes.png │ │ │ ├── tcmalloc-opspercpusec.vs.threads.2048.bytes.png │ │ │ ├── tcmalloc-opspercpusec.vs.threads.256.bytes.png │ │ │ ├── tcmalloc-opspercpusec.vs.threads.32768.bytes.png │ │ │ ├── tcmalloc-opspercpusec.vs.threads.4096.bytes.png │ │ │ ├── tcmalloc-opspercpusec.vs.threads.512.bytes.png │ │ │ ├── tcmalloc-opspercpusec.vs.threads.64.bytes.png │ │ │ ├── tcmalloc-opspercpusec.vs.threads.65536.bytes.png │ │ │ ├── tcmalloc-opspercpusec.vs.threads.8192.bytes.png │ │ │ ├── tcmalloc-opspersec.vs.size.1.threads.png │ │ │ ├── tcmalloc-opspersec.vs.size.12.threads.png │ │ │ ├── tcmalloc-opspersec.vs.size.16.threads.png │ │ │ ├── tcmalloc-opspersec.vs.size.2.threads.png │ │ │ ├── tcmalloc-opspersec.vs.size.20.threads.png │ │ │ ├── tcmalloc-opspersec.vs.size.3.threads.png │ │ │ ├── tcmalloc-opspersec.vs.size.4.threads.png │ │ │ ├── tcmalloc-opspersec.vs.size.5.threads.png │ │ │ ├── tcmalloc-opspersec.vs.size.8.threads.png │ │ │ ├── tcmalloc.html │ │ │ ├── threadheap.dot │ │ │ └── threadheap.gif │ │ ├── gperftools.sln │ │ ├── install-sh │ │ ├── libtool │ │ ├── ltmain.sh │ │ ├── m4 │ │ │ ├── ac_have_attribute.m4 │ │ │ ├── acx_nanosleep.m4 │ │ │ ├── acx_pthread.m4 │ │ │ ├── compiler_characteristics.m4 │ │ │ ├── install_prefix.m4 │ │ │ ├── libtool.m4 │ │ │ ├── ltoptions.m4 │ │ │ ├── ltsugar.m4 │ │ │ ├── ltversion.m4 │ │ │ ├── lt~obsolete.m4 │ │ │ ├── namespaces.m4 │ │ │ ├── pc_from_ucontext.m4 │ │ │ ├── program_invocation_name.m4 │ │ │ └── stl_namespace.m4 │ │ ├── missing │ │ ├── packages │ │ │ ├── deb.sh │ │ │ ├── deb │ │ │ │ ├── README │ │ │ │ ├── changelog │ │ │ │ ├── compat │ │ │ │ ├── control │ │ │ │ ├── copyright │ │ │ │ ├── docs │ │ │ │ ├── libgperftools-dev.dirs │ │ │ │ ├── libgperftools-dev.install │ │ │ │ ├── libgperftools0.dirs │ │ │ │ ├── libgperftools0.install │ │ │ │ ├── libgperftools0.manpages │ │ │ │ └── rules │ │ │ ├── rpm.sh │ │ │ └── rpm │ │ │ │ └── rpm.spec │ │ ├── src │ │ │ ├── addressmap-inl.h │ │ │ ├── base │ │ │ │ ├── arm_instruction_set_select.h │ │ │ │ ├── atomicops-internals-arm-generic.h │ │ │ │ ├── atomicops-internals-arm-v6plus.h │ │ │ │ ├── atomicops-internals-linuxppc.h │ │ │ │ ├── atomicops-internals-macosx.h │ │ │ │ ├── atomicops-internals-windows.h │ │ │ │ ├── atomicops-internals-x86.cc │ │ │ │ ├── atomicops-internals-x86.h │ │ │ │ ├── atomicops.h │ │ │ │ ├── basictypes.h │ │ │ │ ├── commandlineflags.h │ │ │ │ ├── cycleclock.h │ │ │ │ ├── dynamic_annotations.c │ │ │ │ ├── dynamic_annotations.h │ │ │ │ ├── elf_mem_image.cc │ │ │ │ ├── elf_mem_image.h │ │ │ │ ├── elfcore.h │ │ │ │ ├── googleinit.h │ │ │ │ ├── linux_syscall_support.h │ │ │ │ ├── linuxthreads.cc │ │ │ │ ├── linuxthreads.h │ │ │ │ ├── logging.cc │ │ │ │ ├── logging.h │ │ │ │ ├── low_level_alloc.cc │ │ │ │ ├── low_level_alloc.h │ │ │ │ ├── simple_mutex.h │ │ │ │ ├── spinlock.cc │ │ │ │ ├── spinlock.h │ │ │ │ ├── spinlock_internal.cc │ │ │ │ ├── spinlock_internal.h │ │ │ │ ├── spinlock_linux-inl.h │ │ │ │ ├── spinlock_posix-inl.h │ │ │ │ ├── spinlock_win32-inl.h │ │ │ │ ├── stl_allocator.h │ │ │ │ ├── synchronization_profiling.h │ │ │ │ ├── sysinfo.cc │ │ │ │ ├── sysinfo.h │ │ │ │ ├── thread_annotations.h │ │ │ │ ├── thread_lister.c │ │ │ │ ├── thread_lister.h │ │ │ │ ├── vdso_support.cc │ │ │ │ └── vdso_support.h │ │ │ ├── central_freelist.cc │ │ │ ├── central_freelist.h │ │ │ ├── common.cc │ │ │ ├── common.h │ │ │ ├── config.h.in │ │ │ ├── config_for_unittests.h │ │ │ ├── debugallocation.cc │ │ │ ├── getpc.h │ │ │ ├── google │ │ │ │ ├── heap-checker.h │ │ │ │ ├── heap-profiler.h │ │ │ │ ├── malloc_extension.h │ │ │ │ ├── malloc_extension_c.h │ │ │ │ ├── malloc_hook.h │ │ │ │ ├── malloc_hook_c.h │ │ │ │ ├── profiler.h │ │ │ │ ├── stacktrace.h │ │ │ │ └── tcmalloc.h │ │ │ ├── gperftools │ │ │ │ ├── heap-checker.h │ │ │ │ ├── heap-profiler.h │ │ │ │ ├── malloc_extension.h │ │ │ │ ├── malloc_extension_c.h │ │ │ │ ├── malloc_hook.h │ │ │ │ ├── malloc_hook_c.h │ │ │ │ ├── profiler.h │ │ │ │ ├── stacktrace.h │ │ │ │ └── tcmalloc.h.in │ │ │ ├── heap-checker-bcad.cc │ │ │ ├── heap-checker.cc │ │ │ ├── heap-profile-table.cc │ │ │ ├── heap-profile-table.h │ │ │ ├── heap-profiler.cc │ │ │ ├── internal_logging.cc │ │ │ ├── internal_logging.h │ │ │ ├── libc_override.h │ │ │ ├── libc_override_gcc_and_weak.h │ │ │ ├── libc_override_glibc.h │ │ │ ├── libc_override_osx.h │ │ │ ├── libc_override_redefine.h │ │ │ ├── linked_list.h │ │ │ ├── malloc_extension.cc │ │ │ ├── malloc_hook-inl.h │ │ │ ├── malloc_hook.cc │ │ │ ├── malloc_hook_mmap_freebsd.h │ │ │ ├── malloc_hook_mmap_linux.h │ │ │ ├── maybe_threads.cc │ │ │ ├── maybe_threads.h │ │ │ ├── memfs_malloc.cc │ │ │ ├── memory_region_map.cc │ │ │ ├── memory_region_map.h │ │ │ ├── packed-cache-inl.h │ │ │ ├── page_heap.cc │ │ │ ├── page_heap.h │ │ │ ├── page_heap_allocator.h │ │ │ ├── pagemap.h │ │ │ ├── pprof │ │ │ ├── profile-handler.cc │ │ │ ├── profile-handler.h │ │ │ ├── profiledata.cc │ │ │ ├── profiledata.h │ │ │ ├── profiler.cc │ │ │ ├── raw_printer.cc │ │ │ ├── raw_printer.h │ │ │ ├── sampler.cc │ │ │ ├── sampler.h │ │ │ ├── solaris │ │ │ │ └── libstdc++.la │ │ │ ├── span.cc │ │ │ ├── span.h │ │ │ ├── stack_trace_table.cc │ │ │ ├── stack_trace_table.h │ │ │ ├── stacktrace.cc │ │ │ ├── stacktrace_arm-inl.h │ │ │ ├── stacktrace_config.h │ │ │ ├── stacktrace_generic-inl.h │ │ │ ├── stacktrace_libunwind-inl.h │ │ │ ├── stacktrace_powerpc-inl.h │ │ │ ├── stacktrace_win32-inl.h │ │ │ ├── stacktrace_x86-inl.h │ │ │ ├── static_vars.cc │ │ │ ├── static_vars.h │ │ │ ├── symbolize.cc │ │ │ ├── symbolize.h │ │ │ ├── system-alloc.cc │ │ │ ├── system-alloc.h │ │ │ ├── tcmalloc.cc │ │ │ ├── tcmalloc.h │ │ │ ├── tcmalloc_guard.h │ │ │ ├── tests │ │ │ │ ├── addressmap_unittest.cc │ │ │ │ ├── atomicops_unittest.cc │ │ │ │ ├── current_allocated_bytes_test.cc │ │ │ │ ├── debugallocation_test.cc │ │ │ │ ├── debugallocation_test.sh │ │ │ │ ├── frag_unittest.cc │ │ │ │ ├── getpc_test.cc │ │ │ │ ├── heap-checker-death_unittest.sh │ │ │ │ ├── heap-checker_unittest.cc │ │ │ │ ├── heap-checker_unittest.sh │ │ │ │ ├── heap-profiler_unittest.cc │ │ │ │ ├── heap-profiler_unittest.sh │ │ │ │ ├── large_heap_fragmentation_unittest.cc │ │ │ │ ├── low_level_alloc_unittest.cc │ │ │ │ ├── malloc_extension_c_test.c │ │ │ │ ├── malloc_extension_test.cc │ │ │ │ ├── malloc_hook_test.cc │ │ │ │ ├── markidle_unittest.cc │ │ │ │ ├── maybe_threads_unittest.sh │ │ │ │ ├── memalign_unittest.cc │ │ │ │ ├── packed-cache_test.cc │ │ │ │ ├── page_heap_test.cc │ │ │ │ ├── pagemap_unittest.cc │ │ │ │ ├── profile-handler_unittest.cc │ │ │ │ ├── profiledata_unittest.cc │ │ │ │ ├── profiler_unittest.cc │ │ │ │ ├── profiler_unittest.sh │ │ │ │ ├── raw_printer_test.cc │ │ │ │ ├── realloc_unittest.cc │ │ │ │ ├── sampler_test.cc │ │ │ │ ├── sampling_test.cc │ │ │ │ ├── sampling_test.sh │ │ │ │ ├── simple_compat_test.cc │ │ │ │ ├── stack_trace_table_test.cc │ │ │ │ ├── stacktrace_unittest.cc │ │ │ │ ├── system-alloc_unittest.cc │ │ │ │ ├── tcmalloc_large_unittest.cc │ │ │ │ ├── tcmalloc_unittest.cc │ │ │ │ ├── tcmalloc_unittest.sh │ │ │ │ ├── testutil.cc │ │ │ │ ├── testutil.h │ │ │ │ └── thread_dealloc_unittest.cc │ │ │ ├── third_party │ │ │ │ └── valgrind.h │ │ │ ├── thread_cache.cc │ │ │ ├── thread_cache.h │ │ │ └── windows │ │ │ │ ├── addr2line-pdb.c │ │ │ │ ├── auto_testing_hook.h │ │ │ │ ├── config.h │ │ │ │ ├── get_mangled_names.cc │ │ │ │ ├── gperftools │ │ │ │ ├── tcmalloc.h │ │ │ │ └── tcmalloc.h.in │ │ │ │ ├── ia32_modrm_map.cc │ │ │ │ ├── ia32_opcode_map.cc │ │ │ │ ├── mingw.h │ │ │ │ ├── mini_disassembler.cc │ │ │ │ ├── mini_disassembler.h │ │ │ │ ├── mini_disassembler_types.h │ │ │ │ ├── nm-pdb.c │ │ │ │ ├── override_functions.cc │ │ │ │ ├── patch_functions.cc │ │ │ │ ├── port.cc │ │ │ │ ├── port.h │ │ │ │ ├── preamble_patcher.cc │ │ │ │ ├── preamble_patcher.h │ │ │ │ ├── preamble_patcher_test.cc │ │ │ │ ├── preamble_patcher_with_stub.cc │ │ │ │ └── shortproc.asm │ │ ├── test-driver │ │ └── vsprojects │ │ │ ├── addr2line-pdb │ │ │ └── addr2line-pdb.vcproj │ │ │ ├── addressmap_unittest │ │ │ └── addressmap_unittest.vcproj │ │ │ ├── current_allocated_bytes_test │ │ │ └── current_allocated_bytes_test.vcproj │ │ │ ├── frag_unittest │ │ │ └── frag_unittest.vcproj │ │ │ ├── libtcmalloc_minimal │ │ │ └── libtcmalloc_minimal.vcproj │ │ │ ├── low_level_alloc_unittest │ │ │ └── low_level_alloc_unittest.vcproj │ │ │ ├── malloc_extension_test │ │ │ └── malloc_extension_test.vcproj │ │ │ ├── malloc_hook_test │ │ │ └── malloc_hook_test.vcproj │ │ │ ├── markidle_unittest │ │ │ └── markidle_unittest.vcproj │ │ │ ├── nm-pdb │ │ │ └── nm-pdb.vcproj │ │ │ ├── packed-cache_test │ │ │ └── packed-cache_test.vcproj │ │ │ ├── page_heap_test │ │ │ └── page_heap_test.vcproj │ │ │ ├── pagemap_unittest │ │ │ └── pagemap_unittest.vcproj │ │ │ ├── preamble_patcher_test │ │ │ └── preamble_patcher_test.vcproj │ │ │ ├── realloc_unittest │ │ │ └── realloc_unittest.vcproj │ │ │ ├── sampler_test │ │ │ └── sampler_test.vcproj │ │ │ ├── stack_trace_table_test │ │ │ └── stack_trace_table_test.vcproj │ │ │ ├── tcmalloc_minimal_large │ │ │ └── tcmalloc_minimal_large_unittest.vcproj │ │ │ ├── tcmalloc_minimal_unittest │ │ │ └── tcmalloc_minimal_unittest.vcproj │ │ │ ├── thread_dealloc_unittest │ │ │ └── thread_dealloc_unittest.vcproj │ │ │ └── tmu-static │ │ │ └── tmu-static.vcproj │ └── libevent2 │ │ ├── ChangeLog │ │ ├── Doxyfile │ │ ├── LICENSE │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── Makefile.nmake │ │ ├── README │ │ ├── WIN32-Code │ │ ├── event2 │ │ │ └── event-config.h │ │ └── tree.h │ │ ├── aclocal.m4 │ │ ├── arc4random.c │ │ ├── autogen.sh │ │ ├── buffer.c │ │ ├── buffer_iocp.c │ │ ├── bufferevent-internal.h │ │ ├── bufferevent.c │ │ ├── bufferevent_async.c │ │ ├── bufferevent_filter.c │ │ ├── bufferevent_openssl.c │ │ ├── bufferevent_pair.c │ │ ├── bufferevent_ratelim.c │ │ ├── bufferevent_sock.c │ │ ├── changelist-internal.h │ │ ├── compat │ │ └── sys │ │ │ └── queue.h │ │ ├── compile │ │ ├── config.guess │ │ ├── config.h.in │ │ ├── config.sub │ │ ├── configure │ │ ├── configure.in │ │ ├── defer-internal.h │ │ ├── depcomp │ │ ├── devpoll.c │ │ ├── epoll.c │ │ ├── epoll_sub.c │ │ ├── evbuffer-internal.h │ │ ├── evdns.c │ │ ├── evdns.h │ │ ├── event-internal.h │ │ ├── event.c │ │ ├── event.h │ │ ├── event_iocp.c │ │ ├── event_rpcgen.py │ │ ├── event_tagging.c │ │ ├── evhttp.h │ │ ├── evmap-internal.h │ │ ├── evmap.c │ │ ├── evport.c │ │ ├── evrpc-internal.h │ │ ├── evrpc.c │ │ ├── evrpc.h │ │ ├── evsignal-internal.h │ │ ├── evthread-internal.h │ │ ├── evthread.c │ │ ├── evthread_pthread.c │ │ ├── evthread_win32.c │ │ ├── evutil.c │ │ ├── evutil.h │ │ ├── evutil_rand.c │ │ ├── ht-internal.h │ │ ├── http-internal.h │ │ ├── http.c │ │ ├── include │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ └── event2 │ │ │ ├── buffer.h │ │ │ ├── buffer_compat.h │ │ │ ├── bufferevent.h │ │ │ ├── bufferevent_compat.h │ │ │ ├── bufferevent_ssl.h │ │ │ ├── bufferevent_struct.h │ │ │ ├── dns.h │ │ │ ├── dns_compat.h │ │ │ ├── dns_struct.h │ │ │ ├── event.h │ │ │ ├── event_compat.h │ │ │ ├── event_struct.h │ │ │ ├── http.h │ │ │ ├── http_compat.h │ │ │ ├── http_struct.h │ │ │ ├── keyvalq_struct.h │ │ │ ├── listener.h │ │ │ ├── rpc.h │ │ │ ├── rpc_compat.h │ │ │ ├── rpc_struct.h │ │ │ ├── tag.h │ │ │ ├── tag_compat.h │ │ │ ├── thread.h │ │ │ └── util.h │ │ ├── install-sh │ │ ├── iocp-internal.h │ │ ├── ipv6-internal.h │ │ ├── kqueue.c │ │ ├── libevent.pc.in │ │ ├── libevent_openssl.pc.in │ │ ├── libevent_pthreads.pc.in │ │ ├── listener.c │ │ ├── log-internal.h │ │ ├── log.c │ │ ├── ltmain.sh │ │ ├── m4 │ │ ├── acx_pthread.m4 │ │ ├── libtool.m4 │ │ ├── ltoptions.m4 │ │ ├── ltsugar.m4 │ │ ├── ltversion.m4 │ │ └── lt~obsolete.m4 │ │ ├── make-event-config.sed │ │ ├── minheap-internal.h │ │ ├── missing │ │ ├── mm-internal.h │ │ ├── poll.c │ │ ├── ratelim-internal.h │ │ ├── sample │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── dns-example.c │ │ ├── event-test.c │ │ ├── hello-world.c │ │ ├── http-server.c │ │ ├── le-proxy.c │ │ ├── signal-test.c │ │ └── time-test.c │ │ ├── select.c │ │ ├── signal.c │ │ ├── strlcpy-internal.h │ │ ├── strlcpy.c │ │ ├── test │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── Makefile.nmake │ │ ├── bench.c │ │ ├── bench_cascade.c │ │ ├── bench_http.c │ │ ├── bench_httpclient.c │ │ ├── regress.c │ │ ├── regress.gen.c │ │ ├── regress.gen.h │ │ ├── regress.h │ │ ├── regress.rpc │ │ ├── regress_buffer.c │ │ ├── regress_bufferevent.c │ │ ├── regress_dns.c │ │ ├── regress_et.c │ │ ├── regress_http.c │ │ ├── regress_iocp.c │ │ ├── regress_listener.c │ │ ├── regress_main.c │ │ ├── regress_minheap.c │ │ ├── regress_rpc.c │ │ ├── regress_ssl.c │ │ ├── regress_testutils.c │ │ ├── regress_testutils.h │ │ ├── regress_thread.c │ │ ├── regress_util.c │ │ ├── regress_zlib.c │ │ ├── rpcgen_wrapper.sh │ │ ├── test-changelist.c │ │ ├── test-eof.c │ │ ├── test-init.c │ │ ├── test-ratelim.c │ │ ├── test-time.c │ │ ├── test-weof.c │ │ ├── test.sh │ │ ├── tinytest.c │ │ ├── tinytest.h │ │ ├── tinytest_local.h │ │ └── tinytest_macros.h │ │ ├── util-internal.h │ │ ├── whatsnew-2.0.txt │ │ └── win32select.c ├── etc │ └── proxy.ini ├── lib │ ├── libevent-2.0.so.5 │ ├── libevent.so │ └── libkvdb.so ├── src │ ├── Makefilebak │ ├── config.cpp │ ├── config.h │ ├── conn_pool.cpp │ ├── conn_pool.h │ ├── ext │ │ └── memcached │ │ │ ├── Makefile │ │ │ ├── memcached.cpp │ │ │ ├── memcached.h │ │ │ └── protocol_binary.h │ ├── extension.cpp │ ├── extension.h │ ├── hash.cpp │ ├── hash.h │ ├── kvproxy.cpp │ ├── kvproxy.h │ ├── log.cpp │ ├── log.h │ ├── serv.cpp │ ├── serv.h │ ├── util.cpp │ ├── util.h │ └── version.h ├── startProxy.sh └── test │ ├── gprof2dot.py │ ├── makefile │ ├── test_config.cpp │ ├── test_conn.cpp │ ├── test_ext.cpp │ ├── test_hash.cpp │ ├── test_log.cpp │ ├── test_proxy.cpp │ ├── test_serv.cpp │ └── test_util.cpp └── python ├── Makefile ├── src └── pykvdb.cpp └── test └── pykvdbtest.py /Makefile: -------------------------------------------------------------------------------- 1 | 2 | all: 3 | cd cpp && make 4 | cd cpp && make -f RedisCommandTool.Makefile 5 | cd cpp && make -f RedistributeTool.Makefile 6 | cp cpp/bin/libkvdb.so . 7 | cd java/jni && make 8 | cd java && ant 9 | cp java/kvdb.jar . 10 | cd python && make 11 | cp python/pykvdb.so . 12 | 13 | .PHONY:test 14 | test:all 15 | cd cpp && make test 16 | cd java && ant -f buildtest.xml 17 | cd java && java -jar kvdbtest.jar 18 | 19 | clean: 20 | cd cpp && make clean 21 | cd java/jni && make clean 22 | cd python && make clean 23 | -rm -f libkvdb.so 24 | -rm -f kvdb.jar 25 | -rm -f pykvdb.so 26 | -------------------------------------------------------------------------------- /cpp/3party/gtest/gtest_prod.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // Google C++ Testing Framework definitions useful in production code. 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 35 | #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 36 | 37 | // When you need to test the private or protected members of a class, 38 | // use the FRIEND_TEST macro to declare your tests as friends of the 39 | // class. For example: 40 | // 41 | // class MyClass { 42 | // private: 43 | // void MyMethod(); 44 | // FRIEND_TEST(MyClassTest, MyMethod); 45 | // }; 46 | // 47 | // class MyClassTest : public testing::Test { 48 | // // ... 49 | // }; 50 | // 51 | // TEST_F(MyClassTest, MyMethod) { 52 | // // Can call MyClass::MyMethod() here. 53 | // } 54 | 55 | #define FRIEND_TEST(test_case_name, test_name)\ 56 | friend class test_case_name##_##test_name##_Test 57 | 58 | #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ 59 | -------------------------------------------------------------------------------- /cpp/3party/libgtest.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/cpp/3party/libgtest.so -------------------------------------------------------------------------------- /cpp/3party/libgtest.so.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/cpp/3party/libgtest.so.0 -------------------------------------------------------------------------------- /cpp/3party/libgtest.so.0.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/cpp/3party/libgtest.so.0.0.0 -------------------------------------------------------------------------------- /cpp/3party/libgtest_main.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/cpp/3party/libgtest_main.so -------------------------------------------------------------------------------- /cpp/3party/libgtest_main.so.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/cpp/3party/libgtest_main.so.0 -------------------------------------------------------------------------------- /cpp/3party/libgtest_main.so.0.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/cpp/3party/libgtest_main.so.0.0.0 -------------------------------------------------------------------------------- /cpp/3party/libhiredis.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/cpp/3party/libhiredis.a -------------------------------------------------------------------------------- /cpp/3party/libjemalloc.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/cpp/3party/libjemalloc.a -------------------------------------------------------------------------------- /cpp/Makefile: -------------------------------------------------------------------------------- 1 | CXX = g++ 2 | AR = ar cr 3 | OBJ_DIR = obj 4 | SRC_DIR = src 5 | 6 | INCPATH = -Iinclude 7 | INCPATH += -I3party 8 | 9 | LFLAGS = -L3party -lhiredis 10 | LFLAGS += -L3party -lssl 11 | LFLAGS += -L3party -ljemalloc -pthread 12 | 13 | 14 | TARGETSO = bin/libkvdb.so 15 | TARGETA = bin/libkvdb.a 16 | 17 | CXX_OBJS = $(OBJ_DIR)/RedisClient.o \ 18 | $(OBJ_DIR)/RedisClientPool.o \ 19 | $(OBJ_DIR)/RedisDB.o \ 20 | $(OBJ_DIR)/RedisSentinelManager.o \ 21 | $(OBJ_DIR)/Reply.o \ 22 | $(OBJ_DIR)/KetamaHasher.o \ 23 | $(OBJ_DIR)/ae.o \ 24 | $(OBJ_DIR)/zmalloc.o \ 25 | $(OBJ_DIR)/Command.o 26 | 27 | $(OBJ_DIR)/%.o:$(SRC_DIR)/%.cpp 28 | $(CXX) -c -fPIC -o $@ $< $(INCPATH) $(LFLAGS) 29 | 30 | $(OBJ_DIR)/%.o:$(SRC_DIR)/%.c 31 | $(CXX) -c -fPIC -o $@ $< $(INCPATH) $(LFLAGS) 32 | 33 | 34 | $(TARGETSO):$(CXX_OBJS) 35 | $(CXX) -fPIC -shared -o $(TARGETSO) $(CXX_OBJS) $(LFLAGS) 36 | $(AR) $(TARGETA) $(CXX_OBJS) 37 | 38 | .PHONY:clean 39 | clean: 40 | -rm -f obj/*.o 41 | -rm -f bin/* 42 | 43 | .PHONY:test 44 | test: 45 | -rm -f bin/RedisClientTest 46 | make -f RedisClientTest.Makefile 47 | ./bin/RedisClientTest 48 | -------------------------------------------------------------------------------- /cpp/RedisClientTest.Makefile: -------------------------------------------------------------------------------- 1 | CXX = g++ 2 | OBJ_DIR = obj 3 | TEST_DIR = test 4 | 5 | INCPATH = -Iinclude 6 | INCPATH += -I3party 7 | 8 | LFLAGS += -L3party -lgtest_main -lgtest -lpthread 9 | LFLAGS += -Lbin -lkvdb 10 | 11 | 12 | TARGET = bin/RedisClientTest 13 | 14 | CXX_OBJS = $(OBJ_DIR)/RedisClientTest.o 15 | 16 | $(OBJ_DIR)/%.o:$(TEST_DIR)/%.cpp 17 | $(CXX) -c -fPIC -o $@ $< $(INCPATH) $(LFLAGS) 18 | 19 | $(OBJ_DIR)/%.o:$(TEST_DIR)/%.c 20 | $(CXX) -c -fPIC -o $@ $< $(INCPATH) $(LFLAGS) 21 | 22 | 23 | $(TARGET):$(CXX_OBJS) 24 | $(CXX) -o $(TARGET) $(CXX_OBJS) $(LFLAGS) 25 | 26 | .PHONY:clean 27 | clean: 28 | -rm -f bin/RedisClientTest 29 | -------------------------------------------------------------------------------- /cpp/RedisCommandTool.Makefile: -------------------------------------------------------------------------------- 1 | CXX = g++ 2 | OBJ_DIR = obj 3 | TOOLS_DIR = tools 4 | 5 | INCPATH = -Iinclude 6 | INCPATH += -I3party 7 | 8 | LFLAGS += -L3party -lpthread 9 | LFLAGS += -Lbin -lkvdb 10 | 11 | 12 | TARGET = bin/RedisCommandTool 13 | 14 | CXX_OBJS = $(OBJ_DIR)/RedisCommandTool.o 15 | 16 | $(OBJ_DIR)/%.o:$(TOOLS_DIR)/%.cpp 17 | $(CXX) -c -fPIC -o $@ $< $(INCPATH) $(LFLAGS) 18 | 19 | $(OBJ_DIR)/%.o:$(TOOLS_DIR)/%.c 20 | $(CXX) -c -fPIC -o $@ $< $(INCPATH) $(LFLAGS) 21 | 22 | 23 | $(TARGET):$(CXX_OBJS) 24 | $(CXX) -o $(TARGET) $(CXX_OBJS) $(LFLAGS) 25 | 26 | .PHONY:clean 27 | clean: 28 | -rm -f bin/RedisCommandTool 29 | -------------------------------------------------------------------------------- /cpp/RedistributeTool.Makefile: -------------------------------------------------------------------------------- 1 | CXX = g++ 2 | OBJ_DIR = obj 3 | TOOLS_DIR = tools 4 | 5 | INCPATH = -Iinclude 6 | INCPATH += -I3party 7 | 8 | LFLAGS += -L3party -lpthread 9 | LFLAGS += -Lbin -lkvdb 10 | 11 | 12 | TARGET = bin/RedistributeTool 13 | 14 | CXX_OBJS = $(OBJ_DIR)/RedistributeTool.o 15 | 16 | $(OBJ_DIR)/%.o:$(TOOLS_DIR)/%.cpp 17 | $(CXX) -c -fPIC -o $@ $< $(INCPATH) $(LFLAGS) 18 | 19 | $(OBJ_DIR)/%.o:$(TOOLS_DIR)/%.c 20 | $(CXX) -c -fPIC -o $@ $< $(INCPATH) $(LFLAGS) 21 | 22 | 23 | $(TARGET):$(CXX_OBJS) 24 | $(CXX) -o $(TARGET) $(CXX_OBJS) $(LFLAGS) 25 | 26 | .PHONY:clean 27 | clean: 28 | -rm -f bin/RedistributeTool 29 | -------------------------------------------------------------------------------- /cpp/include/Command.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @brief 4 | */ 5 | 6 | #ifndef BFD_SENTINEL_CLIENT_COMMAND_H 7 | #define BFD_SENTINEL_CLIENT_COMMAND_H 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace bfd 15 | { 16 | namespace redis 17 | { 18 | 19 | class Command 20 | { 21 | public: 22 | Command(){}; 23 | 24 | Command(const std::string& arg); 25 | 26 | ~Command(){}; 27 | 28 | Command& operator<<(const std::string& arg); 29 | 30 | Command& operator()(const char* arg); 31 | 32 | Command& operator()(const std::string arg); 33 | 34 | operator const std::vector&() 35 | { 36 | return args_; 37 | }; 38 | 39 | std::string ToString(); 40 | 41 | std::vector args() const 42 | { 43 | return args_; 44 | }; 45 | private: 46 | std::vector args_; 47 | }; 48 | } 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /cpp/include/KetamaHasher.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @brief 4 | * 5 | */ 6 | 7 | #ifndef REDIS_SENTINEL_CLIENT_KETAMA_H 8 | #define REDIS_SENTINEL_CLIENT_KETAMA_H 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "RedisDB.h" 16 | 17 | using namespace std; 18 | 19 | namespace bfd 20 | { 21 | namespace redis 22 | { 23 | 24 | class Ketama 25 | { 26 | public: 27 | 28 | Ketama(const map& server_conn_map); 29 | ~Ketama(); 30 | 31 | RedisDB get(const std::string& key); 32 | 33 | void Init(const map& server_conn_map); 34 | 35 | vector Reset(const map& server_conn_map); 36 | private: 37 | 38 | 39 | 40 | 41 | void hash_config(const map& server_conn_map); 42 | 43 | RedisDB GetHashServer(const string& key); 44 | 45 | uint32_t hashKey(const std::string& key); 46 | 47 | string int2str(int i) 48 | { 49 | stringstream stream; 50 | stream << i; 51 | return stream.str(); 52 | } 53 | private: 54 | map m_DBMap; 55 | vector > m_DBVec; 56 | pthread_mutex_t m_Mutex; 57 | 58 | 59 | }; 60 | } 61 | } 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /cpp/include/Log.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @brief 4 | */ 5 | 6 | #ifndef REDIS_SENTINEL_CLIENT_LOGGER_H 7 | #define REDIS_SENTINEL_CLIENT_LOGGER_H 8 | 9 | #include 10 | #include 11 | #include "Utils.h" 12 | 13 | 14 | #define LOG(level, msg) Log(level, msg, __FILE__, __LINE__) 15 | 16 | enum LEVEL{INFO, WARN, ERROR}; 17 | 18 | static pthread_mutex_t* GetMutex() 19 | { 20 | static pthread_mutex_t logmutex = PTHREAD_MUTEX_INITIALIZER; 21 | 22 | return &logmutex; 23 | } 24 | 25 | static void Log(LEVEL level, string msg, string file, int line) 26 | { 27 | pthread_mutex_lock(GetMutex()); 28 | 29 | int pid = (int)getpid(); 30 | 31 | stringstream stream; 32 | stream << "redis_client_log_" << pid << ".txt"; 33 | 34 | ofstream ofs(stream.str().c_str(), ios::ate); 35 | if (!ofs) 36 | { 37 | pthread_mutex_unlock(GetMutex()); 38 | return; 39 | } 40 | 41 | ofs << "["; 42 | switch (level) 43 | { 44 | case INFO: 45 | ofs << "INFO" << "]"; 46 | break; 47 | case WARN: 48 | ofs << "WARN" << "]"; 49 | break; 50 | case ERROR: 51 | ofs << "ERROR" << "]"; 52 | break; 53 | default: 54 | ofs << "ERROR" << "]"; 55 | }; 56 | 57 | ofs << "[" << TimeUtil::getCurrentTime() << "]"; 58 | 59 | ofs << "[" << file << ":" << line << "]"; 60 | 61 | ofs << "[" << msg << "]" << endl; 62 | 63 | ofs.close(); 64 | 65 | pthread_mutex_unlock(GetMutex()); 66 | } 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /cpp/include/MD5Util.h: -------------------------------------------------------------------------------- 1 | #ifndef _MD5UTIL_H_ 2 | #define _MD5UTIL_H_ 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | #ifdef CHARSET_EBCDIC 16 | #include 17 | #endif 18 | 19 | using namespace std; 20 | namespace MyUtil{ 21 | 22 | class MD5Util { 23 | public: 24 | /*static void stringToMD5(const std::string& source) 25 | { 26 | return M_MD5((unsigned char*)source.c_str(), strlen(source.c_str()), NULL); 27 | }*/ 28 | 29 | static void stringToMD5(const std::string& source, unsigned char* res) { 30 | M_MD5((unsigned char*)source.c_str(), strlen(source.c_str()), res); 31 | } 32 | 33 | static void stringSeqToMD5(const std::vector& source, unsigned char* res) 34 | { 35 | string dest; 36 | for(vector::const_iterator iter=source.begin(); iter!=source.end(); ++iter) 37 | { 38 | dest += *iter; 39 | } 40 | M_MD5((unsigned char*)dest.c_str(), strlen(dest.c_str()), res); 41 | } 42 | 43 | protected: 44 | 45 | static void M_MD5(const unsigned char *d, size_t n, unsigned char *md) 46 | { 47 | MD5_CTX c; 48 | unsigned char m[MD5_DIGEST_LENGTH]; 49 | 50 | if (md == NULL) md=m; 51 | 52 | if (!MD5_Init(&c)) 53 | return; 54 | 55 | #ifndef CHARSET_EBCDIC 56 | MD5_Update(&c,d,n); 57 | #else 58 | { 59 | char temp[1024]; 60 | unsigned long chunk; 61 | 62 | while (n > 0) 63 | { 64 | chunk = (n > sizeof(temp)) ? sizeof(temp) : n; 65 | ebcdic2ascii(temp, d, chunk); 66 | MD5_Update(&c,temp,chunk); 67 | n -= chunk; 68 | d += chunk; 69 | } 70 | } 71 | #endif 72 | MD5_Final(md,&c); 73 | OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */ 74 | //long res = *(long*)md; 75 | //return res; 76 | } 77 | 78 | }; 79 | 80 | } 81 | #endif 82 | -------------------------------------------------------------------------------- /cpp/include/RedisClientPool.h: -------------------------------------------------------------------------------- 1 | // RedisClientPool.h 2 | // owned by: www.baifendian.com 3 | // contact: yi.wu@baifendian.com,xu.yan@baifendian.com 4 | // RedisClientPool: 对同一个redis实例的连接池 5 | // 同时报错多个redisContext*和多个redisAsyncContext*,针对不同的使用特点使用同步或异步的方式创建连接。 6 | // 连接在第一次调用时创建,之后会复用多个连接 7 | // NOTICE: RedisClientPool不暴露给最终client端使用,只用于clinet内部处理连接池 8 | 9 | #ifndef _TRIPOD_REDISCLIENTPOOL_H__ 10 | #define _TRIPOD_REDISCLIENTPOOL_H__ 11 | 12 | #include 13 | #include 14 | #include 15 | #include "hiredis.h" 16 | #include "hiredis_ae.h" 17 | #include "async.h" 18 | #include "Utils.h" 19 | 20 | using namespace std; 21 | 22 | namespace bfd { 23 | namespace redis { 24 | 25 | class RedisClientPool { 26 | public: 27 | RedisClientPool(const std::string& address, int port, 28 | const string& password="", 29 | bool active = true, 30 | bool async = false, 31 | size_t coreSize = 1, 32 | size_t maxSize = 100); 33 | ~RedisClientPool(); 34 | // 获取一个连接 35 | redisContext* borrowItem(); 36 | redisAsyncContext* borrowItemAsync(aeEventLoop *loop); 37 | // 将连接放回pool中 38 | void returnItem(redisContext* item); 39 | void returnItemAsync(redisAsyncContext* item); 40 | // 创建连接 41 | redisContext* create(); 42 | redisAsyncContext* createAsync(aeEventLoop *loop); 43 | // 重连 44 | bool Reconnect(redisContext*); 45 | bool ReconnectAsync(redisAsyncContext* rac, aeEventLoop *loop); 46 | // 销毁连接 47 | void Destroy(redisContext* item); 48 | void DestroyAsync(redisAsyncContext* item); 49 | // 获取当前pool的ip端口 50 | std::string getId(); 51 | bool active() {return active_;}; 52 | 53 | private: 54 | std::string address_; 55 | int port_; 56 | bool active_; 57 | bool async_; 58 | 59 | size_t coreSize_; 60 | size_t maxSize_; 61 | // 同步连接池 62 | pthread_mutex_t unUsedMutex_; 63 | std::deque unUsed_; 64 | size_t used_; 65 | // 异步连接池 66 | pthread_mutex_t unUsedAsyncMutex_; 67 | std::deque unUsedAsync_; 68 | size_t usedAsync_; 69 | 70 | string password_; 71 | }; 72 | 73 | } 74 | } 75 | 76 | #endif 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /cpp/include/RedisSentinelManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 使用RedisSentinel管理集群的配置信息 3 | * 1、在传入的sentinel地址中随机选取一个读取master节点信息,因为是同机房、 4 | * 同网段,所以暂不考虑在所有sentinel服务中选取延迟最小的一个这个逻辑。 5 | * 2、订阅master-switch事件,当集群信息有变化时,通知客户端更新集群信息 6 | * 7 | * Author:xu.yan@baifendian.com 8 | * Date:2014-04-04 9 | */ 10 | #ifndef REDIS_SENTINEL_MANAGER 11 | #define REDIS_SENTINEL_MANAGER 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "RedisClientPool.h" 18 | #include "KetamaHasher.h" 19 | 20 | #include "hiredis.h" 21 | #include "hiredis_ae.h" 22 | #include "async.h" 23 | 24 | using namespace std; 25 | 26 | namespace bfd 27 | { 28 | namespace redis 29 | { 30 | 31 | struct Sentinel 32 | { 33 | string sentinelIP; 34 | int sentinelPort; 35 | }; 36 | 37 | class RedisSentinelManager 38 | { 39 | public: 40 | RedisSentinelManager(); 41 | ~RedisSentinelManager(); 42 | bool Init(const string& sentinels, const string& password); 43 | void SetKetamaHasher(Ketama *(&ketamaHasher)){m_KetamaHasher = ketamaHasher;}; 44 | void Terminate(); 45 | // bool CheckNewSentinel(const string& sentinel); 46 | // vector AddSentinel(const string& sentinel); 47 | 48 | static void* monitorSentinel(void *arg); 49 | static void* AEThread(void *arg); 50 | 51 | map& servers() 52 | { 53 | return m_Servers; 54 | } 55 | ; 56 | void UpdateServers(const string& master_name, const string& addr); 57 | 58 | bool CheckNewServer(const string& masterName); 59 | vector AddServer(const string& masterName, const string& addr, int port); 60 | 61 | bool AddSentinelMonitor(const string& masterName, const string& addr, int port); 62 | 63 | private: 64 | bool SubSentinelInfo(Sentinel& sen); 65 | map GetServers(Sentinel& sen); 66 | 67 | private: 68 | redisAsyncContext* m_AsyncContext; 69 | pthread_mutex_t m_Mutex; 70 | 71 | string m_Password; 72 | map m_Servers; 73 | aeEventLoop *loop_; 74 | pthread_t m_AEThreadID; 75 | Ketama *m_KetamaHasher; 76 | 77 | vector m_TotalSentinels; 78 | Sentinel m_PubSentinel; 79 | }; 80 | 81 | } //redis 82 | } //bfd 83 | #endif 84 | -------------------------------------------------------------------------------- /cpp/include/Reply.h: -------------------------------------------------------------------------------- 1 | #ifndef REPLY_H_ 2 | #define REPLY_H_ 3 | #include 4 | #include "hiredis.h" 5 | #include 6 | using namespace std; 7 | 8 | namespace bfd{ 9 | namespace redis{ 10 | class Reply { 11 | public: 12 | Reply(); 13 | Reply(redisReply* reply); 14 | enum type_t { 15 | STRING = 1, 16 | ARRAY = 2, 17 | INTEGER = 3, 18 | NIL = 4, 19 | STATUS = 5, 20 | ERROR = 6 21 | }; 22 | void SetErrorMessage(const string& message); 23 | inline type_t type() const {return type_;} 24 | inline const string str() const {return str_;} 25 | inline long long integer() const {return integer_;} 26 | inline const vector& elements() const {return elements_;} 27 | inline const bool error() const {return error_;} 28 | private: 29 | bool error_; 30 | type_t type_; 31 | string str_; 32 | long long integer_; 33 | std::vector elements_; 34 | 35 | }; 36 | } 37 | } 38 | #endif 39 | -------------------------------------------------------------------------------- /cpp/include/ScopedLock.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @brief 4 | */ 5 | 6 | #ifndef BFD_REDIS_SCOPEDLOCK_H 7 | #define BFD_REDIS_SCOPEDLOCK_H 8 | 9 | class ScopedLock 10 | { 11 | public: 12 | ScopedLock(pthread_mutex_t &mutex) 13 | { 14 | m_Mutex = &mutex; 15 | pthread_mutex_lock(m_Mutex); 16 | } 17 | 18 | ~ScopedLock() 19 | { 20 | pthread_mutex_unlock(m_Mutex); 21 | } 22 | 23 | 24 | private: 25 | pthread_mutex_t *m_Mutex; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /cpp/include/Utils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * @brief 4 | */ 5 | 6 | #ifndef BFD_REDIS_UTILS_H 7 | #define BFD_REDIS_UTILS_H 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | using namespace std; 17 | 18 | static std::string int2string(int i) 19 | { 20 | stringstream stream; 21 | stream << i; 22 | return stream.str(); 23 | } 24 | 25 | static int string2int(string str) 26 | { 27 | return atoi(str.c_str()); 28 | } 29 | 30 | static vector split(const std::string &s, char delim) 31 | { 32 | vector elems; 33 | 34 | std::stringstream ss(s); 35 | std::string item; 36 | while (std::getline(ss, item, delim)) 37 | { 38 | elems.push_back(item); 39 | } 40 | return elems; 41 | } 42 | 43 | class TimeUtil 44 | { 45 | public: 46 | TimeUtil() 47 | { 48 | memset(&m_Start, 0, sizeof(m_Start)); 49 | memset(&m_End, 0, sizeof(m_End)); 50 | }; 51 | 52 | void Start() 53 | { 54 | memset(&m_Start, 0, sizeof(m_Start)); 55 | gettimeofday(&m_Start, NULL); 56 | }; 57 | 58 | /** 59 | * @brief 60 | * @param[in] bflag false ---毫秒 61 | * true ---微秒 62 | */ 63 | long End(bool bflag = false) 64 | { 65 | memset(&m_End, 0, sizeof(m_End)); 66 | gettimeofday(&m_End, NULL); 67 | return getUseTime(bflag); 68 | }; 69 | 70 | /** 71 | * @brief 72 | * @param[in] bflag false ---毫秒 73 | * true ---微秒 74 | */ 75 | long getUseTime(bool bflag = false) 76 | { 77 | if (bflag) 78 | return (1000000*(m_End.tv_sec-m_Start.tv_sec) 79 | +(m_End.tv_usec-m_Start.tv_usec))/1000; 80 | else 81 | return 1000000*(m_End.tv_sec-m_Start.tv_sec) 82 | +(m_End.tv_usec-m_Start.tv_usec); 83 | } 84 | 85 | static string getCurrentTime() 86 | { 87 | time_t now; 88 | struct tm *timenow; 89 | 90 | time(&now); 91 | timenow = localtime(&now); 92 | 93 | stringstream stream; 94 | stream << timenow->tm_year + 1900 << "-" 95 | << timenow->tm_mon + 1 << "-" 96 | << timenow->tm_mday << " " 97 | << timenow->tm_hour + 1 << ":" 98 | << timenow->tm_min << ":" 99 | << timenow->tm_sec; 100 | 101 | return stream.str(); 102 | } 103 | private: 104 | timeval m_Start; 105 | timeval m_End; 106 | 107 | }; 108 | 109 | 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /cpp/src/Command.cpp: -------------------------------------------------------------------------------- 1 | #include"Command.h" 2 | using namespace std; 3 | using namespace bfd::redis; 4 | 5 | Command::Command(const std::string& arg) 6 | { 7 | args_.push_back(arg); 8 | } 9 | 10 | Command& Command::operator()(const char* arg) 11 | { 12 | args_.push_back(string(arg)); 13 | return *this; 14 | } 15 | 16 | Command& Command::operator()(const std::string arg) 17 | { 18 | args_.push_back(arg); 19 | return *this; 20 | } 21 | 22 | std::string Command::ToString() 23 | { 24 | std::stringstream ss; 25 | for (size_t i = 0; i < args_.size(); ++i) 26 | { 27 | ss << args_[i]; 28 | if (i != args_.size() - 1) 29 | { 30 | ss << " "; 31 | } 32 | } 33 | return ss.str(); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /cpp/src/Reply.cpp: -------------------------------------------------------------------------------- 1 | #include"Reply.h" 2 | 3 | using namespace bfd::redis; 4 | 5 | Reply::Reply():error_(true),type_(ERROR),integer_(0) { 6 | // do nothing 7 | } 8 | Reply::Reply(redisReply *reply_p):type_(ERROR),integer_(0),error_(false) { 9 | type_ = static_cast(reply_p->type); 10 | switch (type_) { 11 | case ERROR: 12 | error_ = true; 13 | str_ = std::string(reply_p->str, reply_p->len); 14 | case STRING: 15 | case STATUS: 16 | str_ = std::string(reply_p->str, reply_p->len); 17 | break; 18 | case INTEGER: 19 | integer_ = reply_p->integer; 20 | break; 21 | case ARRAY: 22 | for (size_t i=0; i < reply_p->elements; ++i) { 23 | elements_.push_back(Reply(reply_p->element[i])); 24 | } 25 | break; 26 | default: 27 | break; 28 | } 29 | } 30 | void Reply::SetErrorMessage(const string& message) { 31 | error_ = true; 32 | str_ = message; 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /cpp/tools/RedisCommandTool.cpp: -------------------------------------------------------------------------------- 1 | #include "RedisClient.h" 2 | 3 | using namespace bfd::redis; 4 | 5 | std::string ReplyToString(const Reply& rep) 6 | { 7 | stringstream retstream; 8 | 9 | vector reps; 10 | if (rep.elements().size()>0) 11 | { 12 | reps = rep.elements(); 13 | } 14 | 15 | switch (rep.type()) { 16 | case Reply::ERROR: 17 | retstream << rep.str(); 18 | break; 19 | case Reply::STRING: 20 | retstream << rep.str(); 21 | break; 22 | case Reply::STATUS: 23 | retstream << rep.str(); 24 | break; 25 | case Reply::INTEGER: 26 | retstream << rep.integer(); 27 | break; 28 | case Reply::NIL: 29 | retstream << "nil"; 30 | break; 31 | case Reply::ARRAY: 32 | retstream << "*"; 33 | retstream << rep.elements().size(); 34 | retstream << endl; 35 | 36 | 37 | for (size_t idx=0; idx 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /java/buildtest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /java/jni/JNI.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief An easy wrapper of JNI functions. 3 | * 4 | * Modification history 5 | * version author date description 6 | * 0.1 weimeng 2015.03.20 initial version 7 | * 8 | * 9 | * @author weimeng 10 | */ 11 | #ifndef BFD_JNI_H 12 | #define BFD_JNI_H 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | using namespace std; 19 | 20 | class JNI { 21 | public: 22 | 23 | static vector JArrayToVec(JNIEnv* env, jobjectArray& jkeys); 24 | 25 | static jstring StrToJStr(JNIEnv* env, string& str); 26 | 27 | static string JStrToStr(JNIEnv* env, jstring& jstr); 28 | 29 | /* 30 | * Converts std::vector to a java ArrayList Object 31 | */ 32 | static jobject VectorToJList(JNIEnv* env, std::vector& values); 33 | /* 34 | * Converts std::vector to a java ArrayList Object 35 | */ 36 | static jobject VectorToJListByte(JNIEnv* env, std::vector& values); 37 | /** 38 | * Converts boost::unordered_map to a java ArrayList Object 39 | */ 40 | static jobject MapToHashMap(JNIEnv* env, map &kvMap); 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /java/jni/Makefile: -------------------------------------------------------------------------------- 1 | CXX = g++ 2 | AR = ar cr 3 | OBJ_DIR = . 4 | SRC_DIR = . 5 | 6 | INCPATH = -I. 7 | INCPATH += -I../../cpp/include 8 | INCPATH += -I../../cpp/3party 9 | INCPATH += -I/usr/local/jdk1.7/include 10 | INCPATH += -I/usr/local/jdk1.7/include/linux 11 | 12 | LFLAGS = -L../lib -lkvdb 13 | 14 | 15 | TARGETSO = ../lib/libjnikvdb.so 16 | 17 | CXX_OBJS = $(OBJ_DIR)/com_redis_sentinel_client_RedisClient.o \ 18 | $(OBJ_DIR)/JNI.o 19 | 20 | $(OBJ_DIR)/%.o:$(SRC_DIR)/%.cpp 21 | $(CXX) -c -fPIC -o $@ $< $(INCPATH) $(LFLAGS) 22 | 23 | $(OBJ_DIR)/%.o:$(SRC_DIR)/%.c 24 | $(CXX) -c -fPIC -o $@ $< $(INCPATH) $(LFLAGS) 25 | 26 | 27 | $(TARGETSO):$(CXX_OBJS) 28 | cp ../../cpp/bin/libkvdb.so ../lib 29 | $(CXX) -fPIC -shared -o $(TARGETSO) $(CXX_OBJS) $(LFLAGS) 30 | 31 | .PHONY:clean 32 | clean: 33 | -rm -f ./*.o 34 | -rm -f $(TARGETA) 35 | 36 | -------------------------------------------------------------------------------- /java/lib/libjnikvdb.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/java/lib/libjnikvdb.so -------------------------------------------------------------------------------- /java/lib/libkvdb.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/java/lib/libkvdb.a -------------------------------------------------------------------------------- /java/src/com/redis/sentinel/client/Reply.java: -------------------------------------------------------------------------------- 1 | package com.redis.sentinel.client; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class Reply { 6 | 7 | 8 | boolean error_; 9 | public boolean isError_() { 10 | return error_; 11 | } 12 | public void setError_(boolean error_) { 13 | this.error_ = error_; 14 | } 15 | public type_t getType_() { 16 | return type_; 17 | } 18 | public void setType_(type_t type_) { 19 | this.type_ = type_; 20 | } 21 | public String getStr_() { 22 | return str_; 23 | } 24 | public void setStr_(String str_) { 25 | this.str_ = str_; 26 | } 27 | public long getInteger_() { 28 | return integer_; 29 | } 30 | public void setInteger_(long integer_) { 31 | this.integer_ = integer_; 32 | } 33 | public ArrayList getElements_() { 34 | return elements_; 35 | } 36 | public void setElements_(ArrayList elements_) { 37 | this.elements_ = elements_; 38 | } 39 | public void AddElements(Reply rep) { 40 | this.elements_.add(rep); 41 | } 42 | 43 | private type_t type_; 44 | private String str_; 45 | private long integer_; 46 | private ArrayList elements_ = null; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /java/src/com/redis/sentinel/client/type_t.java: -------------------------------------------------------------------------------- 1 | package com.redis.sentinel.client; 2 | 3 | public enum type_t { 4 | STRING, 5 | ARRAY, 6 | INTEGER, 7 | NIL, 8 | STATUS, 9 | ERROR 10 | } 11 | -------------------------------------------------------------------------------- /proxy/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, exinnet 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of kvproxy nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /proxy/Makefile: -------------------------------------------------------------------------------- 1 | CXX = g++ -std=c++0x 2 | AR = ar cr 3 | OBJ_DIR = obj 4 | SRC_DIR = src 5 | 6 | INCPATH = -I. 7 | INCPATH += -I../cpp/include 8 | INCPATH += -I../cpp/3party 9 | INCPATH += -I./deps/libevent2 10 | INCPATH += -I./deps/libevent2/include 11 | 12 | LFLAGS = -Llib -lkvdb 13 | LFLAGS += -Llib -levent 14 | 15 | 16 | TARGETSO = bin/bfdproxy 17 | 18 | CXX_OBJS = $(OBJ_DIR)/kvproxy.o \ 19 | $(OBJ_DIR)/extension.o \ 20 | $(OBJ_DIR)/hash.o \ 21 | $(OBJ_DIR)/serv.o \ 22 | $(OBJ_DIR)/conn_pool.o \ 23 | $(OBJ_DIR)/log.o \ 24 | $(OBJ_DIR)/config.o \ 25 | $(OBJ_DIR)/util.o 26 | 27 | 28 | $(OBJ_DIR)/%.o:$(SRC_DIR)/%.cpp 29 | $(CXX) -c -o $@ $< $(INCPATH) $(LFLAGS) 30 | 31 | $(OBJ_DIR)/%.o:$(SRC_DIR)/%.c 32 | $(CXX) -c -o $@ $< $(INCPATH) $(LFLAGS) 33 | 34 | 35 | $(TARGETSO):$(CXX_OBJS) 36 | cp ../cpp/bin/libkvdb.so lib 37 | $(CXX) -o $(TARGETSO) $(CXX_OBJS) $(LFLAGS) 38 | 39 | .PHONY:clean 40 | clean: 41 | -rm -f $(OBJ_DIR)/*.o 42 | -rm -f $(TARGETSO) 43 | 44 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/AUTHORS: -------------------------------------------------------------------------------- 1 | google-perftools@googlegroups.com 2 | 3 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2005, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/TODO: -------------------------------------------------------------------------------- 1 | HEAP PROFILER 2 | 3 | 1) Fix heap profiling under all STLs 4 | * Find out how to force non-glibc STL libraries to call new() and 5 | delete() for every allocation / deallocation. 6 | * Make heap profiler ignore STL-internal allocations for those 7 | libraries under which we cannot profile accurately, so we only 8 | see object-level leaks. 9 | 2) Remove dependency on tcmalloc? 10 | 3) Port to non-linux O/Ses (right now code uses /proc for library info) 11 | 4) Port to non-x86 architectures (locking code in spinlock is x86-specific) 12 | 5) Port to C? 13 | 6) Figure out how to get setenv() to work properly before main() in 14 | shared libaries, and get rid of the profile-naming hack once we 15 | do. (See HeapProfiler::Init().) 16 | 17 | 18 | HEAP CHECKER 19 | 20 | 1) Remove requirement that the heap-checker must be linked last into 21 | an application (hard! -- it needs its global constructor to run 22 | first) 23 | 24 | TCMALLOC 25 | 26 | 1) Implement mallinfo/mallopt 27 | 2) Have tcmalloc work correctly when libpthread is not linked in 28 | (currently working for glibc, could use other libc's too) 29 | 3) Return memory to the system when requirements drop 30 | 4) Explore coloring allocated objects to avoid cache conflicts 31 | 5) Explore biasing reclamation to larger addresses 32 | 6) Add contention stats to a synchronization.cc (can do spinlocks, 33 | but threads? -- may have to provide our own thread implementation) 34 | 35 | CPU PROFILER 36 | 37 | 1) Figure out how to get setenv() to work properly before main() in 38 | shared libaries(), and get rid of the profile-naming hack once we 39 | do. (See Profiler::GetUniquePathFromEnv().) 40 | 2) Resolve crashing problems on x86_64 (see README) 41 | 42 | STACKTRACE 43 | 44 | 1) Remove dependency on linux/x86 45 | 46 | --- 47 | 11 March 2008 48 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/designstyle.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #ffffff; 3 | color: black; 4 | margin-right: 1in; 5 | margin-left: 1in; 6 | } 7 | 8 | 9 | h1, h2, h3, h4, h5, h6 { 10 | color: #3366ff; 11 | font-family: sans-serif; 12 | } 13 | @media print { 14 | /* Darker version for printing */ 15 | h1, h2, h3, h4, h5, h6 { 16 | color: #000080; 17 | font-family: helvetica, sans-serif; 18 | } 19 | } 20 | 21 | h1 { 22 | text-align: center; 23 | font-size: 18pt; 24 | } 25 | h2 { 26 | margin-left: -0.5in; 27 | } 28 | h3 { 29 | margin-left: -0.25in; 30 | } 31 | h4 { 32 | margin-left: -0.125in; 33 | } 34 | hr { 35 | margin-left: -1in; 36 | } 37 | 38 | /* Definition lists: definition term bold */ 39 | dt { 40 | font-weight: bold; 41 | } 42 | 43 | address { 44 | text-align: right; 45 | } 46 | /* Use the tag for bits of code and for variables and objects. */ 47 | code,pre,samp,var { 48 | color: #006000; 49 | } 50 | /* Use the tag for file and directory paths and names. */ 51 | file { 52 | color: #905050; 53 | font-family: monospace; 54 | } 55 | /* Use the tag for stuff the user should type. */ 56 | kbd { 57 | color: #600000; 58 | } 59 | div.note p { 60 | float: right; 61 | width: 3in; 62 | margin-right: 0%; 63 | padding: 1px; 64 | border: 2px solid #6060a0; 65 | background-color: #fffff0; 66 | } 67 | 68 | UL.nobullets { 69 | list-style-type: none; 70 | list-style-image: none; 71 | margin-left: -1em; 72 | } 73 | 74 | /* pretty printing styles. See prettify.js */ 75 | .str { color: #080; } 76 | .kwd { color: #008; } 77 | .com { color: #800; } 78 | .typ { color: #606; } 79 | .lit { color: #066; } 80 | .pun { color: #660; } 81 | .pln { color: #000; } 82 | .tag { color: #008; } 83 | .atn { color: #606; } 84 | .atv { color: #080; } 85 | pre.prettyprint { padding: 2px; border: 1px solid #888; } 86 | 87 | .embsrc { background: #eee; } 88 | 89 | @media print { 90 | .str { color: #060; } 91 | .kwd { color: #006; font-weight: bold; } 92 | .com { color: #600; font-style: italic; } 93 | .typ { color: #404; font-weight: bold; } 94 | .lit { color: #044; } 95 | .pun { color: #440; } 96 | .pln { color: #000; } 97 | .tag { color: #006; font-weight: bold; } 98 | .atn { color: #404; } 99 | .atv { color: #060; } 100 | } 101 | 102 | /* Table Column Headers */ 103 | .hdr { 104 | color: #006; 105 | font-weight: bold; 106 | background-color: #dddddd; } 107 | .hdr2 { 108 | color: #006; 109 | background-color: #eeeeee; } -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/heap-example1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/heap-example1.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Gperftools 5 | 6 | 7 | 8 | 14 | 15 |
16 | Last modified: Thu Feb 2 14:40:47 PST 2012 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/overview.dot: -------------------------------------------------------------------------------- 1 | digraph Overview { 2 | node [shape = box] 3 | 4 | {rank=same 5 | T1 [label="Thread Cache"] 6 | Tsep [label="...", shape=plaintext] 7 | Tn [label="Thread Cache"] 8 | T1 -> Tsep -> Tn [style=invis] 9 | } 10 | 11 | C [label="Central\nHeap"] 12 | T1 -> C [dir=both] 13 | Tn -> C [dir=both] 14 | 15 | } 16 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/overview.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/overview.gif -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/pageheap.dot: -------------------------------------------------------------------------------- 1 | digraph PageHeap { 2 | rankdir=LR 3 | node [shape=box, width=0.3, height=0.3] 4 | nodesep=.05 5 | 6 | heap [shape=record, height=3, label="1 page|2 pages|3 pages|...|255 pages|rest"] 7 | O0 [shape=record, label=""] 8 | O1 [shape=record, label=""] 9 | O2 [shape=record, label="{|}"] 10 | O3 [shape=record, label="{|}"] 11 | O4 [shape=record, label="{||}"] 12 | O5 [shape=record, label="{||}"] 13 | O6 [shape=record, label="{|...|}"] 14 | O7 [shape=record, label="{|...|}"] 15 | O8 [shape=record, label="{|.....|}"] 16 | O9 [shape=record, label="{|.....|}"] 17 | sep1 [shape=plaintext, label="..."] 18 | sep2 [shape=plaintext, label="..."] 19 | sep3 [shape=plaintext, label="..."] 20 | sep4 [shape=plaintext, label="..."] 21 | sep5 [shape=plaintext, label="..."] 22 | 23 | heap:f0 -> O0 -> O1 -> sep1 24 | heap:f1 -> O2 -> O3 -> sep2 25 | heap:f2 -> O4 -> O5 -> sep3 26 | heap:f255 -> O6 -> O7 -> sep4 27 | heap:frest -> O8 -> O9 -> sep5 28 | 29 | } 30 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/pageheap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/pageheap.gif -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/pprof-test-big.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/pprof-test-big.gif -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/pprof-test.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/pprof-test.gif -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/pprof-vsnprintf-big.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/pprof-vsnprintf-big.gif -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/pprof-vsnprintf.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/pprof-vsnprintf.gif -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/spanmap.dot: -------------------------------------------------------------------------------- 1 | digraph SpanMap { 2 | node [shape=box, width=0.3, height=0.3] 3 | nodesep=.05 4 | 5 | map [shape=record, width=6, label="||||||||||"] 6 | S0 [label="a"] 7 | S1 [label="b"] 8 | S2 [label="c"] 9 | S3 [label="d"] 10 | map:f0 -> S0 11 | map:f1 -> S0 12 | map:f2 -> S1 13 | map:f3 -> S2 14 | map:f4 -> S2 15 | map:f5 -> S2 16 | map:f6 -> S2 17 | map:f7 -> S2 18 | map:f8 -> S3 19 | map:f9 -> S3 20 | map:f10 -> S3 21 | 22 | } 23 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/spanmap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/spanmap.gif -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.1024.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.1024.bytes.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.128.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.128.bytes.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.131072.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.131072.bytes.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.16384.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.16384.bytes.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.2048.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.2048.bytes.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.256.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.256.bytes.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.32768.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.32768.bytes.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.4096.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.4096.bytes.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.512.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.512.bytes.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.64.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.64.bytes.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.65536.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.65536.bytes.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.8192.bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspercpusec.vs.threads.8192.bytes.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.1.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.1.threads.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.12.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.12.threads.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.16.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.16.threads.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.2.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.2.threads.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.20.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.20.threads.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.3.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.3.threads.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.4.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.4.threads.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.5.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.5.threads.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.8.threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/tcmalloc-opspersec.vs.size.8.threads.png -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/threadheap.dot: -------------------------------------------------------------------------------- 1 | digraph ThreadHeap { 2 | rankdir=LR 3 | node [shape=box, width=0.3, height=0.3] 4 | nodesep=.05 5 | 6 | heap [shape=record, height=2, label="class 0|class 1|class 2|..."] 7 | O0 [label=""] 8 | O1 [label=""] 9 | O2 [label=""] 10 | O3 [label=""] 11 | O4 [label=""] 12 | O5 [label=""] 13 | sep1 [shape=plaintext, label="..."] 14 | sep2 [shape=plaintext, label="..."] 15 | sep3 [shape=plaintext, label="..."] 16 | 17 | heap:f0 -> O0 -> O1 -> sep1 18 | heap:f1 -> O2 -> O3 -> sep2 19 | heap:f2 -> O4 -> O5 -> sep3 20 | 21 | } 22 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/doc/threadheap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/doc/threadheap.gif -------------------------------------------------------------------------------- /proxy/deps/gperftools2/m4/ac_have_attribute.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([AX_C___ATTRIBUTE__], [ 2 | AC_MSG_CHECKING(for __attribute__) 3 | AC_CACHE_VAL(ac_cv___attribute__, [ 4 | AC_TRY_COMPILE( 5 | [#include 6 | static void foo(void) __attribute__ ((unused)); 7 | void foo(void) { exit(1); }], 8 | [], 9 | ac_cv___attribute__=yes, 10 | ac_cv___attribute__=no 11 | )]) 12 | if test "$ac_cv___attribute__" = "yes"; then 13 | AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__]) 14 | fi 15 | AC_MSG_RESULT($ac_cv___attribute__) 16 | ]) 17 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/m4/acx_nanosleep.m4: -------------------------------------------------------------------------------- 1 | # Check for support for nanosleep. It's defined in , but on 2 | # some systems, such as solaris, you need to link in a library to use it. 3 | # We set acx_nanosleep_ok if nanosleep is supported; in that case, 4 | # NANOSLEEP_LIBS is set to whatever libraries are needed to support 5 | # nanosleep. 6 | 7 | AC_DEFUN([ACX_NANOSLEEP], 8 | [AC_MSG_CHECKING(if nanosleep requires any libraries) 9 | AC_LANG_SAVE 10 | AC_LANG_C 11 | acx_nanosleep_ok="no" 12 | NANOSLEEP_LIBS= 13 | # For most folks, this should just work 14 | AC_TRY_LINK([#include ], 15 | [static struct timespec ts; nanosleep(&ts, NULL);], 16 | [acx_nanosleep_ok=yes]) 17 | # For solaris, we may need -lrt 18 | if test "x$acx_nanosleep_ok" != "xyes"; then 19 | OLD_LIBS="$LIBS" 20 | LIBS="-lrt $LIBS" 21 | AC_TRY_LINK([#include ], 22 | [static struct timespec ts; nanosleep(&ts, NULL);], 23 | [acx_nanosleep_ok=yes]) 24 | if test "x$acx_nanosleep_ok" = "xyes"; then 25 | NANOSLEEP_LIBS="-lrt" 26 | fi 27 | LIBS="$OLD_LIBS" 28 | fi 29 | if test "x$acx_nanosleep_ok" != "xyes"; then 30 | AC_MSG_ERROR([cannot find the nanosleep function]) 31 | else 32 | AC_MSG_RESULT(${NANOSLEEP_LIBS:-no}) 33 | fi 34 | AC_LANG_RESTORE 35 | ]) 36 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/m4/compiler_characteristics.m4: -------------------------------------------------------------------------------- 1 | # Check compiler characteristics (e.g. type sizes, PRIxx macros, ...) 2 | 3 | # If types $1 and $2 are compatible, perform action $3 4 | AC_DEFUN([AC_TYPES_COMPATIBLE], 5 | [AC_TRY_COMPILE([#include ], [$1 v1 = 0; $2 v2 = 0; return (&v1 - &v2)], $3)]) 6 | 7 | define(AC_PRIUS_COMMENT, [printf format code for printing a size_t and ssize_t]) 8 | 9 | AC_DEFUN([AC_COMPILER_CHARACTERISTICS], 10 | [AC_CACHE_CHECK(AC_PRIUS_COMMENT, ac_cv_formatting_prius_prefix, 11 | [AC_TYPES_COMPATIBLE(unsigned int, size_t, 12 | ac_cv_formatting_prius_prefix=; ac_cv_prius_defined=1) 13 | AC_TYPES_COMPATIBLE(unsigned long, size_t, 14 | ac_cv_formatting_prius_prefix=l; ac_cv_prius_defined=1) 15 | AC_TYPES_COMPATIBLE(unsigned long long, size_t, 16 | ac_cv_formatting_prius_prefix=ll; ac_cv_prius_defined=1 17 | )]) 18 | if test -z "$ac_cv_prius_defined"; then 19 | ac_cv_formatting_prius_prefix=z; 20 | fi 21 | AC_DEFINE_UNQUOTED(PRIuS, "${ac_cv_formatting_prius_prefix}u", AC_PRIUS_COMMENT) 22 | AC_DEFINE_UNQUOTED(PRIxS, "${ac_cv_formatting_prius_prefix}x", AC_PRIUS_COMMENT) 23 | AC_DEFINE_UNQUOTED(PRIdS, "${ac_cv_formatting_prius_prefix}d", AC_PRIUS_COMMENT) 24 | ]) 25 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/m4/install_prefix.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([AC_INSTALL_PREFIX], 2 | [ac_cv_install_prefix="$prefix"; 3 | if test x"$ac_cv_install_prefix" = x"NONE" ; then 4 | ac_cv_install_prefix="$ac_default_prefix"; 5 | fi 6 | AC_DEFINE_UNQUOTED(INSTALL_PREFIX, "$ac_cv_install_prefix", 7 | [prefix where we look for installed files]) 8 | ]) 9 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/m4/namespaces.m4: -------------------------------------------------------------------------------- 1 | # Checks whether the compiler implements namespaces 2 | AC_DEFUN([AC_CXX_NAMESPACES], 3 | [AC_CACHE_CHECK(whether the compiler implements namespaces, 4 | ac_cv_cxx_namespaces, 5 | [AC_LANG_SAVE 6 | AC_LANG_CPLUSPLUS 7 | AC_TRY_COMPILE([namespace Outer { 8 | namespace Inner { int i = 0; }}], 9 | [using namespace Outer::Inner; return i;], 10 | ac_cv_cxx_namespaces=yes, 11 | ac_cv_cxx_namespaces=no) 12 | AC_LANG_RESTORE]) 13 | if test "$ac_cv_cxx_namespaces" = yes; then 14 | AC_DEFINE(HAVE_NAMESPACES, 1, [define if the compiler implements namespaces]) 15 | fi]) 16 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/m4/program_invocation_name.m4: -------------------------------------------------------------------------------- 1 | # We need to be careful to avoid having the reference to 2 | # program_invocation_name optimized out. We do that by 3 | # returning the value. 4 | 5 | AC_DEFUN([AC_PROGRAM_INVOCATION_NAME], 6 | [AC_CACHE_CHECK( 7 | for program_invocation_name, 8 | ac_cv_have_program_invocation_name, 9 | AC_TRY_LINK([extern char* program_invocation_name;], 10 | [return *program_invocation_name;], 11 | [ac_cv_have_program_invocation_name=yes], 12 | [ac_cv_have_program_invocation_name=no]) 13 | ) 14 | if test "$ac_cv_have_program_invocation_name" = "yes"; then 15 | AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME, 1, 16 | [define if libc has program_invocation_name]) 17 | fi 18 | ]) 19 | 20 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/m4/stl_namespace.m4: -------------------------------------------------------------------------------- 1 | # We check what namespace stl code like vector expects to be executed in 2 | 3 | AC_DEFUN([AC_CXX_STL_NAMESPACE], 4 | [AC_CACHE_CHECK( 5 | what namespace STL code is in, 6 | ac_cv_cxx_stl_namespace, 7 | [AC_REQUIRE([AC_CXX_NAMESPACES]) 8 | AC_LANG_SAVE 9 | AC_LANG_CPLUSPLUS 10 | AC_TRY_COMPILE([#include ], 11 | [vector t; return 0;], 12 | ac_cv_cxx_stl_namespace=none) 13 | AC_TRY_COMPILE([#include ], 14 | [std::vector t; return 0;], 15 | ac_cv_cxx_stl_namespace=std) 16 | AC_LANG_RESTORE]) 17 | if test "$ac_cv_cxx_stl_namespace" = none; then 18 | AC_DEFINE(STL_NAMESPACE,, 19 | [the namespace where STL code like vector<> is defined]) 20 | fi 21 | if test "$ac_cv_cxx_stl_namespace" = std; then 22 | AC_DEFINE(STL_NAMESPACE,std, 23 | [the namespace where STL code like vector<> is defined]) 24 | fi 25 | ]) 26 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/packages/deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # This takes one commandline argument, the name of the package. If no 4 | # name is given, then we'll end up just using the name associated with 5 | # an arbitrary .tar.gz file in the rootdir. That's fine: there's probably 6 | # only one. 7 | # 8 | # Run this from the 'packages' directory, just under rootdir 9 | 10 | ## Set LIB to lib if exporting a library, empty-string else 11 | LIB= 12 | #LIB=lib 13 | 14 | PACKAGE="$1" 15 | VERSION="$2" 16 | 17 | # We can only build Debian packages, if the Debian build tools are installed 18 | if [ \! -x /usr/bin/debuild ]; then 19 | echo "Cannot find /usr/bin/debuild. Not building Debian packages." 1>&2 20 | exit 0 21 | fi 22 | 23 | # Double-check we're in the packages directory, just under rootdir 24 | if [ \! -r ../Makefile -a \! -r ../INSTALL ]; then 25 | echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2 26 | echo "Also, you must run \"make dist\" before running this script." 1>&2 27 | exit 0 28 | fi 29 | 30 | # Find the top directory for this package 31 | topdir="${PWD%/*}" 32 | 33 | # Find the tar archive built by "make dist" 34 | archive="${PACKAGE}-${VERSION}" 35 | archive_with_underscore="${PACKAGE}_${VERSION}" 36 | if [ -z "${archive}" ]; then 37 | echo "Cannot find ../$PACKAGE*.tar.gz. Run \"make dist\" first." 1>&2 38 | exit 0 39 | fi 40 | 41 | # Create a pristine directory for building the Debian package files 42 | trap 'rm -rf '`pwd`/tmp'; exit $?' EXIT SIGHUP SIGINT SIGTERM 43 | 44 | rm -rf tmp 45 | mkdir -p tmp 46 | cd tmp 47 | 48 | # Debian has very specific requirements about the naming of build 49 | # directories, and tar archives. It also wants to write all generated 50 | # packages to the parent of the source directory. We accommodate these 51 | # requirements by building directly from the tar file. 52 | ln -s "${topdir}/${archive}.tar.gz" "${LIB}${archive}.orig.tar.gz" 53 | # Some version of debuilder want foo.orig.tar.gz with _ between versions. 54 | ln -s "${topdir}/${archive}.tar.gz" "${LIB}${archive_with_underscore}.orig.tar.gz" 55 | tar zfx "${LIB}${archive}.orig.tar.gz" 56 | [ -n "${LIB}" ] && mv "${archive}" "${LIB}${archive}" 57 | cd "${LIB}${archive}" 58 | # This is one of those 'specific requirements': where the deb control files live 59 | cp -a "packages/deb" "debian" 60 | 61 | # Now, we can call Debian's standard build tool 62 | debuild -uc -us 63 | cd ../.. # get back to the original top-level dir 64 | 65 | # We'll put the result in a subdirectory that's named after the OS version 66 | # we've made this .deb file for. 67 | destdir="debian-$(cat /etc/debian_version 2>/dev/null || echo UNKNOWN)" 68 | 69 | rm -rf "$destdir" 70 | mkdir -p "$destdir" 71 | mv $(find tmp -mindepth 1 -maxdepth 1 -type f) "$destdir" 72 | 73 | echo 74 | echo "The Debian package files are located in $PWD/$destdir" 75 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/packages/deb/README: -------------------------------------------------------------------------------- 1 | The list of files here isn't complete. For a step-by-step guide on 2 | how to set this package up correctly, check out 3 | http://www.debian.org/doc/maint-guide/ 4 | 5 | Most of the files that are in this directory are boilerplate. 6 | However, you may need to change the list of binary-arch dependencies 7 | in 'rules'. 8 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/packages/deb/compat: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/packages/deb/control: -------------------------------------------------------------------------------- 1 | Source: gperftools 2 | Priority: optional 3 | Maintainer: gperftools Contributors 4 | Build-Depends: debhelper (>= 4.0.0), binutils 5 | Standards-Version: 3.6.1 6 | 7 | Package: libgperftools-dev 8 | Section: libdevel 9 | Architecture: any 10 | Depends: libgperftools0 (= ${Source-Version}) 11 | Description: libraries for CPU and heap analysis, plus an efficient thread-caching malloc 12 | The gperftools package contains some utilities to improve and 13 | analyze the performance of C++ programs. This includes an optimized 14 | thread-caching malloc() and cpu and heap profiling utilities. The 15 | devel package contains static and debug libraries and header files 16 | for developing applications that use the gperftools package. 17 | 18 | Package: libgperftools0 19 | Section: libs 20 | Architecture: any 21 | Depends: ${shlibs:Depends} 22 | Description: libraries for CPU and heap analysis, plus an efficient thread-caching malloc 23 | The gperftools package contains some utilities to improve and 24 | analyze the performance of C++ programs. This includes an optimized 25 | thread-caching malloc() and cpu and heap profiling utilities. 26 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/packages/deb/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by gperftools Contributors 2 | on Sat, 20 Jul 2013 14:21:10 -0700. 3 | 4 | It was downloaded from http://code.google.com/p/gperftools/downloads/list 5 | 6 | Upstream Author: google-perftools@googlegroups.com 7 | 8 | Copyright (c) 2005, Google Inc. 9 | All rights reserved. 10 | 11 | Copyright (c) 2013, gperftools Contributors 12 | All rights reserved. 13 | 14 | Redistribution and use in source and binary forms, with or without 15 | modification, are permitted provided that the following conditions are 16 | met: 17 | 18 | * Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | * Redistributions in binary form must reproduce the above 21 | copyright notice, this list of conditions and the following disclaimer 22 | in the documentation and/or other materials provided with the 23 | distribution. 24 | * Neither the name of Google Inc. nor the names of its 25 | contributors may be used to endorse or promote products derived from 26 | this software without specific prior written permission. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/packages/deb/docs: -------------------------------------------------------------------------------- 1 | AUTHORS 2 | COPYING 3 | ChangeLog 4 | INSTALL 5 | NEWS 6 | README 7 | TODO 8 | doc/cpuprofile.html 9 | doc/cpuprofile-fileformat.html 10 | doc/designstyle.css 11 | doc/heap-example1.png 12 | doc/heap_checker.html 13 | doc/heapprofile.html 14 | doc/index.html 15 | doc/overview.gif 16 | doc/pageheap.gif 17 | doc/pprof-test-big.gif 18 | doc/pprof-test.gif 19 | doc/pprof-vsnprintf-big.gif 20 | doc/pprof-vsnprintf.gif 21 | doc/pprof.1 22 | doc/pprof_remote_servers.html 23 | doc/spanmap.gif 24 | doc/t-test1.times.txt 25 | doc/tcmalloc-opspercpusec.vs.threads.1024.bytes.png 26 | doc/tcmalloc-opspercpusec.vs.threads.128.bytes.png 27 | doc/tcmalloc-opspercpusec.vs.threads.131072.bytes.png 28 | doc/tcmalloc-opspercpusec.vs.threads.16384.bytes.png 29 | doc/tcmalloc-opspercpusec.vs.threads.2048.bytes.png 30 | doc/tcmalloc-opspercpusec.vs.threads.256.bytes.png 31 | doc/tcmalloc-opspercpusec.vs.threads.32768.bytes.png 32 | doc/tcmalloc-opspercpusec.vs.threads.4096.bytes.png 33 | doc/tcmalloc-opspercpusec.vs.threads.512.bytes.png 34 | doc/tcmalloc-opspercpusec.vs.threads.64.bytes.png 35 | doc/tcmalloc-opspercpusec.vs.threads.65536.bytes.png 36 | doc/tcmalloc-opspercpusec.vs.threads.8192.bytes.png 37 | doc/tcmalloc-opspersec.vs.size.1.threads.png 38 | doc/tcmalloc-opspersec.vs.size.12.threads.png 39 | doc/tcmalloc-opspersec.vs.size.16.threads.png 40 | doc/tcmalloc-opspersec.vs.size.2.threads.png 41 | doc/tcmalloc-opspersec.vs.size.20.threads.png 42 | doc/tcmalloc-opspersec.vs.size.3.threads.png 43 | doc/tcmalloc-opspersec.vs.size.4.threads.png 44 | doc/tcmalloc-opspersec.vs.size.5.threads.png 45 | doc/tcmalloc-opspersec.vs.size.8.threads.png 46 | doc/tcmalloc.html 47 | doc/threadheap.gif 48 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/packages/deb/libgperftools-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | usr/lib/pkgconfig 3 | usr/include 4 | usr/include/google 5 | usr/include/gperftools 6 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/packages/deb/libgperftools-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/google/* 2 | usr/include/gperftools/* 3 | usr/lib/lib*.so 4 | usr/lib/lib*.a 5 | usr/lib/*.la 6 | usr/lib/pkgconfig/*.pc 7 | debian/tmp/usr/include/google/* 8 | debian/tmp/usr/include/gperftools/* 9 | debian/tmp/usr/lib/lib*.so 10 | debian/tmp/usr/lib/lib*.a 11 | debian/tmp/usr/lib/*.la 12 | debian/tmp/usr/lib/pkgconfig/*.pc 13 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/packages/deb/libgperftools0.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | usr/bin 3 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/packages/deb/libgperftools0.install: -------------------------------------------------------------------------------- 1 | usr/lib/lib*.so.* 2 | usr/bin/pprof* 3 | debian/tmp/usr/lib/lib*.so.* 4 | debian/tmp/usr/bin/pprof* 5 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/packages/deb/libgperftools0.manpages: -------------------------------------------------------------------------------- 1 | doc/pprof.1 2 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/packages/rpm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # Run this from the 'packages' directory, just under rootdir 4 | 5 | # We can only build rpm packages, if the rpm build tools are installed 6 | if [ \! -x /usr/bin/rpmbuild ] 7 | then 8 | echo "Cannot find /usr/bin/rpmbuild. Not building an rpm." 1>&2 9 | exit 0 10 | fi 11 | 12 | # Check the commandline flags 13 | PACKAGE="$1" 14 | VERSION="$2" 15 | fullname="${PACKAGE}-${VERSION}" 16 | archive=../$fullname.tar.gz 17 | 18 | if [ -z "$1" -o -z "$2" ] 19 | then 20 | echo "Usage: $0 " 1>&2 21 | exit 0 22 | fi 23 | 24 | # Double-check we're in the packages directory, just under rootdir 25 | if [ \! -r ../Makefile -a \! -r ../INSTALL ] 26 | then 27 | echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2 28 | echo "Also, you must run \"make dist\" before running this script." 1>&2 29 | exit 0 30 | fi 31 | 32 | if [ \! -r "$archive" ] 33 | then 34 | echo "Cannot find $archive. Run \"make dist\" first." 1>&2 35 | exit 0 36 | fi 37 | 38 | # Create the directory where the input lives, and where the output should live 39 | RPM_SOURCE_DIR="/tmp/rpmsource-$fullname" 40 | RPM_BUILD_DIR="/tmp/rpmbuild-$fullname" 41 | 42 | trap 'rm -rf $RPM_SOURCE_DIR $RPM_BUILD_DIR; exit $?' EXIT SIGHUP SIGINT SIGTERM 43 | 44 | rm -rf "$RPM_SOURCE_DIR" "$RPM_BUILD_DIR" 45 | mkdir "$RPM_SOURCE_DIR" 46 | mkdir "$RPM_BUILD_DIR" 47 | 48 | cp "$archive" "$RPM_SOURCE_DIR" 49 | 50 | # rpmbuild -- as far as I can tell -- asks the OS what CPU it has. 51 | # This may differ from what kind of binaries gcc produces. dpkg 52 | # does a better job of this, so if we can run 'dpkg --print-architecture' 53 | # to get the build CPU, we use that in preference of the rpmbuild 54 | # default. 55 | target=`dpkg --print-architecture 2>/dev/null || echo ""` 56 | if [ -n "$target" ] 57 | then 58 | target=" --target $target" 59 | fi 60 | 61 | rpmbuild -bb rpm/rpm.spec $target \ 62 | --define "NAME $PACKAGE" \ 63 | --define "VERSION $VERSION" \ 64 | --define "_sourcedir $RPM_SOURCE_DIR" \ 65 | --define "_builddir $RPM_BUILD_DIR" \ 66 | --define "_rpmdir $RPM_SOURCE_DIR" 67 | 68 | # We put the output in a directory based on what system we've built for 69 | destdir=rpm-unknown 70 | if [ -r /etc/issue ] 71 | then 72 | grep "Red Hat.*release 7" /etc/issue >/dev/null 2>&1 && destdir=rh7 73 | grep "Red Hat.*release 8" /etc/issue >/dev/null 2>&1 && destdir=rh8 74 | grep "Red Hat.*release 9" /etc/issue >/dev/null 2>&1 && destdir=rh9 75 | grep "Fedora Core.*release 1" /etc/issue >/dev/null 2>&1 && destdir=fc1 76 | grep "Fedora Core.*release 2" /etc/issue >/dev/null 2>&1 && destdir=fc2 77 | grep "Fedora Core.*release 3" /etc/issue >/dev/null 2>&1 && destdir=fc3 78 | fi 79 | 80 | rm -rf "$destdir" 81 | mkdir -p "$destdir" 82 | # We want to get not only the main package but devel etc, hence the middle * 83 | mv "$RPM_SOURCE_DIR"/*/"${PACKAGE}"-*"${VERSION}"*.rpm "$destdir" 84 | 85 | echo 86 | echo "The rpm package file(s) are located in $PWD/$destdir" 87 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/packages/rpm/rpm.spec: -------------------------------------------------------------------------------- 1 | %define RELEASE 1 2 | %define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE} 3 | %define prefix /usr 4 | 5 | Name: %NAME 6 | Summary: Performance tools for C++ 7 | Version: %VERSION 8 | Release: %rel 9 | Group: Development/Libraries 10 | URL: http://code.google.com/p/gperftools/ 11 | License: BSD 12 | Vendor: gperftools Contributors 13 | Packager: gperftools Contributors 14 | Source: http://%{NAME}.googlecode.com/files/%{NAME}-%{VERSION}.tar.gz 15 | Distribution: Redhat 7 and above. 16 | Buildroot: %{_tmppath}/%{name}-root 17 | Prefix: %prefix 18 | 19 | %description 20 | The %name packages contains some utilities to improve and analyze the 21 | performance of C++ programs. This includes an optimized thread-caching 22 | malloc() and cpu and heap profiling utilities. 23 | 24 | %package devel 25 | Summary: Performance tools for C++ 26 | Group: Development/Libraries 27 | Requires: %{NAME} = %{VERSION} 28 | 29 | %description devel 30 | The %name-devel package contains static and debug libraries and header 31 | files for developing applications that use the %name package. 32 | 33 | %changelog 34 | * Mon Apr 20 2009 35 | - Change build rule to use a configure line more like '%configure' 36 | - Change install to use DESTDIR instead of prefix for configure 37 | - Use wildcards for doc/ and lib/ directories 38 | 39 | * Fri Mar 11 2005 40 | - First draft 41 | 42 | %prep 43 | %setup 44 | 45 | %build 46 | # I can't use '% configure', because it defines -m32 which breaks some 47 | # of the low-level atomicops files in this package. But I do take 48 | # as much from % configure (in /usr/lib/rpm/macros) as I can. 49 | ./configure --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir} 50 | make 51 | 52 | %install 53 | rm -rf $RPM_BUILD_ROOT 54 | make DESTDIR=$RPM_BUILD_ROOT install 55 | 56 | %clean 57 | rm -rf $RPM_BUILD_ROOT 58 | 59 | %files 60 | %defattr(-,root,root) 61 | 62 | %docdir %{prefix}/share/doc/%{NAME}-%{VERSION} 63 | %{prefix}/share/doc/%{NAME}-%{VERSION}/* 64 | 65 | %{_libdir}/*.so.* 66 | %{_bindir}/pprof 67 | %{_mandir}/man1/pprof.1* 68 | 69 | %files devel 70 | %defattr(-,root,root) 71 | 72 | %{_includedir}/google 73 | %{_includedir}/gperftools 74 | %{_libdir}/*.a 75 | %{_libdir}/*.la 76 | %{_libdir}/*.so 77 | %{_libdir}/pkgconfig/*.pc 78 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/base/linuxthreads.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2005-2007, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * --- 31 | * Author: Markus Gutschke 32 | */ 33 | 34 | #ifndef _LINUXTHREADS_H 35 | #define _LINUXTHREADS_H 36 | 37 | /* Include thread_lister.h to get the interface that we implement for linux. 38 | */ 39 | 40 | /* We currently only support x86-32 and x86-64 on Linux. Porting to other 41 | * related platforms should not be difficult. 42 | */ 43 | #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ 44 | defined(__mips__) || defined(__PPC__)) && defined(__linux) 45 | 46 | /* Define the THREADS symbol to make sure that there is exactly one core dumper 47 | * built into the library. 48 | */ 49 | #define THREADS "Linux /proc" 50 | 51 | #endif 52 | 53 | #endif /* _LINUXTHREADS_H */ 54 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/base/spinlock_internal.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * --- 31 | * This file is an internal part spinlock.cc and once.cc 32 | * It may not be used directly by code outside of //base. 33 | */ 34 | 35 | #ifndef BASE_SPINLOCK_INTERNAL_H_ 36 | #define BASE_SPINLOCK_INTERNAL_H_ 37 | 38 | #include 39 | #include "base/basictypes.h" 40 | #include "base/atomicops.h" 41 | 42 | namespace base { 43 | namespace internal { 44 | 45 | // SpinLockWait() waits until it can perform one of several transitions from 46 | // "from" to "to". It returns when it performs a transition where done==true. 47 | struct SpinLockWaitTransition { 48 | int32 from; 49 | int32 to; 50 | bool done; 51 | }; 52 | 53 | // Wait until *w can transition from trans[i].from to trans[i].to for some i 54 | // satisfying 0<=i 35 | #include 36 | #ifdef HAVE_SCHED_H 37 | #include /* For sched_yield() */ 38 | #endif 39 | #include /* For nanosleep() */ 40 | 41 | namespace base { 42 | namespace internal { 43 | 44 | void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop) { 45 | int save_errno = errno; 46 | if (loop == 0) { 47 | } else if (loop == 1) { 48 | sched_yield(); 49 | } else { 50 | struct timespec tm; 51 | tm.tv_sec = 0; 52 | tm.tv_nsec = base::internal::SuggestedDelayNS(loop); 53 | nanosleep(&tm, NULL); 54 | } 55 | errno = save_errno; 56 | } 57 | 58 | void SpinLockWake(volatile Atomic32 *w, bool all) { 59 | } 60 | 61 | } // namespace internal 62 | } // namespace base 63 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/base/spinlock_win32-inl.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * --- 31 | * This file is a Win32-specific part of spinlock_internal.cc 32 | */ 33 | 34 | 35 | #include 36 | 37 | namespace base { 38 | namespace internal { 39 | 40 | void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop) { 41 | if (loop == 0) { 42 | } else if (loop == 1) { 43 | Sleep(0); 44 | } else { 45 | Sleep(base::internal::SuggestedDelayNS(loop) / 1000000); 46 | } 47 | } 48 | 49 | void SpinLockWake(volatile Atomic32 *w, bool all) { 50 | } 51 | 52 | } // namespace internal 53 | } // namespace base 54 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/base/synchronization_profiling.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * --- 31 | * Author: Chris Ruemmler 32 | */ 33 | 34 | #ifndef BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ 35 | #define BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ 36 | 37 | #include "base/basictypes.h" 38 | 39 | namespace base { 40 | 41 | // We can do contention-profiling of SpinLocks, but the code is in 42 | // mutex.cc, which is not always linked in with spinlock. Hence we 43 | // provide a weak definition, which are used if mutex.cc isn't linked in. 44 | 45 | // Submit the number of cycles the spinlock spent contending. 46 | ATTRIBUTE_WEAK extern void SubmitSpinLockProfileData(const void *, int64); 47 | extern void SubmitSpinLockProfileData(const void *contendedlock, 48 | int64 wait_cycles) {} 49 | } 50 | #endif // BASE_AUXILIARY_SYNCHRONIZATION_PROFILING_H_ 51 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/base/thread_lister.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2005-2007, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * --- 31 | * Author: Markus Gutschke 32 | */ 33 | 34 | #include "config.h" 35 | #include /* needed for NULL on some powerpc platforms (?!) */ 36 | #ifdef HAVE_SYS_PRCTL 37 | # include 38 | #endif 39 | #include "base/thread_lister.h" 40 | #include "base/linuxthreads.h" 41 | /* Include other thread listers here that define THREADS macro 42 | * only when they can provide a good implementation. 43 | */ 44 | 45 | #ifndef THREADS 46 | 47 | /* Default trivial thread lister for single-threaded applications, 48 | * or if the multi-threading code has not been ported, yet. 49 | */ 50 | 51 | int ListAllProcessThreads(void *parameter, 52 | ListAllProcessThreadsCallBack callback, ...) { 53 | int rc; 54 | va_list ap; 55 | pid_t pid; 56 | 57 | #ifdef HAVE_SYS_PRCTL 58 | int dumpable = prctl(PR_GET_DUMPABLE, 0); 59 | if (!dumpable) 60 | prctl(PR_SET_DUMPABLE, 1); 61 | #endif 62 | va_start(ap, callback); 63 | pid = getpid(); 64 | rc = callback(parameter, 1, &pid, ap); 65 | va_end(ap); 66 | #ifdef HAVE_SYS_PRCTL 67 | if (!dumpable) 68 | prctl(PR_SET_DUMPABLE, 0); 69 | #endif 70 | return rc; 71 | } 72 | 73 | int ResumeAllProcessThreads(int num_threads, pid_t *thread_pids) { 74 | return 1; 75 | } 76 | 77 | #endif /* ifndef THREADS */ 78 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/google/heap-checker.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | /* The code has moved to gperftools/. Use that include-directory for 31 | * new code. 32 | */ 33 | #include 34 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/google/heap-profiler.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2005, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /* The code has moved to gperftools/. Use that include-directory for 32 | * new code. 33 | */ 34 | #include 35 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/google/malloc_extension.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | /* The code has moved to gperftools/. Use that include-directory for 31 | * new code. 32 | */ 33 | #include 34 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/google/malloc_extension_c.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /* The code has moved to gperftools/. Use that include-directory for 32 | * new code. 33 | */ 34 | #include 35 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/google/malloc_hook.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | /* The code has moved to gperftools/. Use that include-directory for 31 | * new code. 32 | */ 33 | #include 34 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/google/malloc_hook_c.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /* The code has moved to gperftools/. Use that include-directory for 32 | * new code. 33 | */ 34 | #include 35 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/google/profiler.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2005, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /* The code has moved to gperftools/. Use that include-directory for 32 | * new code. 33 | */ 34 | #include 35 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/google/stacktrace.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | /* The code has moved to gperftools/. Use that include-directory for 31 | * new code. 32 | */ 33 | #include 34 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/google/tcmalloc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2003, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | /* The code has moved to gperftools/. Use that include-directory for 32 | * new code. 33 | */ 34 | #include 35 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/maybe_threads.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: Paul Menage 32 | 33 | //------------------------------------------------------------------- 34 | // Some wrappers for pthread functions so that we can be LD_PRELOADed 35 | // against non-pthreads apps. 36 | //------------------------------------------------------------------- 37 | 38 | #ifndef GOOGLE_MAYBE_THREADS_H_ 39 | #define GOOGLE_MAYBE_THREADS_H_ 40 | 41 | #ifdef HAVE_PTHREAD 42 | #include 43 | #endif 44 | 45 | int perftools_pthread_key_create(pthread_key_t *key, 46 | void (*destr_function) (void *)); 47 | void *perftools_pthread_getspecific(pthread_key_t key); 48 | int perftools_pthread_setspecific(pthread_key_t key, void *val); 49 | int perftools_pthread_once(pthread_once_t *ctl, 50 | void (*init_routine) (void)); 51 | 52 | #endif /* GOOGLE_MAYBE_THREADS_H_ */ 53 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/raw_printer.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: sanjay@google.com (Sanjay Ghemawat) 32 | 33 | #include 34 | #include 35 | #include 36 | #include "raw_printer.h" 37 | #include "base/logging.h" 38 | 39 | namespace base { 40 | 41 | RawPrinter::RawPrinter(char* buf, int length) 42 | : base_(buf), 43 | ptr_(buf), 44 | limit_(buf + length - 1) { 45 | RAW_DCHECK(length > 0, ""); 46 | *ptr_ = '\0'; 47 | *limit_ = '\0'; 48 | } 49 | 50 | void RawPrinter::Printf(const char* format, ...) { 51 | if (limit_ > ptr_) { 52 | va_list ap; 53 | va_start(ap, format); 54 | int avail = limit_ - ptr_; 55 | // We pass avail+1 to vsnprintf() since that routine needs room 56 | // to store the trailing \0. 57 | const int r = perftools_vsnprintf(ptr_, avail+1, format, ap); 58 | va_end(ap); 59 | if (r < 0) { 60 | // Perhaps an old glibc that returns -1 on truncation? 61 | ptr_ = limit_; 62 | } else if (r > avail) { 63 | // Truncation 64 | ptr_ = limit_; 65 | } else { 66 | ptr_ += r; 67 | } 68 | } 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/solaris/libstdc++.la: -------------------------------------------------------------------------------- 1 | # libstdc++.la - a libtool library file 2 | # Generated by ltmain.sh - GNU libtool 1.4a-GCC3.0 (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes) 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # --- 8 | # NOTE: This file lives in /usr/sfw/lib on Solaris 10. Unfortunately, 9 | # due to an apparent bug in the Solaris 10 6/06 release, 10 | # /usr/sfw/lib/libstdc++.la is empty. Below is the correct content, 11 | # according to 12 | # http://forum.java.sun.com/thread.jspa?threadID=5073150 13 | # By passing LDFLAGS='-Lsrc/solaris' to configure, make will pick up 14 | # this copy of the file rather than the empty copy in /usr/sfw/lib. 15 | # 16 | # Also see 17 | # http://www.technicalarticles.org/index.php/Compiling_MySQL_5.0_on_Solaris_10 18 | # 19 | # Note: this is for 32-bit systems. If you have a 64-bit system, 20 | # uncomment the appropriate dependency_libs line below. 21 | # ---- 22 | 23 | # The name that we can dlopen(3). 24 | dlname='libstdc++.so.6' 25 | 26 | # Names of this library. 27 | library_names='libstdc++.so.6.0.3 libstdc++.so.6 libstdc++.so' 28 | 29 | # The name of the static archive. 30 | old_library='libstdc++.a' 31 | 32 | # Libraries that this one depends upon. 33 | # 32-bit version: 34 | dependency_libs='-lc -lm -L/usr/sfw/lib -lgcc_s' 35 | # 64-bit version: 36 | #dependency_libs='-L/lib/64 -lc -lm -L/usr/sfw/lib/64 -lgcc_s' 37 | 38 | # Version information for libstdc++. 39 | current=6 40 | age=0 41 | revision=3 42 | 43 | # Is this an already installed library? 44 | installed=yes 45 | 46 | # Files to dlopen/dlpreopen 47 | dlopen='' 48 | dlpreopen='' 49 | 50 | # Directory that this library needs to be installed in: 51 | libdir='/usr/sfw/lib' 52 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/tcmalloc_guard.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: Craig Silverstein 32 | // 33 | // We expose the TCMallocGuard class -- which initializes the tcmalloc 34 | // allocator -- so classes that need to be sure tcmalloc is loaded 35 | // before they do stuff -- notably heap-profiler -- can. To use this 36 | // create a static TCMallocGuard instance at the top of a file where 37 | // you need tcmalloc to be initialized before global constructors run. 38 | 39 | #ifndef TCMALLOC_TCMALLOC_GUARD_H_ 40 | #define TCMALLOC_TCMALLOC_GUARD_H_ 41 | 42 | class TCMallocGuard { 43 | public: 44 | TCMallocGuard(); 45 | ~TCMallocGuard(); 46 | }; 47 | 48 | #endif // TCMALLOC_TCMALLOC_GUARD_H_ 49 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/tests/current_allocated_bytes_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // --- 30 | // 31 | // Author: Craig Silverstein 32 | 33 | // This tests the accounting done by tcmalloc. When we allocate and 34 | // free a small buffer, the number of bytes used by the application 35 | // before the alloc+free should match the number of bytes used after. 36 | // However, the internal data structures used by tcmalloc will be 37 | // quite different -- new spans will have been allocated, etc. This 38 | // is, thus, a simple test that we account properly for the internal 39 | // data structures, so that we report the actual application-used 40 | // bytes properly. 41 | 42 | #include "config_for_unittests.h" 43 | #include 44 | #include 45 | #include 46 | #include "base/logging.h" 47 | 48 | const char kCurrent[] = "generic.current_allocated_bytes"; 49 | 50 | int main() { 51 | // We don't do accounting right when using debugallocation.cc, so 52 | // turn off the test then. TODO(csilvers): get this working too. 53 | #ifdef NDEBUG 54 | size_t before_bytes, after_bytes; 55 | MallocExtension::instance()->GetNumericProperty(kCurrent, &before_bytes); 56 | free(malloc(200)); 57 | MallocExtension::instance()->GetNumericProperty(kCurrent, &after_bytes); 58 | 59 | CHECK_EQ(before_bytes, after_bytes); 60 | #endif 61 | printf("PASS\n"); 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/tests/large_heap_fragmentation_unittest.cc: -------------------------------------------------------------------------------- 1 | // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- 2 | // Redistribution and use in source and binary forms, with or without 3 | // modification, are permitted provided that the following conditions are 4 | // met: 5 | // 6 | // * Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // * Redistributions in binary form must reproduce the above 9 | // copyright notice, this list of conditions and the following disclaimer 10 | // in the documentation and/or other materials provided with the 11 | // distribution. 12 | // * Neither the name of Google Inc. nor the names of its 13 | // contributors may be used to endorse or promote products derived from 14 | // this software without specific prior written permission. 15 | // 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | // This is a unit test for exercising fragmentation of large (over 1 29 | // meg) page spans. It makes sure that allocations/releases of 30 | // increasing memory chunks do not blowup memory 31 | // usage. See also https://code.google.com/p/gperftools/issues/detail?id=368 32 | 33 | 34 | #include 35 | #include 36 | #include 37 | 38 | #include "base/logging.h" 39 | #include "common.h" 40 | #include 41 | 42 | 43 | int main (int argc, char** argv) { 44 | for (int pass = 1; pass <= 3; pass++) { 45 | size_t size = 100*1024*1024; 46 | while (size < 500*1024*1024) { 47 | void *ptr = malloc(size); 48 | free(ptr); 49 | size += 20000; 50 | 51 | size_t heap_size = static_cast(-1); 52 | MallocExtension::instance()->GetNumericProperty("generic.heap_size", 53 | &heap_size); 54 | 55 | 56 | CHECK_LT(heap_size, 1*1024*1024*1024); 57 | } 58 | } 59 | 60 | printf("PASS\n"); 61 | return 0; 62 | } 63 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/tests/packed-cache_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2007, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // --- 31 | // Author: Geoff Pike 32 | 33 | #include 34 | #include "base/logging.h" 35 | #include "packed-cache-inl.h" 36 | 37 | static const int kHashbits = PackedCache<64, uint64>::kHashbits; 38 | 39 | // A basic sanity test. 40 | void PackedCacheTest_basic() { 41 | PackedCache<32, uint32> cache(0); 42 | CHECK_EQ(cache.GetOrDefault(0, 1), 0); 43 | cache.Put(0, 17); 44 | CHECK(cache.Has(0)); 45 | CHECK_EQ(cache.GetOrDefault(0, 1), 17); 46 | cache.Put(19, 99); 47 | CHECK(cache.Has(0) && cache.Has(19)); 48 | CHECK_EQ(cache.GetOrDefault(0, 1), 17); 49 | CHECK_EQ(cache.GetOrDefault(19, 1), 99); 50 | // Knock <0, 17> out by using a conflicting key. 51 | cache.Put(1 << kHashbits, 22); 52 | CHECK(!cache.Has(0)); 53 | CHECK_EQ(cache.GetOrDefault(0, 1), 1); 54 | CHECK_EQ(cache.GetOrDefault(1 << kHashbits, 1), 22); 55 | } 56 | 57 | int main(int argc, char **argv) { 58 | PackedCacheTest_basic(); 59 | 60 | printf("PASS\n"); 61 | return 0; 62 | } 63 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/tests/raw_printer_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009 Google Inc. All Rights Reserved. 2 | // Author: sanjay@google.com (Sanjay Ghemawat) 3 | 4 | #include "raw_printer.h" 5 | #include 6 | #include 7 | #include "base/logging.h" 8 | 9 | using std::string; 10 | 11 | #define TEST(a, b) void TEST_##a##_##b() 12 | #define RUN_TEST(a, b) TEST_##a##_##b() 13 | 14 | TEST(RawPrinter, Empty) { 15 | char buffer[1]; 16 | base::RawPrinter printer(buffer, arraysize(buffer)); 17 | CHECK_EQ(0, printer.length()); 18 | CHECK_EQ(string(""), buffer); 19 | CHECK_EQ(0, printer.space_left()); 20 | printer.Printf("foo"); 21 | CHECK_EQ(string(""), string(buffer)); 22 | CHECK_EQ(0, printer.length()); 23 | CHECK_EQ(0, printer.space_left()); 24 | } 25 | 26 | TEST(RawPrinter, PartiallyFilled) { 27 | char buffer[100]; 28 | base::RawPrinter printer(buffer, arraysize(buffer)); 29 | printer.Printf("%s %s", "hello", "world"); 30 | CHECK_EQ(string("hello world"), string(buffer)); 31 | CHECK_EQ(11, printer.length()); 32 | CHECK_LT(0, printer.space_left()); 33 | } 34 | 35 | TEST(RawPrinter, Truncated) { 36 | char buffer[3]; 37 | base::RawPrinter printer(buffer, arraysize(buffer)); 38 | printer.Printf("%d", 12345678); 39 | CHECK_EQ(string("12"), string(buffer)); 40 | CHECK_EQ(2, printer.length()); 41 | CHECK_EQ(0, printer.space_left()); 42 | } 43 | 44 | TEST(RawPrinter, ExactlyFilled) { 45 | char buffer[12]; 46 | base::RawPrinter printer(buffer, arraysize(buffer)); 47 | printer.Printf("%s %s", "hello", "world"); 48 | CHECK_EQ(string("hello world"), string(buffer)); 49 | CHECK_EQ(11, printer.length()); 50 | CHECK_EQ(0, printer.space_left()); 51 | } 52 | 53 | int main(int argc, char **argv) { 54 | RUN_TEST(RawPrinter, Empty); 55 | RUN_TEST(RawPrinter, PartiallyFilled); 56 | RUN_TEST(RawPrinter, Truncated); 57 | RUN_TEST(RawPrinter, ExactlyFilled); 58 | printf("PASS\n"); 59 | return 0; // 0 means success 60 | } 61 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/tests/tcmalloc_unittest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright (c) 2013, Google Inc. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # --- 33 | # Author: Adhemerval Zanella 34 | # 35 | # Runs the tcmalloc_unittest with various environment variables. 36 | # This is necessary because tuning some environment variables 37 | # (TCMALLOC_TRANSFER_NUM_OBJ for instance) should not change program 38 | # behavior, just performance. 39 | 40 | BINDIR="${BINDIR:-.}" 41 | TCMALLOC_UNITTEST="${1:-$BINDIR}/tcmalloc_unittest" 42 | 43 | TMPDIR=/tmp/tcmalloc_unittest 44 | rm -rf $TMPDIR || exit 2 45 | mkdir $TMPDIR || exit 3 46 | 47 | # $1: value of tcmalloc_unittest env. var. 48 | run_check_transfer_num_obj() { 49 | [ -n "$1" ] && export TCMALLOC_TRANSFER_NUM_OBJ="$1" 50 | 51 | echo -n "Testing $TCMALLOC_UNITTEST with TCMALLOC_TRANSFER_NUM_OBJ=$1 ... " 52 | if $TCMALLOC_UNITTEST > $TMPDIR/output 2>&1; then 53 | echo "OK" 54 | else 55 | echo "FAILED" 56 | echo "Output from the failed run:" 57 | echo "----" 58 | cat $TMPDIR/output 59 | echo "----" 60 | exit 4 61 | fi 62 | } 63 | 64 | run_check_transfer_num_obj "" 65 | run_check_transfer_num_obj "40" 66 | run_check_transfer_num_obj "4096" 67 | 68 | echo "PASS" 69 | -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/windows/ia32_modrm_map.cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/src/windows/ia32_modrm_map.cc -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/windows/ia32_opcode_map.cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/src/windows/ia32_opcode_map.cc -------------------------------------------------------------------------------- /proxy/deps/gperftools2/src/windows/mini_disassembler.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/deps/gperftools2/src/windows/mini_disassembler.h -------------------------------------------------------------------------------- /proxy/deps/libevent2/Makefile.nmake: -------------------------------------------------------------------------------- 1 | # WATCH OUT! This makefile is a work in progress. It is probably missing 2 | # tons of important things. DO NOT RELY ON IT TO BUILD A GOOD LIBEVENT. 3 | 4 | # Needed for correctness 5 | CFLAGS=/IWIN32-Code /Iinclude /Icompat /DWIN32 /DHAVE_CONFIG_H /I. 6 | 7 | # For optimization and warnings 8 | CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo 9 | 10 | # XXXX have a debug mode 11 | 12 | LIBFLAGS=/nologo 13 | 14 | CORE_OBJS=event.obj buffer.obj bufferevent.obj bufferevent_sock.obj \ 15 | bufferevent_pair.obj listener.obj evmap.obj log.obj evutil.obj \ 16 | strlcpy.obj signal.obj bufferevent_filter.obj evthread.obj \ 17 | bufferevent_ratelim.obj evutil_rand.obj 18 | WIN_OBJS=win32select.obj evthread_win32.obj buffer_iocp.obj \ 19 | event_iocp.obj bufferevent_async.obj 20 | EXTRA_OBJS=event_tagging.obj http.obj evdns.obj evrpc.obj 21 | 22 | ALL_OBJS=$(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS) 23 | STATIC_LIBS=libevent_core.lib libevent_extras.lib libevent.lib 24 | 25 | 26 | all: static_libs tests 27 | 28 | static_libs: $(STATIC_LIBS) 29 | 30 | libevent_core.lib: $(CORE_OBJS) $(WIN_OBJS) 31 | lib $(LIBFLAGS) $(CORE_OBJS) $(WIN_OBJS) /out:libevent_core.lib 32 | 33 | libevent_extras.lib: $(EXTRA_OBJS) 34 | lib $(LIBFLAGS) $(EXTRA_OBJS) /out:libevent_extras.lib 35 | 36 | libevent.lib: $(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS) 37 | lib $(LIBFLAGS) $(CORE_OBJS) $(EXTRA_OBJS) $(WIN_OBJS) /out:libevent.lib 38 | 39 | clean: 40 | del $(ALL_OBJS) 41 | del $(STATIC_LIBS) 42 | cd test 43 | $(MAKE) /F Makefile.nmake clean 44 | 45 | tests: 46 | cd test 47 | $(MAKE) /F Makefile.nmake 48 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ -x "`which autoreconf 2>/dev/null`" ] ; then 3 | exec autoreconf -ivf 4 | fi 5 | 6 | LIBTOOLIZE=libtoolize 7 | SYSNAME=`uname` 8 | if [ "x$SYSNAME" = "xDarwin" ] ; then 9 | LIBTOOLIZE=glibtoolize 10 | fi 11 | aclocal -I m4 && \ 12 | autoheader && \ 13 | $LIBTOOLIZE && \ 14 | autoconf && \ 15 | automake --add-missing --force-missing --copy 16 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/epoll_sub.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2003-2009 Niels Provos 3 | * Copyright 2009-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #include 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | int 36 | epoll_create(int size) 37 | { 38 | return (syscall(__NR_epoll_create, size)); 39 | } 40 | 41 | int 42 | epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) 43 | { 44 | 45 | return (syscall(__NR_epoll_ctl, epfd, op, fd, event)); 46 | } 47 | 48 | int 49 | epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout) 50 | { 51 | return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout)); 52 | } 53 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/evdns.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVDNS_H_ 28 | #define _EVDNS_H_ 29 | 30 | /** @file evdns.h 31 | 32 | A dns subsystem for Libevent. 33 | 34 | The header is deprecated in Libevent 2.0 and later; please 35 | use instead. Depending on what functionality you 36 | need, you may also want to include more of the other 37 | headers. 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #endif /* _EVDNS_H_ */ 46 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/evhttp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2007 Niels Provos 3 | * Copyright 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVHTTP_H_ 28 | #define _EVHTTP_H_ 29 | 30 | /** @file evhttp.h 31 | 32 | An http implementation subsystem for Libevent. 33 | 34 | The header is deprecated in Libevent 2.0 and later; please 35 | use instead. Depending on what functionality you 36 | need, you may also want to include more of the other 37 | headers. 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #endif /* _EVHTTP_H_ */ 46 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/evrpc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVRPC_H_ 28 | #define _EVRPC_H_ 29 | 30 | /** @file evrpc.h 31 | 32 | An RPC system for Libevent. 33 | 34 | The header is deprecated in Libevent 2.0 and later; please 35 | use instead. Depending on what functionality you 36 | need, you may also want to include more of the other 37 | headers. 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #endif /* _EVRPC_H_ */ 46 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/evsignal-internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2007 Niels Provos 3 | * Copyright 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVSIGNAL_H_ 28 | #define _EVSIGNAL_H_ 29 | 30 | #ifndef evutil_socket_t 31 | #include "event2/util.h" 32 | #endif 33 | #include 34 | 35 | typedef void (*ev_sighandler_t)(int); 36 | 37 | /* Data structure for the default signal-handling implementation in signal.c 38 | */ 39 | struct evsig_info { 40 | /* Event watching ev_signal_pair[1] */ 41 | struct event ev_signal; 42 | /* Socketpair used to send notifications from the signal handler */ 43 | evutil_socket_t ev_signal_pair[2]; 44 | /* True iff we've added the ev_signal event yet. */ 45 | int ev_signal_added; 46 | /* Count of the number of signals we're currently watching. */ 47 | int ev_n_signals_added; 48 | 49 | /* Array of previous signal handler objects before Libevent started 50 | * messing with them. Used to restore old signal handlers. */ 51 | #ifdef _EVENT_HAVE_SIGACTION 52 | struct sigaction **sh_old; 53 | #else 54 | ev_sighandler_t **sh_old; 55 | #endif 56 | /* Size of sh_old. */ 57 | int sh_old_max; 58 | }; 59 | int evsig_init(struct event_base *); 60 | void evsig_dealloc(struct event_base *); 61 | 62 | void evsig_set_base(struct event_base *base); 63 | 64 | #endif /* _EVSIGNAL_H_ */ 65 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/evutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | #ifndef _EVUTIL_H_ 27 | #define _EVUTIL_H_ 28 | 29 | /** @file evutil.h 30 | 31 | Utility and compatibility functions for Libevent. 32 | 33 | The header is deprecated in Libevent 2.0 and later; please 34 | use instead. 35 | */ 36 | 37 | #include 38 | 39 | #endif /* _EVUTIL_H_ */ 40 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/include/Makefile.am: -------------------------------------------------------------------------------- 1 | # include/Makefile.am for libevent 2 | # Copyright 2000-2007 Niels Provos 3 | # Copyright 2007-2012 Niels Provos and Nick Mathewson 4 | # 5 | # See LICENSE for copying information. 6 | 7 | AUTOMAKE_OPTIONS = foreign 8 | 9 | EVENT2_EXPORT = \ 10 | event2/buffer.h \ 11 | event2/buffer_compat.h \ 12 | event2/bufferevent.h \ 13 | event2/bufferevent_compat.h \ 14 | event2/bufferevent_ssl.h \ 15 | event2/bufferevent_struct.h \ 16 | event2/dns.h \ 17 | event2/dns_compat.h \ 18 | event2/dns_struct.h \ 19 | event2/event.h \ 20 | event2/event_compat.h \ 21 | event2/event_struct.h \ 22 | event2/http.h \ 23 | event2/http_compat.h \ 24 | event2/http_struct.h \ 25 | event2/keyvalq_struct.h \ 26 | event2/listener.h \ 27 | event2/rpc.h \ 28 | event2/rpc_compat.h \ 29 | event2/rpc_struct.h \ 30 | event2/tag.h \ 31 | event2/tag_compat.h \ 32 | event2/thread.h \ 33 | event2/util.h 34 | 35 | EXTRA_SRC = $(EVENT2_EXPORT) 36 | 37 | ## Without the nobase_ prefixing, Automake would strip "event2/" from 38 | ## the source header filename to derive the installed header filename. 39 | ## With nobase_ the installed path is $(includedir)/event2/ev*.h. 40 | 41 | if INSTALL_LIBEVENT 42 | nobase_include_HEADERS = $(EVENT2_EXPORT) 43 | nobase_nodist_include_HEADERS = ./event2/event-config.h 44 | else 45 | noinst_HEADERS = $(EVENT2_EXPORT) 46 | nodist_noinst_HEADERS = ./event2/event-config.h 47 | endif 48 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/include/event2/dns_struct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVENT2_DNS_STRUCT_H_ 28 | #define _EVENT2_DNS_STRUCT_H_ 29 | 30 | /** @file event2/dns_struct.h 31 | 32 | Data structures for dns. Using these structures may hurt forward 33 | compatibility with later versions of Libevent: be careful! 34 | 35 | */ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | #include 42 | #ifdef _EVENT_HAVE_SYS_TYPES_H 43 | #include 44 | #endif 45 | #ifdef _EVENT_HAVE_SYS_TIME_H 46 | #include 47 | #endif 48 | 49 | /* For int types. */ 50 | #include 51 | 52 | /* 53 | * Structures used to implement a DNS server. 54 | */ 55 | 56 | struct evdns_server_request { 57 | int flags; 58 | int nquestions; 59 | struct evdns_server_question **questions; 60 | }; 61 | struct evdns_server_question { 62 | int type; 63 | #ifdef __cplusplus 64 | int dns_question_class; 65 | #else 66 | /* You should refer to this field as "dns_question_class". The 67 | * name "class" works in C for backward compatibility, and will be 68 | * removed in a future version. (1.5 or later). */ 69 | int class; 70 | #define dns_question_class class 71 | #endif 72 | char name[1]; 73 | }; 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif /* _EVENT2_DNS_STRUCT_H_ */ 80 | 81 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/include/event2/keyvalq_struct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVENT2_EVENT_KEYVALQ_STRUCT_H_ 28 | #define _EVENT2_EVENT_KEYVALQ_STRUCT_H_ 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /* Fix so that people don't have to run with */ 35 | /* XXXX This code is duplicated with event_struct.h */ 36 | #ifndef TAILQ_ENTRY 37 | #define _EVENT_DEFINED_TQENTRY 38 | #define TAILQ_ENTRY(type) \ 39 | struct { \ 40 | struct type *tqe_next; /* next element */ \ 41 | struct type **tqe_prev; /* address of previous next element */ \ 42 | } 43 | #endif /* !TAILQ_ENTRY */ 44 | 45 | #ifndef TAILQ_HEAD 46 | #define _EVENT_DEFINED_TQHEAD 47 | #define TAILQ_HEAD(name, type) \ 48 | struct name { \ 49 | struct type *tqh_first; \ 50 | struct type **tqh_last; \ 51 | } 52 | #endif 53 | 54 | /* 55 | * Key-Value pairs. Can be used for HTTP headers but also for 56 | * query argument parsing. 57 | */ 58 | struct evkeyval { 59 | TAILQ_ENTRY(evkeyval) next; 60 | 61 | char *key; 62 | char *value; 63 | }; 64 | 65 | TAILQ_HEAD (evkeyvalq, evkeyval); 66 | 67 | /* XXXX This code is duplicated with event_struct.h */ 68 | #ifdef _EVENT_DEFINED_TQENTRY 69 | #undef TAILQ_ENTRY 70 | #endif 71 | 72 | #ifdef _EVENT_DEFINED_TQHEAD 73 | #undef TAILQ_HEAD 74 | #endif 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/include/event2/rpc_compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVENT2_RPC_COMPAT_H_ 28 | #define _EVENT2_RPC_COMPAT_H_ 29 | 30 | /** @file event2/rpc_compat.h 31 | 32 | Deprecated versions of the functions in rpc.h: provided only for 33 | backwards compatibility. 34 | 35 | */ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** backwards compatible accessors that work only with gcc */ 42 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) 43 | 44 | #undef EVTAG_ASSIGN 45 | #undef EVTAG_GET 46 | #undef EVTAG_ADD 47 | 48 | #define EVTAG_ASSIGN(msg, member, args...) \ 49 | (*(msg)->base->member##_assign)(msg, ## args) 50 | #define EVTAG_GET(msg, member, args...) \ 51 | (*(msg)->base->member##_get)(msg, ## args) 52 | #define EVTAG_ADD(msg, member, args...) \ 53 | (*(msg)->base->member##_add)(msg, ## args) 54 | #endif 55 | #define EVTAG_LEN(msg, member) ((msg)->member##_length) 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif /* _EVENT2_EVENT_COMPAT_H_ */ 62 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/include/event2/tag_compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVENT2_TAG_COMPAT_H_ 28 | #define _EVENT2_TAG_COMPAT_H_ 29 | 30 | /** @file event2/tag_compat.h 31 | 32 | Obsolete/deprecated functions from tag.h; provided only for backwards 33 | compatibility. 34 | */ 35 | 36 | /** 37 | @name Misnamed functions 38 | 39 | @deprecated These macros are deprecated because their names don't follow 40 | Libevent's naming conventions. Use evtag_encode_int and 41 | evtag_encode_int64 instead. 42 | 43 | @{ 44 | */ 45 | #define encode_int(evbuf, number) evtag_encode_int((evbuf), (number)) 46 | #define encode_int64(evbuf, number) evtag_encode_int64((evbuf), (number)) 47 | /**@}*/ 48 | 49 | #endif /* _EVENT2_TAG_H_ */ 50 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/ipv6-internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | /* Internal use only: Fake IPv6 structures and values on platforms that 28 | * do not have them */ 29 | 30 | #ifndef _EVENT_IPV6_INTERNAL_H 31 | #define _EVENT_IPV6_INTERNAL_H 32 | 33 | #include 34 | #ifdef _EVENT_HAVE_SYS_SOCKET_H 35 | #include 36 | #endif 37 | #include "event2/event-config.h" 38 | #include "event2/util.h" 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | /** @file ipv6-internal.h 45 | * 46 | * Replacement types and functions for platforms that don't support ipv6 47 | * properly. 48 | */ 49 | 50 | #ifndef _EVENT_HAVE_STRUCT_IN6_ADDR 51 | struct in6_addr { 52 | ev_uint8_t s6_addr[16]; 53 | }; 54 | #endif 55 | 56 | #ifndef _EVENT_HAVE_SA_FAMILY_T 57 | typedef int sa_family_t; 58 | #endif 59 | 60 | #ifndef _EVENT_HAVE_STRUCT_SOCKADDR_IN6 61 | struct sockaddr_in6 { 62 | /* This will fail if we find a struct sockaddr that doesn't have 63 | * sa_family as the first element. */ 64 | sa_family_t sin6_family; 65 | ev_uint16_t sin6_port; 66 | struct in6_addr sin6_addr; 67 | }; 68 | #endif 69 | 70 | #ifndef AF_INET6 71 | #define AF_INET6 3333 72 | #endif 73 | #ifndef PF_INET6 74 | #define PF_INET6 AF_INET6 75 | #endif 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/libevent.pc.in: -------------------------------------------------------------------------------- 1 | #libevent pkg-config source file 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: libevent 9 | Description: libevent is an asynchronous notification event loop library 10 | Version: @VERSION@ 11 | Requires: 12 | Conflicts: 13 | Libs: -L${libdir} -levent 14 | Libs.private: @LIBS@ 15 | Cflags: -I${includedir} 16 | 17 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/libevent_openssl.pc.in: -------------------------------------------------------------------------------- 1 | #libevent pkg-config source file 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: libevent_openssl 9 | Description: libevent_openssl adds openssl-based TLS support to libevent 10 | Version: @VERSION@ 11 | Requires: libevent 12 | Conflicts: 13 | Libs: -L${libdir} -levent_openssl 14 | Libs.private: @LIBS@ -lssl -lcrypto 15 | Cflags: -I${includedir} 16 | 17 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/libevent_pthreads.pc.in: -------------------------------------------------------------------------------- 1 | #libevent pkg-config source file 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: libevent_pthreads 9 | Description: libevent_pthreads adds pthreads-based threading support to libevent 10 | Version: @VERSION@ 11 | Requires: libevent 12 | Conflicts: 13 | Libs: -L${libdir} -levent_pthreads 14 | Libs.private: @LIBS@ @PTHREAD_LIBS@ 15 | Cflags: -I${includedir} @PTHREAD_CFLAGS@ 16 | 17 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/log-internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _LOG_H_ 28 | #define _LOG_H_ 29 | 30 | #include "event2/util.h" 31 | 32 | #ifdef __GNUC__ 33 | #define EV_CHECK_FMT(a,b) __attribute__((format(printf, a, b))) 34 | #define EV_NORETURN __attribute__((noreturn)) 35 | #else 36 | #define EV_CHECK_FMT(a,b) 37 | #define EV_NORETURN 38 | #endif 39 | 40 | #define _EVENT_ERR_ABORT ((int)0xdeaddead) 41 | 42 | void event_err(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN; 43 | void event_warn(const char *fmt, ...) EV_CHECK_FMT(1,2); 44 | void event_sock_err(int eval, evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(3,4) EV_NORETURN; 45 | void event_sock_warn(evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(2,3); 46 | void event_errx(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN; 47 | void event_warnx(const char *fmt, ...) EV_CHECK_FMT(1,2); 48 | void event_msgx(const char *fmt, ...) EV_CHECK_FMT(1,2); 49 | void _event_debugx(const char *fmt, ...) EV_CHECK_FMT(1,2); 50 | 51 | #ifdef USE_DEBUG 52 | #define event_debug(x) _event_debugx x 53 | #else 54 | #define event_debug(x) do {;} while (0) 55 | #endif 56 | 57 | #undef EV_CHECK_FMT 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/make-event-config.sed: -------------------------------------------------------------------------------- 1 | # Sed script to postprocess config.h into event-config.h. 2 | 3 | 1i\ 4 | /* event2/event-config.h\ 5 | *\ 6 | * This file was generated by autoconf when libevent was built, and post-\ 7 | * processed by Libevent so that its macros would have a uniform prefix.\ 8 | *\ 9 | * DO NOT EDIT THIS FILE.\ 10 | *\ 11 | * Do not rely on macros in this file existing in later versions.\ 12 | */\ 13 | \ 14 | #ifndef _EVENT2_EVENT_CONFIG_H_\ 15 | #define _EVENT2_EVENT_CONFIG_H_\ 16 | 17 | $a\ 18 | \ 19 | #endif /* event2/event-config.h */ 20 | 21 | s/#define /#define _EVENT_/ 22 | s/#undef /#undef _EVENT_/ 23 | s/#ifndef /#ifndef _EVENT_/ 24 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/mm-internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | #ifndef _EVENT_MM_INTERNAL_H 27 | #define _EVENT_MM_INTERNAL_H 28 | 29 | #include 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | #ifndef _EVENT_DISABLE_MM_REPLACEMENT 36 | /* Internal use only: Memory allocation functions. We give them nice short 37 | * mm_names for our own use, but make sure that the symbols have longer names 38 | * so they don't conflict with other libraries (like, say, libmm). */ 39 | void *event_mm_malloc_(size_t sz); 40 | void *event_mm_calloc_(size_t count, size_t size); 41 | char *event_mm_strdup_(const char *s); 42 | void *event_mm_realloc_(void *p, size_t sz); 43 | void event_mm_free_(void *p); 44 | #define mm_malloc(sz) event_mm_malloc_(sz) 45 | #define mm_calloc(count, size) event_mm_calloc_((count), (size)) 46 | #define mm_strdup(s) event_mm_strdup_(s) 47 | #define mm_realloc(p, sz) event_mm_realloc_((p), (sz)) 48 | #define mm_free(p) event_mm_free_(p) 49 | #else 50 | #define mm_malloc(sz) malloc(sz) 51 | #define mm_calloc(n, sz) calloc((n), (sz)) 52 | #define mm_strdup(s) strdup(s) 53 | #define mm_realloc(p, sz) realloc((p), (sz)) 54 | #define mm_free(p) free(p) 55 | #endif 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/sample/Makefile.am: -------------------------------------------------------------------------------- 1 | # sample/Makefile.am for libevent 2 | # Copyright 2000-2007 Niels Provos 3 | # Copyright 2007-2012 Niels Provos and Nick Mathewson 4 | # 5 | # See LICENSE for copying information. 6 | 7 | AUTOMAKE_OPTIONS = foreign no-dependencies 8 | 9 | LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la 10 | AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include -I../include 11 | 12 | noinst_PROGRAMS = event-test time-test signal-test dns-example hello-world http-server 13 | 14 | event_test_SOURCES = event-test.c 15 | time_test_SOURCES = time-test.c 16 | signal_test_SOURCES = signal-test.c 17 | dns_example_SOURCES = dns-example.c 18 | hello_world_SOURCES = hello-world.c 19 | http_server_SOURCES = http-server.c 20 | 21 | if OPENSSL 22 | noinst_PROGRAMS += le-proxy 23 | le_proxy_SOURCES = le-proxy.c 24 | le_proxy_LDADD = $(LDADD) ../libevent_openssl.la -lssl -lcrypto ${OPENSSL_LIBADD} 25 | endif 26 | 27 | verify: 28 | 29 | DISTCLEANFILES = *~ 30 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/sample/signal-test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Compile with: 3 | * cc -I/usr/local/include -o signal-test \ 4 | * signal-test.c -L/usr/local/lib -levent 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | #ifndef WIN32 13 | #include 14 | #include 15 | #include 16 | #else 17 | #include 18 | #include 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | #ifdef _EVENT___func__ 30 | #define __func__ _EVENT___func__ 31 | #endif 32 | 33 | int called = 0; 34 | 35 | static void 36 | signal_cb(evutil_socket_t fd, short event, void *arg) 37 | { 38 | struct event *signal = arg; 39 | 40 | printf("%s: got signal %d\n", __func__, EVENT_SIGNAL(signal)); 41 | 42 | if (called >= 2) 43 | event_del(signal); 44 | 45 | called++; 46 | } 47 | 48 | int 49 | main(int argc, char **argv) 50 | { 51 | struct event signal_int; 52 | struct event_base* base; 53 | #ifdef WIN32 54 | WORD wVersionRequested; 55 | WSADATA wsaData; 56 | 57 | wVersionRequested = MAKEWORD(2, 2); 58 | 59 | (void) WSAStartup(wVersionRequested, &wsaData); 60 | #endif 61 | 62 | /* Initalize the event library */ 63 | base = event_base_new(); 64 | 65 | /* Initalize one event */ 66 | event_assign(&signal_int, base, SIGINT, EV_SIGNAL|EV_PERSIST, signal_cb, 67 | &signal_int); 68 | 69 | event_add(&signal_int, NULL); 70 | 71 | event_base_dispatch(base); 72 | event_base_free(base); 73 | 74 | return (0); 75 | } 76 | 77 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/sample/time-test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * XXX This sample code was once meant to show how to use the basic Libevent 3 | * interfaces, but it never worked on non-Unix platforms, and some of the 4 | * interfaces have changed since it was first written. It should probably 5 | * be removed or replaced with something better. 6 | * 7 | * Compile with: 8 | * cc -I/usr/local/include -o time-test time-test.c -L/usr/local/lib -levent 9 | */ 10 | 11 | #include 12 | 13 | #include 14 | 15 | #include 16 | #ifndef WIN32 17 | #include 18 | #include 19 | #endif 20 | #include 21 | #ifdef _EVENT_HAVE_SYS_TIME_H 22 | #include 23 | #endif 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | #ifdef WIN32 35 | #include 36 | #endif 37 | 38 | struct timeval lasttime; 39 | 40 | int event_is_persistent; 41 | 42 | static void 43 | timeout_cb(evutil_socket_t fd, short event, void *arg) 44 | { 45 | struct timeval newtime, difference; 46 | struct event *timeout = arg; 47 | double elapsed; 48 | 49 | evutil_gettimeofday(&newtime, NULL); 50 | evutil_timersub(&newtime, &lasttime, &difference); 51 | elapsed = difference.tv_sec + 52 | (difference.tv_usec / 1.0e6); 53 | 54 | printf("timeout_cb called at %d: %.3f seconds elapsed.\n", 55 | (int)newtime.tv_sec, elapsed); 56 | lasttime = newtime; 57 | 58 | if (! event_is_persistent) { 59 | struct timeval tv; 60 | evutil_timerclear(&tv); 61 | tv.tv_sec = 2; 62 | event_add(timeout, &tv); 63 | } 64 | } 65 | 66 | int 67 | main(int argc, char **argv) 68 | { 69 | struct event timeout; 70 | struct timeval tv; 71 | struct event_base *base; 72 | int flags; 73 | 74 | #ifdef WIN32 75 | WORD wVersionRequested; 76 | WSADATA wsaData; 77 | 78 | wVersionRequested = MAKEWORD(2, 2); 79 | 80 | (void)WSAStartup(wVersionRequested, &wsaData); 81 | #endif 82 | 83 | if (argc == 2 && !strcmp(argv[1], "-p")) { 84 | event_is_persistent = 1; 85 | flags = EV_PERSIST; 86 | } else { 87 | event_is_persistent = 0; 88 | flags = 0; 89 | } 90 | 91 | /* Initalize the event library */ 92 | base = event_base_new(); 93 | 94 | /* Initalize one event */ 95 | event_assign(&timeout, base, -1, flags, timeout_cb, (void*) &timeout); 96 | 97 | evutil_timerclear(&tv); 98 | tv.tv_sec = 2; 99 | event_add(&timeout, &tv); 100 | 101 | evutil_gettimeofday(&lasttime, NULL); 102 | 103 | event_base_dispatch(base); 104 | 105 | return (0); 106 | } 107 | 108 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/strlcpy-internal.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRLCPY_INTERNAL_H_ 2 | #define _STRLCPY_INTERNAL_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include "event2/event-config.h" 9 | 10 | #ifndef _EVENT_HAVE_STRLCPY 11 | #include 12 | size_t _event_strlcpy(char *dst, const char *src, size_t siz); 13 | #define strlcpy _event_strlcpy 14 | #endif 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/strlcpy.c: -------------------------------------------------------------------------------- 1 | /* $OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $ */ 2 | 3 | /* 4 | * Copyright (c) 1998 Todd C. Miller 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 19 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 20 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21 | * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 24 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 27 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #if defined(LIBC_SCCS) && !defined(lint) 31 | static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $"; 32 | #endif /* LIBC_SCCS and not lint */ 33 | 34 | #include 35 | 36 | #include "event2/event-config.h" 37 | 38 | #ifndef _EVENT_HAVE_STRLCPY 39 | #include "strlcpy-internal.h" 40 | 41 | /* 42 | * Copy src to string dst of size siz. At most siz-1 characters 43 | * will be copied. Always NUL terminates (unless siz == 0). 44 | * Returns strlen(src); if retval >= siz, truncation occurred. 45 | */ 46 | size_t 47 | _event_strlcpy(dst, src, siz) 48 | char *dst; 49 | const char *src; 50 | size_t siz; 51 | { 52 | register char *d = dst; 53 | register const char *s = src; 54 | register size_t n = siz; 55 | 56 | /* Copy as many bytes as will fit */ 57 | if (n != 0 && --n != 0) { 58 | do { 59 | if ((*d++ = *s++) == 0) 60 | break; 61 | } while (--n != 0); 62 | } 63 | 64 | /* Not enough room in dst, add NUL and traverse rest of src */ 65 | if (n == 0) { 66 | if (siz != 0) 67 | *d = '\0'; /* NUL-terminate dst */ 68 | while (*s++) 69 | ; 70 | } 71 | 72 | return (s - src - 1); /* count does not include NUL */ 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/test/Makefile.nmake: -------------------------------------------------------------------------------- 1 | 2 | CFLAGS=/I.. /I../WIN32-Code /I../include /I../compat /DWIN32 /DHAVE_CONFIG_H /DTINYTEST_LOCAL 3 | 4 | CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo 5 | 6 | REGRESS_OBJS=regress.obj regress_buffer.obj regress_http.obj regress_dns.obj \ 7 | regress_testutils.obj \ 8 | regress_rpc.obj regress.gen.obj \ 9 | regress_et.obj regress_bufferevent.obj \ 10 | regress_listener.obj regress_util.obj tinytest.obj \ 11 | regress_main.obj regress_minheap.obj regress_iocp.obj \ 12 | regress_thread.obj 13 | 14 | OTHER_OBJS=test-init.obj test-eof.obj test-weof.obj test-time.obj \ 15 | bench.obj bench_cascade.obj bench_http.obj bench_httpclient.obj \ 16 | test-changelist.obj 17 | 18 | PROGRAMS=regress.exe \ 19 | test-init.exe test-eof.exe test-weof.exe test-time.exe \ 20 | test-changelist.exe 21 | 22 | # Disabled for now: 23 | # bench.exe bench_cascade.exe bench_http.exe bench_httpclient.exe 24 | 25 | 26 | LIBS=..\libevent.lib ws2_32.lib shell32.lib advapi32.lib 27 | 28 | all: $(PROGRAMS) 29 | 30 | regress.exe: $(REGRESS_OBJS) 31 | $(CC) $(CFLAGS) $(LIBS) $(REGRESS_OBJS) 32 | 33 | test-init.exe: test-init.obj 34 | $(CC) $(CFLAGS) $(LIBS) test-init.obj 35 | test-eof.exe: test-eof.obj 36 | $(CC) $(CFLAGS) $(LIBS) test-eof.obj 37 | test-changelist.exe: test-changelist.obj 38 | $(CC) $(CFLAGS) $(LIBS) test-changelist.obj 39 | test-weof.exe: test-weof.obj 40 | $(CC) $(CFLAGS) $(LIBS) test-weof.obj 41 | test-time.exe: test-time.obj 42 | $(CC) $(CFLAGS) $(LIBS) test-time.obj 43 | 44 | bench.exe: bench.obj 45 | $(CC) $(CFLAGS) $(LIBS) bench.obj 46 | bench_cascade.exe: bench_cascade.obj 47 | $(CC) $(CFLAGS) $(LIBS) bench_cascade.obj 48 | bench_http.exe: bench_http.obj 49 | $(CC) $(CFLAGS) $(LIBS) bench_http.obj 50 | bench_httpclient.exe: bench_httpclient.obj 51 | $(CC) $(CFLAGS) $(LIBS) bench_httpclient.obj 52 | 53 | regress.gen.c regress.gen.h: regress.rpc ../event_rpcgen.py 54 | echo // > regress.gen.c 55 | echo #define NO_PYTHON_EXISTS > regress.gen.h 56 | -python ..\event_rpcgen.py regress.rpc 57 | 58 | clean: 59 | -del $(REGRESS_OBJS) 60 | -del $(OTHER_OBJS) 61 | -del regress.exe 62 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/test/regress.rpc: -------------------------------------------------------------------------------- 1 | /* tests data packing and unpacking */ 2 | 3 | struct msg { 4 | string /* sender */ from_name = 1; /* be verbose */ 5 | string to_name = 2; 6 | optional struct[kill] attack = 3; 7 | array struct[run] run = 4; 8 | } 9 | 10 | struct kill { 11 | string weapon = 0x10121; 12 | string action = 2; 13 | array int how_often = 3; 14 | } 15 | 16 | struct run { 17 | string how = 1; 18 | optional bytes some_bytes = 2; 19 | 20 | bytes fixed_bytes[24] = 3; 21 | array string notes = 4; 22 | 23 | optional int64 large_number = 5; 24 | array int other_numbers = 6; 25 | } 26 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/test/regress_testutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Niels Provos and Nick Mathewson 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef _TESTUTILS_H 28 | #define _TESTUTILS_H 29 | 30 | #include "event2/dns.h" 31 | 32 | struct regress_dns_server_table { 33 | const char *q; 34 | const char *anstype; 35 | const char *ans; 36 | int seen; 37 | }; 38 | 39 | struct evdns_server_port * 40 | regress_get_dnsserver(struct event_base *base, 41 | ev_uint16_t *portnum, 42 | evutil_socket_t *psock, 43 | evdns_request_callback_fn_type cb, 44 | void *arg); 45 | 46 | /* Helper: return the port that a socket is bound on, in host order. */ 47 | int regress_get_socket_port(evutil_socket_t fd); 48 | 49 | /* used to look up pre-canned responses in a search table */ 50 | void regress_dns_server_cb( 51 | struct evdns_server_request *req, void *data); 52 | 53 | /* globally allocates a dns server that serves from a search table */ 54 | int regress_dnsserver(struct event_base *base, ev_uint16_t *port, 55 | struct regress_dns_server_table *seach_table); 56 | 57 | /* clean up the global dns server resources */ 58 | void regress_clean_dnsserver(void); 59 | 60 | struct evconnlistener; 61 | struct sockaddr; 62 | int regress_get_listener_addr(struct evconnlistener *lev, 63 | struct sockaddr *sa, ev_socklen_t *socklen); 64 | 65 | #endif /* _TESTUTILS_H */ 66 | 67 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/test/rpcgen_wrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # libevent rpcgen_wrapper.sh 3 | # Transforms event_rpcgen.py failure into success for make, only if 4 | # regress.gen.c and regress.gen.h already exist in $srcdir. This 5 | # is needed for "make distcheck" to pass the read-only $srcdir build, 6 | # as with read-only sources fresh from tarball, regress.gen.[ch] will 7 | # be correct in $srcdir but unwritable. This previously triggered 8 | # Makefile.am to create stub regress.gen.c and regress.gen.h in the 9 | # distcheck _build directory, which were then detected as leftover 10 | # files in the build tree after distclean, breaking distcheck. 11 | # Note that regress.gen.[ch] are not in fresh git clones, making 12 | # working Python a requirement for make distcheck of a git tree. 13 | 14 | exit_updated() { 15 | echo "Updated ${srcdir}\regress.gen.c and ${srcdir}\regress.gen.h" 16 | exit 0 17 | } 18 | 19 | exit_reuse() { 20 | echo "event_rpcgen.py failed, ${srcdir}\regress.gen.\[ch\] will be reused." >&2 21 | exit 0 22 | } 23 | 24 | exit_failed() { 25 | echo "Could not generate regress.gen.\[ch\] using event_rpcgen.sh" >&2 26 | exit 1 27 | } 28 | 29 | if [ -x /usr/bin/python2 ] ; then 30 | PYTHON2=/usr/bin/python2 31 | elif [ "x`which python2`" != x ] ; then 32 | PYTHON2=python2 33 | else 34 | PYTHON2=python 35 | fi 36 | 37 | srcdir=$1 38 | srcdir=${srcdir:-.} 39 | ${PYTHON2} ${srcdir}/../event_rpcgen.py ${srcdir}/regress.rpc 40 | case "$?" in 41 | 0) 42 | exit_updated 43 | ;; 44 | *) 45 | test -r ${srcdir}/regress.gen.c -a -r ${srcdir}/regress.gen.h && \ 46 | exit_reuse 47 | exit_failed 48 | ;; 49 | esac 50 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/test/test-init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #include "event2/event-config.h" 28 | 29 | #include 30 | #include 31 | #ifdef _EVENT_HAVE_SYS_TIME_H 32 | #include 33 | #endif 34 | #ifdef _EVENT_HAVE_SYS_SOCKET_H 35 | #include 36 | #endif 37 | #include 38 | #include 39 | #include 40 | #include 41 | #ifndef WIN32 42 | #include 43 | #endif 44 | #include 45 | 46 | #include 47 | 48 | int 49 | main(int argc, char **argv) 50 | { 51 | #ifdef WIN32 52 | WORD wVersionRequested; 53 | WSADATA wsaData; 54 | 55 | wVersionRequested = MAKEWORD(2, 2); 56 | 57 | (void) WSAStartup(wVersionRequested, &wsaData); 58 | #endif 59 | 60 | /* Initalize the event library */ 61 | event_init(); 62 | 63 | return (0); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /proxy/deps/libevent2/test/tinytest_local.h: -------------------------------------------------------------------------------- 1 | 2 | #ifdef WIN32 3 | #include 4 | #endif 5 | 6 | #include "event2/util.h" 7 | #include "util-internal.h" 8 | 9 | #ifdef snprintf 10 | #undef snprintf 11 | #endif 12 | #define snprintf evutil_snprintf 13 | -------------------------------------------------------------------------------- /proxy/etc/proxy.ini: -------------------------------------------------------------------------------- 1 | [kvproxy] 2 | port=55669 3 | thread_count=1 4 | cpu_affinity=off 5 | backlog=10000 6 | ;unit millisecond 7 | recv_timeout=100 8 | ;log_path=/tmp/kvproxy.log 9 | log_level=warn 10 | ;ext_path=../ext 11 | ;unit MB 12 | max_packet=1 13 | failover_threshold = 2 14 | ;unit second 15 | failover_interval = 2 16 | async_size = 50000 17 | sentinel = 127.0.0.1:26379 18 | 19 | [memcached] 20 | extension=memcached.so 21 | hosts=master 22 | ;hosts_backup=read 23 | hosts_read=master 24 | sync_str = "+" 25 | ;binary or text 26 | proto=binary 27 | 28 | [master] 29 | 127.0.0.1:11211="1:50" 30 | 31 | [read] 32 | 127.0.0.1:11212="2:50" 33 | -------------------------------------------------------------------------------- /proxy/lib/libevent-2.0.so.5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/lib/libevent-2.0.so.5 -------------------------------------------------------------------------------- /proxy/lib/libevent.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/lib/libevent.so -------------------------------------------------------------------------------- /proxy/lib/libkvdb.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baifendian/RedisSentinelClient/ad937bf108eca441d6aab751d9204683a6cbbc5e/proxy/lib/libkvdb.so -------------------------------------------------------------------------------- /proxy/src/Makefilebak: -------------------------------------------------------------------------------- 1 | include ../build_config.mk 2 | 3 | SOURCE_FILES=./kvproxy.cpp ./extension.cpp ./hash.cpp ./serv.cpp ./conn_pool.cpp ./log.cpp ./config.cpp ./util.cpp 4 | HEADER_FILES=./kvproxy.h ./extension.h ./hash.h ./serv.h ./conn_pool.h ./log.h ./config.h ./util.h 5 | 6 | all:${SOURCE_FILES} ${HEADER_FILES} 7 | ${CXX} ${SOURCE_FILES} -I ./ ${CFLAGS} ${PLATFORM_CLIBS} ${CLIBS} -o ../bin/kvproxy 8 | clean: 9 | rm -f ../bin/kvproxy 10 | -------------------------------------------------------------------------------- /proxy/src/config.h: -------------------------------------------------------------------------------- 1 | #ifndef KVPROXY_CONFIG_H 2 | #define KVPROXY_CONFIG_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "log.h" 9 | #include "util.h" 10 | 11 | #define PARSE_INIT 0 12 | #define PARSE_SECTION 1 13 | #define PARSE_KEY 2 14 | #define PARSE_VALUE 3 15 | 16 | using namespace std; 17 | 18 | typedef std::map > CONF_T; 19 | 20 | class Config 21 | { 22 | private: 23 | static string conf_path; 24 | static CONF_T conf; 25 | static string ext_name; 26 | 27 | public: 28 | static void setConfFile(string file_path); 29 | static void loadConf(); 30 | static string getConfStr(string section, string key); 31 | static map getConfStr(string section); 32 | static int getConfInt(string section, string key); 33 | static map getConfInt(string section); 34 | static bool getConfBool(string section, string key); 35 | static map getConfBool(string section); 36 | static string getExtName(); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /proxy/src/conn_pool.h: -------------------------------------------------------------------------------- 1 | #ifndef KVPROXY_CONN_POOL_H 2 | #define KVPROXY_CONN_POOL_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "log.h" 19 | 20 | using namespace std; 21 | 22 | class ConnPool { 23 | private: 24 | 25 | map > > conn_list; 26 | static ConnPool * conn_pool; 27 | pthread_rwlock_t conn_list_lock; 28 | 29 | bool destoryConnPool(); 30 | public: 31 | ConnPool(){ 32 | int res; 33 | res=pthread_rwlock_init(&conn_list_lock,NULL); 34 | if(res != 0){ 35 | cerr << "[error]:rwlock initialization failed" << endl; 36 | log_fatal("rwlock initialization failed "); 37 | exit(EXIT_FAILURE); 38 | } 39 | }; 40 | ~ConnPool(); 41 | static ConnPool * getInstance(); 42 | void initConnection(string host, uint32_t port, uint32_t size); 43 | int getConnection(uint32_t id, string host, uint32_t port); 44 | int createConnection(string host, uint32_t port); 45 | void destoryConnection(int conn); 46 | void closeConnection(int conn); 47 | int getConnectionSize(); 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /proxy/src/ext/memcached/Makefile: -------------------------------------------------------------------------------- 1 | CXX=g++ 2 | 3 | OUTPUT=./ 4 | 5 | LIB_SUFFIX_NAME=so 6 | TARGET=memcached.${LIB_SUFFIX_NAME} 7 | 8 | CPPFLAGS= -g -O2 -fPIC -shared\ 9 | -I../../ 10 | 11 | SOURCE_FILES=./memcached.cpp 12 | HEADER_FILES=./memcached.h ./protocol_binary.h 13 | 14 | all:$(SOURCE_FILES) $(HEADER_FILES) 15 | $(CXX) -o $(TARGET) $(SOURCE_FILES) $(CPPFLAGS) 16 | clean: 17 | rm -rf $(TARGET) 18 | install: 19 | cp $(TARGET) ../../../ext/ 20 | uninstall: 21 | rm -f ../../../ext/$(TARGET) 22 | -------------------------------------------------------------------------------- /proxy/src/ext/memcached/memcached.h: -------------------------------------------------------------------------------- 1 | #ifndef EXPROXY_EXT_MEMCACHED_H 2 | #define EXPROXY_EXT_MEMCACHED_H 3 | 4 | #include "extension.h" 5 | #include "util.h" 6 | #include "config.h" 7 | #include 8 | #include "protocol_binary.h" 9 | 10 | extern "C" { 11 | struct memcached_header{ 12 | int keylen; 13 | int extlen; 14 | int bodylen; 15 | int opcode; 16 | }; 17 | PARSE_REQ(memcached); 18 | CREATE_REQ(memcached); 19 | CREATE_REQ_ASYNC(memcached); 20 | PARSE_RESP(memcached); 21 | CREATE_RESP(memcached); 22 | EXT_VERSION(memcached); 23 | 24 | static bool is_binary_protocol(const char * data, int size); 25 | static int try_read_request_binary(const char * req_data, int size, memcached_header * header); 26 | static int try_read_response_binary(const char * resp_data, int size, memcached_header * header); 27 | static int try_read_request_text(const char * req_data, int size, memcached_header * header); 28 | static int try_read_response_text(const char * resp_data, int size, memcached_header * header); 29 | static uint32_t get_opcode(const char * data); 30 | 31 | } 32 | #endif 33 | -------------------------------------------------------------------------------- /proxy/src/hash.h: -------------------------------------------------------------------------------- 1 | #ifndef KVPROXY_HASH_H 2 | #define KVPROXY_HASH_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include "log.h" 16 | 17 | using namespace std; 18 | 19 | 20 | 21 | class ConsistentHash 22 | { 23 | private: 24 | //the key is crc32 key, the value is a pair, host_port and alias index 25 | typedef map > hash_type; 26 | typedef hash_type::key_type key_type; 27 | typedef hash_type::mapped_type mapped_type; 28 | typedef hash_type::iterator iterator; 29 | hash_type _hash; 30 | hash_type _hash_tmp; 31 | pthread_mutex_t _lock; 32 | 33 | public: 34 | ConsistentHash(); 35 | ~ConsistentHash(); 36 | bool createVNodes(map,pair > hosts); 37 | void setHosts(map,pair > hosts, bool force = false); 38 | bool delHost(uint32_t alias_index); 39 | bool addHost(string host_port, uint32_t alias_index, uint32_t index, uint32_t weight); 40 | pair find(string key); 41 | pair find(const char *key, uint16_t key_len); 42 | map > getAll(); 43 | inline uint32_t getSize(){ 44 | return _hash.size(); 45 | } 46 | }; 47 | 48 | uint32_t crc32(uint32_t crc, const char *buf, uint32_t len); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /proxy/src/log.h: -------------------------------------------------------------------------------- 1 | #ifndef KVPROXY_LOG_H 2 | #define KVPROXY_LOG_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | using namespace std; 13 | 14 | class Logger{ 15 | private: 16 | static ofstream log_file; 17 | int log_level; 18 | public: 19 | static const int LEVEL_FATAL = 0; 20 | static const int LEVEL_ERROR = 1; 21 | static const int LEVEL_WARN = 2; 22 | static const int LEVEL_INFO = 3; 23 | static const int LEVEL_DEBUG = 4; 24 | 25 | Logger(); 26 | ~Logger(); 27 | 28 | void setLevel(int level){ 29 | log_level = level; 30 | } 31 | int getLevel(const char *levelname); 32 | void open(const char *filename); 33 | int logx(int level, const char *fmt, va_list ap); 34 | int debug(const char *fmt, ...); 35 | int info(const char *fmt, ...); 36 | int warn(const char *fmt, ...); 37 | int error(const char *fmt, ...); 38 | int fatal(const char *fmt, ...); 39 | }; 40 | 41 | 42 | void log_open(const char *filename); 43 | int get_log_level(const char * levelname); 44 | void set_log_level(int level); 45 | int log_write(int level, const char *fmt, ...); 46 | 47 | #define log_debug(fmt, args...) \ 48 | log_write(Logger::LEVEL_DEBUG, "%s(%d): " fmt, __FILE__, __LINE__, ##args) 49 | #define log_info(fmt, args...) \ 50 | log_write(Logger::LEVEL_INFO, "%s(%d): " fmt, __FILE__, __LINE__, ##args) 51 | #define log_warn(fmt, args...) \ 52 | log_write(Logger::LEVEL_WARN, "%s(%d): " fmt, __FILE__, __LINE__, ##args) 53 | #define log_error(fmt, args...) \ 54 | log_write(Logger::LEVEL_ERROR, "%s(%d): " fmt, __FILE__, __LINE__, ##args) 55 | #define log_fatal(fmt, args...) \ 56 | log_write(Logger::LEVEL_FATAL, "%s(%d): " fmt, __FILE__, __LINE__, ##args) 57 | 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /proxy/src/util.cpp: -------------------------------------------------------------------------------- 1 | #include "util.h" 2 | 3 | string get_cwd(string bin_path){ 4 | string cwd; 5 | int position = bin_path.find_last_of("/"); 6 | if (position == string::npos){ 7 | cout << "error: the command should have seperator / " << endl; 8 | exit(EXIT_FAILURE); 9 | } 10 | cwd = bin_path.substr(0,position) + "/"; 11 | return cwd; 12 | } 13 | -------------------------------------------------------------------------------- /proxy/src/util.h: -------------------------------------------------------------------------------- 1 | #ifndef KVPROXY_UTIL_H 2 | #define KVPROXY_UTIL_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "config.h" 13 | 14 | using namespace std; 15 | 16 | 17 | string get_cwd(string bin_path); 18 | 19 | inline int str2int(const char * str){ 20 | int n; 21 | sscanf(str,"%d",&n); 22 | return n; 23 | } 24 | inline string int2str(int n){ 25 | char str[20] = {'\0'}; 26 | sprintf(str,"%d",n); 27 | return str; 28 | } 29 | 30 | inline string bool2str(bool n){ 31 | if(n == true){ 32 | return "yes"; 33 | }else{ 34 | return "no"; 35 | } 36 | } 37 | 38 | inline map splitmap(string content, char chr){ 39 | map ret; 40 | uint32_t i = 0; 41 | for(string::iterator it = content.begin(); it != content.end(); it++){ 42 | if(*it != chr){ 43 | ret[i] += *it; 44 | }else{ 45 | i++; 46 | } 47 | } 48 | return ret; 49 | } 50 | 51 | inline int get_second(){ 52 | struct timeval tv; 53 | struct timezone tz; 54 | gettimeofday(&tv,&tz); 55 | return tv.tv_sec; 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /proxy/src/version.h: -------------------------------------------------------------------------------- 1 | #ifndef KVPROXY_VER_H 2 | #define KVPROXY_VER_H 3 | 4 | #define KVPROXY_VERSION 0.1 5 | #define KVPROXY_BUILT "2015-01-11" 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /proxy/startProxy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | cur_dir=$(cd "$(dirname "$0")" ; pwd) 4 | 5 | export LD_LIBRARY_PATH=${cur_dir}/lib/:${LD_LIBRARY_PATH} 6 | 7 | ${cur_dir}/bin/bfdproxy -c $1 8 | -------------------------------------------------------------------------------- /proxy/test/makefile: -------------------------------------------------------------------------------- 1 | kvtest: 2 | g++ ./test_proxy.cpp -I /home/meng.wei/redis-2.8.19/deps/hiredis \ 3 | -I /home/meng.wei/redis-sentinel-client/src/cpp/include \ 4 | -I /home/meng.wei/redis-sentinel-client/src/cpp/RedisSentinel \ 5 | -I /home/meng.wei/redis-sentinel-client/src/cpp/ \ 6 | -I /usr/local/bfd/include \ 7 | -I /usr/local/include/zookeeper \ 8 | -L /home/meng.wei/redis-sentinel-client/release -lkvdb \ 9 | -L /usr/local/bfd/lib64 -lboost_thread \ 10 | -L /home/meng.wei/redis-2.8.19/deps/hiredis -lhiredis -std=c++0x -pthread -g -o kvtest 11 | .PHONY: 12 | clean: 13 | rm kvtest 14 | -------------------------------------------------------------------------------- /proxy/test/test_config.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | int main(){ 9 | map m; 10 | map::iterator it; 11 | Config conf; 12 | conf.setConfFile("../etc/kvproxy.ini"); 13 | conf.loadConf(); 14 | m = conf.getConfStr("master"); 15 | for(it = m.begin(); it != m.end(); it++){ 16 | cout << it->first << " -- " << it->second << endl; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /proxy/test/test_conn.cpp: -------------------------------------------------------------------------------- 1 | #include "conn_pool.h" 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int conn_fd; 7 | string host; 8 | uint32_t port; 9 | int max_size; 10 | host = "127.0.0.1"; 11 | port = 80; 12 | max_size = 10; 13 | ssize_t len; 14 | string cmd; 15 | char buffer[10240] = {'\0'}; 16 | int timeout = 1000000;//毫秒 17 | 18 | cmd = "stats"; 19 | ConnPool *conn_pool = ConnPool::getInstance(); 20 | conn_pool->initConnection(host, port, max_size); 21 | conn_fd = conn_pool->getConnection(1, host, port); 22 | cout << "conn fd is " << conn_fd << endl; 23 | len = send(conn_fd, cmd.c_str(), cmd.size(), MSG_DONTWAIT); 24 | if(len <= 0){ 25 | cout << "send error" << len << endl; 26 | }else{ 27 | cout << "send success " << len << endl; 28 | } 29 | while (1){ 30 | fd_set rdfds; 31 | struct timeval tv; 32 | int ret; /* 保存返回值 */ 33 | FD_ZERO(&rdfds); /* 用select函数之前先把集合清零 */ 34 | FD_SET(conn_fd, &rdfds); /* 把要检测的句柄socket加入到集合里 */ 35 | tv.tv_sec = 0; 36 | tv.tv_usec = timeout; /* 设置select等待的最大时间为1秒加500微秒 */ 37 | cout << "start select " << endl; 38 | ret = select(conn_fd+1, &rdfds, NULL, NULL, &tv); 39 | if(ret < 0){ 40 | cout << "select error " << endl; 41 | return 0; 42 | }else if (ret == 0){ 43 | cout << "select timeout " << endl; 44 | return 0; 45 | }else if (FD_ISSET(conn_fd,&rdfds) <= 0){ 46 | cout << "can not read" << endl; 47 | return 0; 48 | } 49 | 50 | len = recv(conn_fd, &buffer, sizeof(buffer), MSG_WAITALL);//MSG_PEEK MSG_DONTWAIT MSG_WAITALL 51 | if (len > 0) 52 | { 53 | cout << "buffer is " << buffer << endl; 54 | break; 55 | }else if(len == 0){ 56 | cout << "close connection \n" << endl; 57 | close(conn_fd); 58 | }else if (len == -1) 59 | { 60 | if (errno == EAGAIN) 61 | { 62 | break; 63 | }else if (errno == EINTR) 64 | { 65 | continue; 66 | }else{ 67 | break; 68 | } 69 | } 70 | } 71 | return 0; 72 | } 73 | -------------------------------------------------------------------------------- /proxy/test/test_ext.cpp: -------------------------------------------------------------------------------- 1 | #include "extension.h" 2 | 3 | int main(){ 4 | Extension ext; 5 | parse_req_t ptr_parse_req; 6 | ext_ret rt; 7 | map data; 8 | char cmd[20] = {'\0'}; 9 | char key[500] = {'\0'}; 10 | uint32_t expires = 0; 11 | bool update = false; 12 | char req_data[1024] = {'\0'}; 13 | ext.setExtPath("../src/ext/demo/"); 14 | ext.load("demo"); 15 | ptr_parse_req = ext.findParseReq("demo"); 16 | if(ptr_parse_req != NULL){ 17 | rt = ptr_parse_req(&data, cmd, key, expires, update, req_data); 18 | cout << "cmd " << cmd << endl; 19 | cout << "data[key] " << data["key"] << endl; 20 | }else{ 21 | cout << "no find parse req" << endl; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /proxy/test/test_hash.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | int main(){ 9 | /* 10 | set s; 11 | string key; 12 | pair p; 13 | ConsistentHash hash; 14 | char port[10]; 15 | s.insert("192.168.1.1:11211"); 16 | s.insert("192.168.1.2:11211"); 17 | s.insert("192.168.1.3:11211"); 18 | s.insert("192.168.1.4:11211"); 19 | hash.setHosts(s); 20 | key = "a"; 21 | p = hash.find(key); 22 | sprintf(port,"%d",p.second); 23 | cout << "host " << p.first << "port " << port << endl; 24 | */ 25 | map, pair > m; 26 | map > h; 27 | map >::iterator it; 28 | pair p; 29 | m[make_pair("192.168.1.1",11211)] = make_pair(1,3); 30 | m[make_pair("192.168.1.2",11212)] = make_pair(2,2); 31 | m[make_pair("192.168.1.3",11213)] = make_pair(3,4); 32 | ConsistentHash hash; 33 | hash.setHosts(m); 34 | h = hash.getAll(); 35 | for(it = h.begin(); it != h.end(); it++){ 36 | cout << it->first << " -- " << it->second.first << ":" << it->second.second << endl; 37 | } 38 | p = hash.find("123"); 39 | cout << p.first << " -- " << p.second << endl; 40 | cout << "hash size is " << hash.getSize() << endl; 41 | } 42 | -------------------------------------------------------------------------------- /proxy/test/test_log.cpp: -------------------------------------------------------------------------------- 1 | #include "log.h" 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | string filename; 7 | int level; 8 | filename = "./test.log"; 9 | log_open(filename.c_str()); 10 | level = get_log_level("debug"); 11 | set_log_level(level); 12 | log_error("%s"," some errors"); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /proxy/test/test_proxy.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "hiredis.h" 6 | #include "time.h" 7 | #include "RedisClient.h" 8 | 9 | using namespace bfd::redis; 10 | 11 | using namespace std; 12 | 13 | redisContext *c = NULL;; 14 | 15 | void *func(void *arg) 16 | { 17 | redisContext *cc; 18 | const char *hostname = "127.0.0.1"; 19 | int port = 55669; 20 | 21 | struct timeval timeout = { 1, 500000 }; // 1.5 seconds 22 | cc = redisConnectWithTimeout(hostname, port, timeout); 23 | 24 | //------------set--------- 25 | struct timeval start, end; 26 | gettimeofday(&start, NULL); 27 | 28 | for (int i=0;i<100000; i++) 29 | { 30 | redisReply *reply = (redisReply *)redisCommand(cc,"SET kk vv"); 31 | freeReplyObject(reply); 32 | } 33 | gettimeofday(&end, NULL); 34 | 35 | long ttt = 1000000*(end.tv_sec-start.tv_sec) 36 | +(end.tv_usec-start.tv_usec); 37 | 38 | cout << "set 100000 time=" <err) { 72 | if (c) { 73 | printf("Connection error: %s\n", c->errstr); 74 | redisFree(c); 75 | } else { 76 | printf("Connection error: can't allocate redis context\n"); 77 | } 78 | exit(1); 79 | } 80 | 81 | int err; 82 | pthread_t id1, id2, id3; 83 | err = pthread_create(&id1, NULL, func, NULL); //创建线程 84 | 85 | // err = pthread_create(&id2, NULL, func, NULL); //创建线程 86 | 87 | // err = pthread_create(&id3, NULL, func, NULL); //创建线程 88 | 89 | pthread_join(id1, NULL); 90 | // pthread_join(id2, NULL); 91 | // pthread_join(id3, NULL); 92 | 93 | t2 = time(NULL); 94 | cout << "total 20000 time=" < 5 | #include 6 | using namespace std; 7 | 8 | #define BUF_SIZE 10240000 9 | 10 | class KvProxy : public Server 11 | { 12 | private: 13 | vector vec; 14 | protected: 15 | void readEvent(Conn *conn); 16 | void writeEvent(Conn *conn); 17 | void connectionEvent(Conn *conn); 18 | void closeEvent(Conn *conn, short events); 19 | public: 20 | KvProxy(int count) : Server(count) { }; 21 | ~KvProxy(); 22 | 23 | static void quitCb(int sig, short events, void *data); 24 | static void timeOutCb(int id, int short events, void *data); 25 | }; 26 | KvProxy::~KvProxy(){ 27 | printf("destruct \n"); 28 | } 29 | void KvProxy::readEvent(Conn *conn) 30 | { 31 | char buf[BUF_SIZE]; 32 | int len = 0; 33 | len = conn->getReadBufLen(); 34 | len = len > BUF_SIZE ? BUF_SIZE: len; 35 | conn->CopyReadBuf(buf, len); 36 | conn->clearReadBuf(len); 37 | conn->addToWriteBuf(buf, strlen(buf)); 38 | 39 | } 40 | 41 | void KvProxy::writeEvent(Conn *conn) 42 | { 43 | 44 | } 45 | 46 | void KvProxy::connectionEvent(Conn *conn) 47 | { 48 | KvProxy *me = (KvProxy*)conn->getThread()->tcp_connect; 49 | printf("new connection: %d\n", conn->getFd()); 50 | me->vec.push_back(conn); 51 | } 52 | 53 | void KvProxy::closeEvent(Conn *conn, short events) 54 | { 55 | printf("connection closed: %d\n", conn->getFd()); 56 | } 57 | 58 | void KvProxy::quitCb(int sig, short events, void *data) 59 | { 60 | printf("Catch the SIGINT signal, quit in one second\n"); 61 | KvProxy *me = (KvProxy*)data; 62 | timeval tv = {1, 0}; 63 | me->stopRun(&tv); 64 | } 65 | 66 | void KvProxy::timeOutCb(int id, short events, void *data) 67 | { 68 | KvProxy *me = (KvProxy*)data; 69 | char temp[33] = "hello, world\n"; 70 | for(int i=0; ivec.size(); i++) 71 | me->vec[i]->addToWriteBuf(temp, strlen(temp)); 72 | } 73 | 74 | int main() 75 | { 76 | #if defined(SIGPIPE) && defined(SIG_IGN) 77 | signal(SIGPIPE, SIG_IGN); 78 | #endif 79 | printf("pid: %d\n", getpid()); 80 | KvProxy server(7); 81 | server.addSignalEvent(SIGINT, KvProxy::quitCb); 82 | timeval tv = {10, 0}; 83 | server.addTimerEvent(KvProxy::timeOutCb, tv, false); 84 | server.setPort(2111); 85 | server.startRun(); 86 | printf("done\n"); 87 | 88 | return 0; 89 | } 90 | -------------------------------------------------------------------------------- /proxy/test/test_util.cpp: -------------------------------------------------------------------------------- 1 | #include "util.h" 2 | using namespace std; 3 | 4 | int main(){ 5 | cout << "start func split " << endl; 6 | string str; 7 | str = "abc:def:123"; 8 | map m; 9 | map::iterator m_it; 10 | m = split(str, ':'); 11 | for(m_it = m.begin(); m_it != m.end(); m_it++){ 12 | cout << m_it->first << " -- " << m_it->second << endl; 13 | } 14 | cout << "end func split " << endl; 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /python/Makefile: -------------------------------------------------------------------------------- 1 | CXX = g++ 2 | AR = ar cr 3 | OBJ_DIR = obj 4 | SRC_DIR = src 5 | 6 | INCPATH = -I. 7 | INCPATH += -I../cpp/include 8 | INCPATH += -I../cpp/3party 9 | 10 | LFLAGS = -Llib -lkvdb 11 | 12 | 13 | TARGETSO = pykvdb.so 14 | 15 | CXX_OBJS = $(OBJ_DIR)/pykvdb.o 16 | 17 | $(OBJ_DIR)/%.o:$(SRC_DIR)/%.cpp 18 | $(CXX) -c -fPIC -o $@ $< $(INCPATH) $(LFLAGS) 19 | 20 | $(OBJ_DIR)/%.o:$(SRC_DIR)/%.c 21 | $(CXX) -c -fPIC -o $@ $< $(INCPATH) $(LFLAGS) 22 | 23 | 24 | $(TARGETSO):$(CXX_OBJS) 25 | cp ../cpp/bin/libkvdb.so lib 26 | $(CXX) -fPIC -shared -o $(TARGETSO) $(CXX_OBJS) $(LFLAGS) 27 | cp lib/libkvdb.so . 28 | 29 | .PHONY:clean 30 | clean: 31 | -rm -f $(OBJ_DIR)/*.o 32 | -rm -f $(TARGETSO) 33 | -rm -f lib/* 34 | -rm -f libkvdb.so 35 | 36 | -------------------------------------------------------------------------------- /python/test/pykvdbtest.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import pykvdb 4 | 5 | client = pykvdb.newClient('192.168.2.134:26379','item') 6 | 7 | pykvdb.set(client, 'k', 'v') 8 | 9 | vv = pykvdb.get(client, 'k') 10 | 11 | print 'v='+vv 12 | 13 | klist = ['k'] 14 | 15 | vlist = pykvdb.mget(client, klist) 16 | 17 | print 'mget' 18 | print vlist 19 | 20 | vlist = pykvdb.mget2(client, klist) 21 | 22 | print 'mget2' 23 | print vlist --------------------------------------------------------------------------------