├── .gitignore ├── .gitmodules ├── 00-RELEASENOTES ├── BUGS ├── CONTRIBUTING ├── COPYING ├── INSTALL ├── MANIFESTO ├── Makefile ├── README.md ├── deps ├── Makefile ├── README.md ├── aofguard │ ├── Makefile │ ├── include │ │ └── aofguard.h │ └── src │ │ ├── aofguard.c │ │ ├── aofguard.h │ │ ├── common.h │ │ ├── inject.c │ │ ├── sha1.c │ │ ├── sha1.h │ │ ├── syscall.c │ │ └── syscall.h ├── build-memkind.sh ├── hiredis │ ├── .gitignore │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── COPYING │ ├── Makefile │ ├── README.md │ ├── adapters │ │ ├── ae.h │ │ ├── glib.h │ │ ├── ivykis.h │ │ ├── libev.h │ │ ├── libevent.h │ │ ├── libuv.h │ │ ├── macosx.h │ │ └── qt.h │ ├── appveyor.yml │ ├── async.c │ ├── async.h │ ├── dict.c │ ├── dict.h │ ├── examples │ │ ├── example-ae.c │ │ ├── example-glib.c │ │ ├── example-ivykis.c │ │ ├── example-libev.c │ │ ├── example-libevent.c │ │ ├── example-libuv.c │ │ ├── example-macosx.c │ │ ├── example-qt.cpp │ │ ├── example-qt.h │ │ └── example.c │ ├── fmacros.h │ ├── hiredis.c │ ├── hiredis.h │ ├── net.c │ ├── net.h │ ├── read.c │ ├── read.h │ ├── sds.c │ ├── sds.h │ ├── sdsalloc.h │ ├── test.c │ └── win32.h ├── jemalloc │ ├── .autom4te.cfg │ ├── .gitattributes │ ├── .gitignore │ ├── COPYING │ ├── ChangeLog │ ├── INSTALL │ ├── Makefile.in │ ├── README │ ├── autogen.sh │ ├── bin │ │ ├── jemalloc-config.in │ │ ├── jemalloc.sh.in │ │ └── jeprof.in │ ├── config.guess │ ├── config.stamp.in │ ├── config.sub │ ├── configure.ac │ ├── coverage.sh │ ├── doc │ │ ├── html.xsl.in │ │ ├── jemalloc.xml.in │ │ ├── manpages.xsl.in │ │ └── stylesheet.xsl │ ├── include │ │ ├── jemalloc │ │ │ ├── internal │ │ │ │ ├── arena.h │ │ │ │ ├── atomic.h │ │ │ │ ├── base.h │ │ │ │ ├── bitmap.h │ │ │ │ ├── chunk.h │ │ │ │ ├── chunk_dss.h │ │ │ │ ├── chunk_mmap.h │ │ │ │ ├── ckh.h │ │ │ │ ├── ctl.h │ │ │ │ ├── extent.h │ │ │ │ ├── hash.h │ │ │ │ ├── huge.h │ │ │ │ ├── jemalloc_internal.h.in │ │ │ │ ├── jemalloc_internal_decls.h │ │ │ │ ├── jemalloc_internal_defs.h.in │ │ │ │ ├── jemalloc_internal_macros.h │ │ │ │ ├── mb.h │ │ │ │ ├── mutex.h │ │ │ │ ├── pages.h │ │ │ │ ├── private_namespace.sh │ │ │ │ ├── private_symbols.txt │ │ │ │ ├── private_unnamespace.sh │ │ │ │ ├── prng.h │ │ │ │ ├── prof.h │ │ │ │ ├── public_namespace.sh │ │ │ │ ├── public_unnamespace.sh │ │ │ │ ├── ql.h │ │ │ │ ├── qr.h │ │ │ │ ├── quarantine.h │ │ │ │ ├── rb.h │ │ │ │ ├── rtree.h │ │ │ │ ├── size_classes.sh │ │ │ │ ├── stats.h │ │ │ │ ├── tcache.h │ │ │ │ ├── tsd.h │ │ │ │ ├── util.h │ │ │ │ └── valgrind.h │ │ │ ├── jemalloc.sh │ │ │ ├── jemalloc_defs.h.in │ │ │ ├── jemalloc_macros.h.in │ │ │ ├── jemalloc_mangle.sh │ │ │ ├── jemalloc_protos.h.in │ │ │ ├── jemalloc_rename.sh │ │ │ └── jemalloc_typedefs.h.in │ │ └── msvc_compat │ │ │ ├── C99 │ │ │ ├── stdbool.h │ │ │ └── stdint.h │ │ │ ├── strings.h │ │ │ └── windows_extra.h │ ├── install-sh │ ├── jemalloc.pc.in │ ├── src │ │ ├── arena.c │ │ ├── atomic.c │ │ ├── base.c │ │ ├── bitmap.c │ │ ├── chunk.c │ │ ├── chunk_dss.c │ │ ├── chunk_mmap.c │ │ ├── ckh.c │ │ ├── ctl.c │ │ ├── extent.c │ │ ├── hash.c │ │ ├── huge.c │ │ ├── jemalloc.c │ │ ├── mb.c │ │ ├── mutex.c │ │ ├── pages.c │ │ ├── prof.c │ │ ├── quarantine.c │ │ ├── rtree.c │ │ ├── stats.c │ │ ├── tcache.c │ │ ├── tsd.c │ │ ├── util.c │ │ ├── valgrind.c │ │ └── zone.c │ └── test │ │ ├── include │ │ └── test │ │ │ ├── SFMT-alti.h │ │ │ ├── SFMT-params.h │ │ │ ├── SFMT-params11213.h │ │ │ ├── SFMT-params1279.h │ │ │ ├── SFMT-params132049.h │ │ │ ├── SFMT-params19937.h │ │ │ ├── SFMT-params216091.h │ │ │ ├── SFMT-params2281.h │ │ │ ├── SFMT-params4253.h │ │ │ ├── SFMT-params44497.h │ │ │ ├── SFMT-params607.h │ │ │ ├── SFMT-params86243.h │ │ │ ├── SFMT-sse2.h │ │ │ ├── SFMT.h │ │ │ ├── btalloc.h │ │ │ ├── jemalloc_test.h.in │ │ │ ├── jemalloc_test_defs.h.in │ │ │ ├── math.h │ │ │ ├── mq.h │ │ │ ├── mtx.h │ │ │ ├── test.h │ │ │ ├── thd.h │ │ │ └── timer.h │ │ ├── integration │ │ ├── MALLOCX_ARENA.c │ │ ├── aligned_alloc.c │ │ ├── allocated.c │ │ ├── chunk.c │ │ ├── mallocx.c │ │ ├── overflow.c │ │ ├── posix_memalign.c │ │ ├── rallocx.c │ │ ├── sdallocx.c │ │ ├── thread_arena.c │ │ ├── thread_tcache_enabled.c │ │ └── xallocx.c │ │ ├── src │ │ ├── SFMT.c │ │ ├── btalloc.c │ │ ├── btalloc_0.c │ │ ├── btalloc_1.c │ │ ├── math.c │ │ ├── mq.c │ │ ├── mtx.c │ │ ├── test.c │ │ ├── thd.c │ │ └── timer.c │ │ ├── stress │ │ └── microbench.c │ │ ├── test.sh.in │ │ └── unit │ │ ├── SFMT.c │ │ ├── atomic.c │ │ ├── bitmap.c │ │ ├── ckh.c │ │ ├── hash.c │ │ ├── junk.c │ │ ├── junk_alloc.c │ │ ├── junk_free.c │ │ ├── lg_chunk.c │ │ ├── mallctl.c │ │ ├── math.c │ │ ├── mq.c │ │ ├── mtx.c │ │ ├── prof_accum.c │ │ ├── prof_active.c │ │ ├── prof_gdump.c │ │ ├── prof_idump.c │ │ ├── prof_reset.c │ │ ├── prof_thread_name.c │ │ ├── ql.c │ │ ├── qr.c │ │ ├── quarantine.c │ │ ├── rb.c │ │ ├── rtree.c │ │ ├── size_classes.c │ │ ├── stats.c │ │ ├── tsd.c │ │ ├── util.c │ │ └── zero.c ├── jemallocat │ ├── Makefile │ ├── include │ │ └── jemallocat.h │ ├── src │ │ ├── common.h │ │ ├── jemallocat.c │ │ └── jemallocat.h │ └── tests │ │ ├── do_test_case.c │ │ ├── env.sh │ │ ├── gen_test_case.c │ │ └── infinite_tests.sh ├── linenoise │ ├── .gitignore │ ├── Makefile │ ├── README.markdown │ ├── example.c │ ├── linenoise.c │ └── linenoise.h ├── lua │ ├── COPYRIGHT │ ├── HISTORY │ ├── INSTALL │ ├── Makefile │ ├── README │ ├── doc │ │ ├── contents.html │ │ ├── cover.png │ │ ├── logo.gif │ │ ├── lua.1 │ │ ├── lua.css │ │ ├── lua.html │ │ ├── luac.1 │ │ ├── luac.html │ │ ├── manual.css │ │ ├── manual.html │ │ └── readme.html │ ├── etc │ │ ├── Makefile │ │ ├── README │ │ ├── all.c │ │ ├── lua.hpp │ │ ├── lua.ico │ │ ├── lua.pc │ │ ├── luavs.bat │ │ ├── min.c │ │ ├── noparser.c │ │ └── strict.lua │ ├── src │ │ ├── Makefile │ │ ├── fpconv.c │ │ ├── fpconv.h │ │ ├── lapi.c │ │ ├── lapi.h │ │ ├── lauxlib.c │ │ ├── lauxlib.h │ │ ├── lbaselib.c │ │ ├── lcode.c │ │ ├── lcode.h │ │ ├── ldblib.c │ │ ├── ldebug.c │ │ ├── ldebug.h │ │ ├── ldo.c │ │ ├── ldo.h │ │ ├── ldump.c │ │ ├── lfunc.c │ │ ├── lfunc.h │ │ ├── lgc.c │ │ ├── lgc.h │ │ ├── linit.c │ │ ├── liolib.c │ │ ├── llex.c │ │ ├── llex.h │ │ ├── llimits.h │ │ ├── lmathlib.c │ │ ├── lmem.c │ │ ├── lmem.h │ │ ├── loadlib.c │ │ ├── lobject.c │ │ ├── lobject.h │ │ ├── lopcodes.c │ │ ├── lopcodes.h │ │ ├── loslib.c │ │ ├── lparser.c │ │ ├── lparser.h │ │ ├── lstate.c │ │ ├── lstate.h │ │ ├── lstring.c │ │ ├── lstring.h │ │ ├── lstrlib.c │ │ ├── ltable.c │ │ ├── ltable.h │ │ ├── ltablib.c │ │ ├── ltm.c │ │ ├── ltm.h │ │ ├── lua.c │ │ ├── lua.h │ │ ├── lua_bit.c │ │ ├── lua_cjson.c │ │ ├── lua_cmsgpack.c │ │ ├── lua_struct.c │ │ ├── luac.c │ │ ├── luaconf.h │ │ ├── lualib.h │ │ ├── lundump.c │ │ ├── lundump.h │ │ ├── lvm.c │ │ ├── lvm.h │ │ ├── lzio.c │ │ ├── lzio.h │ │ ├── print.c │ │ ├── strbuf.c │ │ └── strbuf.h │ └── test │ │ ├── README │ │ ├── bisect.lua │ │ ├── cf.lua │ │ ├── echo.lua │ │ ├── env.lua │ │ ├── factorial.lua │ │ ├── fib.lua │ │ ├── fibfor.lua │ │ ├── globals.lua │ │ ├── hello.lua │ │ ├── life.lua │ │ ├── luac.lua │ │ ├── printf.lua │ │ ├── readonly.lua │ │ ├── sieve.lua │ │ ├── sort.lua │ │ ├── table.lua │ │ ├── trace-calls.lua │ │ ├── trace-globals.lua │ │ └── xd.lua ├── memkind │ ├── .gitignore │ ├── .travis.yml │ ├── AUTHORS │ ├── CONTRIBUTING │ ├── COPYING │ ├── ChangeLog │ ├── INSTALL │ ├── MANIFEST │ ├── Makefile.am │ ├── NEWS │ ├── README │ ├── README.md │ ├── autogen.sh │ ├── autohbw │ │ ├── Makefile.mk │ │ ├── autohbw.c │ │ ├── autohbw_README │ │ ├── autohbw_api.h │ │ ├── autohbw_get_src_lines.pl │ │ └── autohbw_test.sh │ ├── build_jemalloc.sh │ ├── config_tls.h.in │ ├── configure.ac │ ├── copying_headers │ │ ├── MANIFEST.EXEMPT │ │ ├── MANIFEST.freeBSD │ │ ├── MANIFEST.freeBSD3 │ │ ├── header.freeBSD │ │ ├── header.freeBSD3 │ │ └── header.intel-acpi │ ├── examples │ │ ├── Makefile.mk │ │ ├── README │ │ ├── autohbw_candidates.c │ │ ├── filter_example.c │ │ ├── gb_realloc_example.c │ │ ├── hello_hbw_example.c │ │ ├── hello_memkind_example.c │ │ ├── memkind_allocated.hpp │ │ ├── memkind_allocated_example.cpp │ │ ├── memkind_decorator_debug.c │ │ └── pmem_example.c │ ├── include │ │ ├── hbw_allocator.h │ │ ├── hbwmalloc.h │ │ ├── memkind.h │ │ ├── memkind │ │ │ └── internal │ │ │ │ ├── memkind_arena.h │ │ │ │ ├── memkind_default.h │ │ │ │ ├── memkind_gbtlb.h │ │ │ │ ├── memkind_hbw.h │ │ │ │ ├── memkind_hugetlb.h │ │ │ │ ├── memkind_interleave.h │ │ │ │ ├── memkind_log.h │ │ │ │ ├── memkind_pmem.h │ │ │ │ └── memkind_private.h │ │ └── memkind_deprecated.h │ ├── jemalloc │ │ ├── .autom4te.cfg │ │ ├── .gitattributes │ │ ├── .gitignore │ │ ├── COPYING │ │ ├── ChangeLog │ │ ├── INSTALL │ │ ├── Makefile.in │ │ ├── README │ │ ├── autogen.sh │ │ ├── bin │ │ │ ├── jemalloc-config.in │ │ │ ├── jemalloc.sh.in │ │ │ └── jeprof.in │ │ ├── build-aux │ │ │ ├── config.guess │ │ │ ├── config.sub │ │ │ └── install-sh │ │ ├── config.stamp.in │ │ ├── configure.ac │ │ ├── coverage.sh │ │ ├── doc │ │ │ ├── html.xsl.in │ │ │ ├── jemalloc.xml.in │ │ │ ├── manpages.xsl.in │ │ │ └── stylesheet.xsl │ │ ├── include │ │ │ ├── jemalloc │ │ │ │ ├── internal │ │ │ │ │ ├── arena.h │ │ │ │ │ ├── assert.h │ │ │ │ │ ├── atomic.h │ │ │ │ │ ├── base.h │ │ │ │ │ ├── bitmap.h │ │ │ │ │ ├── chunk.h │ │ │ │ │ ├── chunk_dss.h │ │ │ │ │ ├── chunk_mmap.h │ │ │ │ │ ├── ckh.h │ │ │ │ │ ├── ctl.h │ │ │ │ │ ├── extent.h │ │ │ │ │ ├── hash.h │ │ │ │ │ ├── huge.h │ │ │ │ │ ├── jemalloc_internal.h.in │ │ │ │ │ ├── jemalloc_internal_decls.h │ │ │ │ │ ├── jemalloc_internal_defs.h.in │ │ │ │ │ ├── jemalloc_internal_macros.h │ │ │ │ │ ├── mb.h │ │ │ │ │ ├── mutex.h │ │ │ │ │ ├── nstime.h │ │ │ │ │ ├── pages.h │ │ │ │ │ ├── private_namespace.sh │ │ │ │ │ ├── private_symbols.txt │ │ │ │ │ ├── private_unnamespace.sh │ │ │ │ │ ├── prng.h │ │ │ │ │ ├── prof.h │ │ │ │ │ ├── public_namespace.sh │ │ │ │ │ ├── public_unnamespace.sh │ │ │ │ │ ├── ql.h │ │ │ │ │ ├── qr.h │ │ │ │ │ ├── quarantine.h │ │ │ │ │ ├── rb.h │ │ │ │ │ ├── rtree.h │ │ │ │ │ ├── size_classes.sh │ │ │ │ │ ├── smoothstep.h │ │ │ │ │ ├── smoothstep.sh │ │ │ │ │ ├── stats.h │ │ │ │ │ ├── tcache.h │ │ │ │ │ ├── ticker.h │ │ │ │ │ ├── tsd.h │ │ │ │ │ ├── util.h │ │ │ │ │ └── valgrind.h │ │ │ │ ├── jemalloc.sh │ │ │ │ ├── jemalloc_defs.h.in │ │ │ │ ├── jemalloc_macros.h.in │ │ │ │ ├── jemalloc_mangle.sh │ │ │ │ ├── jemalloc_protos.h.in │ │ │ │ ├── jemalloc_rename.sh │ │ │ │ └── jemalloc_typedefs.h.in │ │ │ └── msvc_compat │ │ │ │ ├── C99 │ │ │ │ ├── stdbool.h │ │ │ │ └── stdint.h │ │ │ │ ├── strings.h │ │ │ │ └── windows_extra.h │ │ ├── jemalloc.pc.in │ │ ├── msvc │ │ │ ├── ReadMe.txt │ │ │ ├── jemalloc_vc2015.sln │ │ │ └── projects │ │ │ │ └── vc2015 │ │ │ │ ├── jemalloc │ │ │ │ ├── jemalloc.vcxproj │ │ │ │ └── jemalloc.vcxproj.filters │ │ │ │ └── test_threads │ │ │ │ ├── test_threads.cpp │ │ │ │ ├── test_threads.h │ │ │ │ ├── test_threads.vcxproj │ │ │ │ ├── test_threads.vcxproj.filters │ │ │ │ └── test_threads_main.cpp │ │ ├── src │ │ │ ├── arena.c │ │ │ ├── atomic.c │ │ │ ├── base.c │ │ │ ├── bitmap.c │ │ │ ├── chunk.c │ │ │ ├── chunk_dss.c │ │ │ ├── chunk_mmap.c │ │ │ ├── ckh.c │ │ │ ├── ctl.c │ │ │ ├── extent.c │ │ │ ├── hash.c │ │ │ ├── huge.c │ │ │ ├── jemalloc.c │ │ │ ├── mb.c │ │ │ ├── mutex.c │ │ │ ├── nstime.c │ │ │ ├── pages.c │ │ │ ├── prng.c │ │ │ ├── prof.c │ │ │ ├── quarantine.c │ │ │ ├── rtree.c │ │ │ ├── stats.c │ │ │ ├── tcache.c │ │ │ ├── ticker.c │ │ │ ├── tsd.c │ │ │ ├── util.c │ │ │ ├── valgrind.c │ │ │ └── zone.c │ │ └── test │ │ │ ├── include │ │ │ └── test │ │ │ │ ├── SFMT-alti.h │ │ │ │ ├── SFMT-params.h │ │ │ │ ├── SFMT-params11213.h │ │ │ │ ├── SFMT-params1279.h │ │ │ │ ├── SFMT-params132049.h │ │ │ │ ├── SFMT-params19937.h │ │ │ │ ├── SFMT-params216091.h │ │ │ │ ├── SFMT-params2281.h │ │ │ │ ├── SFMT-params4253.h │ │ │ │ ├── SFMT-params44497.h │ │ │ │ ├── SFMT-params607.h │ │ │ │ ├── SFMT-params86243.h │ │ │ │ ├── SFMT-sse2.h │ │ │ │ ├── SFMT.h │ │ │ │ ├── btalloc.h │ │ │ │ ├── jemalloc_test.h.in │ │ │ │ ├── jemalloc_test_defs.h.in │ │ │ │ ├── math.h │ │ │ │ ├── mq.h │ │ │ │ ├── mtx.h │ │ │ │ ├── test.h │ │ │ │ ├── thd.h │ │ │ │ └── timer.h │ │ │ ├── integration │ │ │ ├── MALLOCX_ARENA.c │ │ │ ├── aligned_alloc.c │ │ │ ├── allocated.c │ │ │ ├── chunk.c │ │ │ ├── mallocx.c │ │ │ ├── overflow.c │ │ │ ├── posix_memalign.c │ │ │ ├── rallocx.c │ │ │ ├── sdallocx.c │ │ │ ├── thread_arena.c │ │ │ ├── thread_tcache_enabled.c │ │ │ └── xallocx.c │ │ │ ├── src │ │ │ ├── SFMT.c │ │ │ ├── btalloc.c │ │ │ ├── btalloc_0.c │ │ │ ├── btalloc_1.c │ │ │ ├── math.c │ │ │ ├── mq.c │ │ │ ├── mtx.c │ │ │ ├── test.c │ │ │ ├── thd.c │ │ │ └── timer.c │ │ │ ├── stress │ │ │ └── microbench.c │ │ │ ├── test.sh.in │ │ │ └── unit │ │ │ ├── SFMT.c │ │ │ ├── atomic.c │ │ │ ├── bitmap.c │ │ │ ├── ckh.c │ │ │ ├── decay.c │ │ │ ├── hash.c │ │ │ ├── junk.c │ │ │ ├── junk_alloc.c │ │ │ ├── junk_free.c │ │ │ ├── lg_chunk.c │ │ │ ├── mallctl.c │ │ │ ├── math.c │ │ │ ├── mq.c │ │ │ ├── mtx.c │ │ │ ├── nstime.c │ │ │ ├── prng.c │ │ │ ├── prof_accum.c │ │ │ ├── prof_active.c │ │ │ ├── prof_gdump.c │ │ │ ├── prof_idump.c │ │ │ ├── prof_reset.c │ │ │ ├── prof_thread_name.c │ │ │ ├── ql.c │ │ │ ├── qr.c │ │ │ ├── quarantine.c │ │ │ ├── rb.c │ │ │ ├── rtree.c │ │ │ ├── run_quantize.c │ │ │ ├── size_classes.c │ │ │ ├── smoothstep.c │ │ │ ├── stats.c │ │ │ ├── ticker.c │ │ │ ├── tsd.c │ │ │ ├── util.c │ │ │ └── zero.c │ ├── make_rpm.mk │ ├── man │ │ ├── autohbw.7 │ │ ├── hbwallocator.3 │ │ ├── hbwmalloc.3 │ │ ├── memkind.3 │ │ ├── memkind_arena.3 │ │ ├── memkind_default.3 │ │ ├── memkind_gbtlb.3 │ │ ├── memkind_hbw.3 │ │ ├── memkind_hugetlb.3 │ │ ├── memkind_interleave.3 │ │ └── memkind_pmem.3 │ ├── memkind.spec.mk │ ├── src │ │ ├── hbwmalloc.c │ │ ├── memkind-hbw-nodes.c │ │ ├── memkind.c │ │ ├── memkind_arena.c │ │ ├── memkind_default.c │ │ ├── memkind_gbtlb.c │ │ ├── memkind_hbw.c │ │ ├── memkind_hugetlb.c │ │ ├── memkind_interleave.c │ │ ├── memkind_log.c │ │ └── memkind_pmem.c │ └── test │ │ ├── Makefile.mk │ │ ├── README │ │ ├── alloc_benchmark.c │ │ ├── alloc_performance_tests.cpp │ │ ├── allocate_to_max_stress_test.cpp │ │ ├── allocator_perf_tool │ │ ├── AllocationSizes.hpp │ │ ├── Allocation_info.cpp │ │ ├── Allocation_info.hpp │ │ ├── Allocator.hpp │ │ ├── AllocatorFactory.hpp │ │ ├── CSVLogger.hpp │ │ ├── CommandLine.hpp │ │ ├── Configuration.hpp │ │ ├── ConsoleLog.hpp │ │ ├── FootprintSampling.cpp │ │ ├── FootprintSampling.h │ │ ├── FootprintTask.cpp │ │ ├── FootprintTask.h │ │ ├── FunctionCalls.hpp │ │ ├── FunctionCallsPerformanceTask.cpp │ │ ├── FunctionCallsPerformanceTask.h │ │ ├── GTestAdapter.hpp │ │ ├── HugePageOrganizer.hpp │ │ ├── HugePageUnmap.hpp │ │ ├── Iterator.hpp │ │ ├── JemallocAllocatorWithTimer.hpp │ │ ├── Makefile │ │ ├── MemkindAllocatorWithTimer.hpp │ │ ├── MemoryFootprintStats.hpp │ │ ├── Numastat.hpp │ │ ├── Runnable.hpp │ │ ├── Sample.hpp │ │ ├── ScenarioWorkload.cpp │ │ ├── ScenarioWorkload.h │ │ ├── StandardAllocatorWithTimer.hpp │ │ ├── Stats.hpp │ │ ├── StressIncreaseToMax.cpp │ │ ├── StressIncreaseToMax.h │ │ ├── Task.hpp │ │ ├── TaskFactory.hpp │ │ ├── Tests.hpp │ │ ├── Thread.hpp │ │ ├── TimerSysTime.hpp │ │ ├── VectorIterator.hpp │ │ ├── Workload.hpp │ │ ├── WrappersMacros.hpp │ │ └── main.cpp │ │ ├── autohbw_test.py │ │ ├── autohbw_test_helper.c │ │ ├── bat_bind_tests.cpp │ │ ├── bat_interleave_tests.cpp │ │ ├── bat_tests.cpp │ │ ├── check.cpp │ │ ├── check.h │ │ ├── check.sh │ │ ├── common.h │ │ ├── create_tests.cpp │ │ ├── create_tests_helper.c │ │ ├── decorator_test.cpp │ │ ├── decorator_test.h │ │ ├── draw_plots.py │ │ ├── environ_err_hbw_malloc_test.cpp │ │ ├── error_message_tests.cpp │ │ ├── extended_tests.cpp │ │ ├── gb_page_tests_bind_policy.cpp │ │ ├── gb_page_tests_preferred_policy.cpp │ │ ├── get_arena_test.cpp │ │ ├── get_size_tests.cpp │ │ ├── gtest_fused │ │ └── gtest │ │ │ ├── gtest-all.cc │ │ │ └── gtest.h │ │ ├── hbw_allocator_tests.cpp │ │ ├── hbw_detection_test.py │ │ ├── hbw_verify_function_test.cpp │ │ ├── heap_manager_init_perf_test.cpp │ │ ├── huge_page_test.cpp │ │ ├── load_tbbmalloc_symbols.c │ │ ├── main.cpp │ │ ├── memkind-afts-ext.ts │ │ ├── memkind-afts.ts │ │ ├── memkind-perf-ext.ts │ │ ├── memkind-perf.ts │ │ ├── memkind-pytests.ts │ │ ├── memkind-slts.ts │ │ ├── memkind_default_tests.cpp │ │ ├── memkind_pmem_tests.cpp │ │ ├── memkind_versioning_tests.cpp │ │ ├── multithreaded_tests.cpp │ │ ├── negative_tests.cpp │ │ ├── new_kind_test.cpp │ │ ├── numakind_test.cpp │ │ ├── partition_tests.cpp │ │ ├── performance │ │ ├── framework.cpp │ │ ├── framework.hpp │ │ ├── operations.hpp │ │ ├── perf_tests.cpp │ │ └── perf_tests.hpp │ │ ├── policy_tests.cpp │ │ ├── python_framework │ │ ├── __init__.py │ │ └── cmd_helper.py │ │ ├── run_alloc_benchmark.sh │ │ ├── static_kinds_list.h │ │ ├── static_kinds_tests.cpp │ │ ├── tbbmalloc.h │ │ ├── test.sh │ │ ├── trace_mechanism_test.py │ │ ├── trace_mechanism_test_helper.c │ │ ├── trial_generator.cpp │ │ └── trial_generator.h ├── update-jemalloc.sh └── update-pmdk.sh ├── redis.conf ├── runtest ├── runtest-cluster ├── runtest-sentinel ├── sentinel.conf ├── src ├── .gitignore ├── Makefile ├── adlist.c ├── adlist.h ├── ae.c ├── ae.h ├── ae_epoll.c ├── ae_evport.c ├── ae_kqueue.c ├── ae_select.c ├── anet.c ├── anet.h ├── aof.c ├── asciilogo.h ├── atomicvar.h ├── bio.c ├── bio.h ├── bitops.c ├── blocked.c ├── childinfo.c ├── cluster.c ├── cluster.h ├── config.c ├── config.h ├── crc16.c ├── crc64.c ├── crc64.h ├── db.c ├── debug.c ├── debugmacro.h ├── defrag.c ├── dict.c ├── dict.h ├── endianconv.c ├── endianconv.h ├── evict.c ├── expire.c ├── fmacros.h ├── geo.c ├── geo.h ├── geohash.c ├── geohash.h ├── geohash_helper.c ├── geohash_helper.h ├── help.h ├── hyperloglog.c ├── intset.c ├── intset.h ├── latency.c ├── latency.h ├── lazyfree.c ├── lzf.h ├── lzfP.h ├── lzf_c.c ├── lzf_d.c ├── memtest.c ├── mkreleasehdr.sh ├── module.c ├── modules │ ├── .gitignore │ ├── Makefile │ ├── gendoc.rb │ ├── helloblock.c │ ├── hellotype.c │ ├── helloworld.c │ └── testmodule.c ├── multi.c ├── networking.c ├── notify.c ├── nvm.c ├── nvm.h ├── nvm_cow.c ├── nvm_cow.h ├── object.c ├── pqsort.c ├── pqsort.h ├── pubsub.c ├── quicklist.c ├── quicklist.h ├── rand.c ├── rand.h ├── rax.c ├── rax.h ├── rax_malloc.h ├── rdb.c ├── rdb.h ├── redis-benchmark-seq.c ├── redis-benchmark.c ├── redis-check-aof.c ├── redis-check-rdb.c ├── redis-cli.c ├── redis-trib.rb ├── redisassert.h ├── redismodule.h ├── release.c ├── replication.c ├── rio.c ├── rio.h ├── scripting.c ├── sds.c ├── sds.h ├── sdsalloc.h ├── sentinel.c ├── server.c ├── server.h ├── setproctitle.c ├── sha1.c ├── sha1.h ├── siphash.c ├── slowlog.c ├── slowlog.h ├── solarisfixes.h ├── sort.c ├── sparkline.c ├── sparkline.h ├── syncio.c ├── t_hash.c ├── t_list.c ├── t_set.c ├── t_string.c ├── t_zset.c ├── testhelp.h ├── util.c ├── util.h ├── valgrind.sup ├── version.h ├── ziplist.c ├── ziplist.h ├── zipmap.c ├── zipmap.h ├── zmalloc.c └── zmalloc.h ├── tests ├── assets │ ├── default.conf │ ├── encodings.rdb │ └── hash-zipmap.rdb ├── bkc_scripts │ ├── auth_slave.sh │ ├── client.sh │ ├── client_replication.sh │ ├── env_prepare.sh │ ├── replication_function.sh │ ├── server_aep.sh │ ├── server_ddr.sh │ └── server_replication.sh ├── cce_scipts │ ├── aepwatch.sh │ ├── auto_redis.sh │ ├── create_aep_file.sh │ ├── emon.sh │ ├── parse.sh │ ├── parse_debug.sh │ ├── remote_server.sh │ ├── run_parse.sh │ ├── run_redis.sh │ └── zero-out.sh ├── cluster │ ├── cluster.tcl │ ├── run.tcl │ ├── tests │ │ ├── 00-base.tcl │ │ ├── 01-faildet.tcl │ │ ├── 02-failover.tcl │ │ ├── 03-failover-loop.tcl │ │ ├── 04-resharding.tcl │ │ ├── 05-slave-selection.tcl │ │ ├── 06-slave-stop-cond.tcl │ │ ├── 07-replica-migration.tcl │ │ ├── 08-update-msg.tcl │ │ ├── 09-pubsub.tcl │ │ ├── 10-manual-failover.tcl │ │ ├── 11-manual-takeover.tcl │ │ ├── 12-replica-migration-2.tcl │ │ ├── helpers │ │ │ └── onlydots.tcl │ │ └── includes │ │ │ └── init-tests.tcl │ └── tmp │ │ └── .gitignore ├── helpers │ ├── bg_complex_data.tcl │ └── gen_write_load.tcl ├── instances.tcl ├── integration │ ├── aof-race.tcl │ ├── aof.tcl │ ├── convert-zipmap-hash-on-load.tcl │ ├── logging.tcl │ ├── psync2-reg.tcl │ ├── psync2.tcl │ ├── rdb.tcl │ ├── redis-cli.tcl │ ├── replication-2.tcl │ ├── replication-3.tcl │ ├── replication-4.tcl │ ├── replication-psync.tcl │ └── replication.tcl ├── py-tests │ ├── gen_dataset.py │ ├── list_stress.py │ ├── t_hash.py │ ├── t_set.py │ └── t_zset.py ├── sentinel │ ├── run.tcl │ ├── tests │ │ ├── 00-base.tcl │ │ ├── 01-conf-update.tcl │ │ ├── 02-slaves-reconf.tcl │ │ ├── 03-runtime-reconf.tcl │ │ ├── 04-slave-selection.tcl │ │ ├── 05-manual.tcl │ │ ├── 06-ckquorum.tcl │ │ ├── 07-down-conditions.tcl │ │ └── includes │ │ │ └── init-tests.tcl │ └── tmp │ │ └── .gitignore ├── support │ ├── cluster.tcl │ ├── redis.tcl │ ├── server.tcl │ ├── test.tcl │ ├── tmpfile.tcl │ └── util.tcl ├── test_helper.tcl └── unit │ ├── aofrw.tcl │ ├── auth.tcl │ ├── bitfield.tcl │ ├── bitops.tcl │ ├── dump.tcl │ ├── expire.tcl │ ├── geo.tcl │ ├── hyperloglog.tcl │ ├── introspection-2.tcl │ ├── introspection.tcl │ ├── keyspace.tcl │ ├── latency-monitor.tcl │ ├── lazyfree.tcl │ ├── limits.tcl │ ├── maxmemory.tcl │ ├── memefficiency.tcl │ ├── multi.tcl │ ├── obuf-limits.tcl │ ├── other.tcl │ ├── printver.tcl │ ├── protocol.tcl │ ├── pubsub.tcl │ ├── quit.tcl │ ├── scan.tcl │ ├── scripting.tcl │ ├── slowlog.tcl │ ├── sort.tcl │ ├── type │ ├── hash.tcl │ ├── incr.tcl │ ├── list-2.tcl │ ├── list-3.tcl │ ├── list-common.tcl │ ├── list.tcl │ ├── set.tcl │ ├── string.tcl │ └── zset.tcl │ └── wait.tcl └── utils ├── build-static-symbols.tcl ├── cluster_fail_time.tcl ├── corrupt_rdb.c ├── create-cluster ├── .gitignore ├── README └── create-cluster ├── generate-command-help.rb ├── graphs └── commits-over-time │ ├── README.md │ └── genhtml.tcl ├── hashtable ├── README └── rehashing.c ├── hyperloglog ├── .gitignore ├── hll-err.rb └── hll-gnuplot-graph.rb ├── install_server.sh ├── lru ├── README ├── lfu-simulation.c └── test-lru.rb ├── redis-copy.rb ├── redis-sha1.rb ├── redis_init_script ├── redis_init_script.tpl ├── releasetools ├── 01_create_tarball.sh ├── 02_upload_tarball.sh ├── 03_test_release.sh ├── 04_release_hash.sh └── changelog.tcl ├── speed-regression.tcl └── whatisdoing.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .*.swp 2 | *.o 3 | *.log 4 | dump.rdb 5 | redis-benchmark 6 | redis-check-aof 7 | redis-check-rdb 8 | redis-check-dump 9 | redis-cli 10 | redis-benchmark-seq 11 | redis-sentinel 12 | redis-server 13 | doc-tools 14 | release 15 | misc/* 16 | src/release.h 17 | appendonly.aof 18 | SHORT_TERM_TODO 19 | release.h 20 | src/transfer.sh 21 | src/configs 22 | redis.ds 23 | src/redis.conf 24 | src/nodes.conf 25 | deps/lua/src/lua 26 | deps/lua/src/luac 27 | deps/lua/src/liblua.a 28 | .make-* 29 | .prerequisites 30 | *.dSYM 31 | Makefile.dep 32 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/pmdk"] 2 | path = deps/pmdk 3 | url = https://github.com/pmem/pmdk 4 | -------------------------------------------------------------------------------- /BUGS: -------------------------------------------------------------------------------- 1 | Please check https://github.com/antirez/redis/issues 2 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006-2015, Salvatore Sanfilippo 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | * Neither the name of Redis nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 9 | 10 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 11 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | See README 2 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Top level makefile, the real shit is at src/Makefile 2 | JEMALLOC_PATH=../deps/memkind 3 | export JEMALLOC_PATH 4 | 5 | default: all 6 | 7 | .DEFAULT: 8 | cd src && $(MAKE) $@ 9 | 10 | install: 11 | cd src && $(MAKE) $@ 12 | 13 | .PHONY: install 14 | -------------------------------------------------------------------------------- /deps/aofguard/Makefile: -------------------------------------------------------------------------------- 1 | all: lib/libaofguard.so lib/libaofguard.a lib/libaofguard_inject.so 2 | 3 | lib/libaofguard.so: src/common.h src/syscall.h src/aofguard.h src/syscall.c src/aofguard.c 4 | mkdir -p lib 5 | gcc -std=gnu99 src/syscall.c src/aofguard.c -o lib/libaofguard.so -fPIC -shared -lpthread -Wall 6 | 7 | lib/libaofguard.a: src/common.h src/syscall.h src/aofguard.h src/syscall.c src/aofguard.c 8 | mkdir -p lib 9 | gcc -std=gnu99 -c src/syscall.c -o src/syscall.o -Wall 10 | gcc -std=gnu99 -c src/aofguard.c -o src/aofguard.o -Wall 11 | ar cr lib/libaofguard.a src/syscall.o src/aofguard.o 12 | rm -f src/syscall.o 13 | rm -f src/aofguard.o 14 | 15 | lib/libaofguard_inject.so: src/common.h src/syscall.h src/sha1.h src/aofguard.h src/syscall.c src/sha1.c src/aofguard.c src/inject.c 16 | mkdir -p lib 17 | gcc -std=gnu99 src/syscall.c src/sha1.c src/aofguard.c src/inject.c -o lib/libaofguard_inject.so -fPIC -shared -lpthread -Wall 18 | 19 | clean: 20 | rm -rf lib 21 | -------------------------------------------------------------------------------- /deps/aofguard/include/aofguard.h: -------------------------------------------------------------------------------- 1 | #ifndef AOFGUARD_H 2 | #define AOFGUARD_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | struct aofguard 9 | { 10 | struct 11 | { 12 | int fd; 13 | size_t fsync_len; 14 | } 15 | file; 16 | struct 17 | { 18 | char* data; 19 | size_t capacity; 20 | size_t start; 21 | size_t len; 22 | } 23 | buffer; 24 | struct 25 | { 26 | size_t* fsync_len_and_start_block; 27 | size_t* buf_end; 28 | } 29 | meta; 30 | struct 31 | { 32 | size_t block_count; 33 | pthread_t thread; 34 | sem_t sem_start, sem_done; 35 | } 36 | afsync; 37 | }; 38 | 39 | int aofguard_init(struct aofguard* aofguard, int fd, int nvm_dir_fd, const char* nvm_file, size_t nvm_size, int reset); 40 | 41 | int aofguard_write(struct aofguard* aofguard, const void* data, size_t len); 42 | 43 | int aofguard_deinit(struct aofguard* aofguard); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /deps/aofguard/src/aofguard.h: -------------------------------------------------------------------------------- 1 | #ifndef AOFGUARD_H 2 | #define AOFGUARD_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | struct aofguard 9 | { 10 | struct 11 | { 12 | int fd; 13 | size_t fsync_len; 14 | } 15 | file; 16 | struct 17 | { 18 | char* data; 19 | size_t capacity; 20 | size_t start; 21 | size_t len; 22 | } 23 | buffer; 24 | struct 25 | { 26 | size_t* fsync_len_and_start_block; 27 | size_t* buf_end; 28 | } 29 | meta; 30 | struct 31 | { 32 | size_t block_count; 33 | pthread_t thread; 34 | sem_t sem_start, sem_done; 35 | } 36 | afsync; 37 | }; 38 | 39 | int aofguard_init(struct aofguard* aofguard, int fd, int nvm_dir_fd, const char* nvm_file, size_t nvm_size, int reset); 40 | 41 | int aofguard_write(struct aofguard* aofguard, const void* data, size_t len); 42 | 43 | int aofguard_deinit(struct aofguard* aofguard); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /deps/aofguard/src/sha1.h: -------------------------------------------------------------------------------- 1 | #ifndef SHA1_H 2 | #define SHA1_H 3 | 4 | #include 5 | #include 6 | 7 | struct sha1_context 8 | { 9 | uint32_t state[5]; 10 | uint32_t count[2]; 11 | uint8_t buffer[64]; 12 | }; 13 | 14 | void sha1_init(struct sha1_context* context); 15 | void sha1_update(struct sha1_context* context, const uint8_t* data, size_t len); 16 | void sha1_final(struct sha1_context* context, uint8_t digest[20]); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /deps/aofguard/src/syscall.h: -------------------------------------------------------------------------------- 1 | #ifndef SYSCALL_H 2 | #define SYSCALL_H 3 | 4 | #include 5 | #include 6 | 7 | int syscall_faccessat(int dirfd, const char* file, int mode, int flags); 8 | 9 | int syscall_rename(const char* oldpath, const char* newpath); 10 | 11 | int syscall_renameat(int olddirfd, const char* oldpath, int newdirfd, const char* newpath); 12 | 13 | int syscall_unlink(const char* file); 14 | 15 | int syscall_unlinkat(int dirfd, const char* file, int flags); 16 | 17 | int syscall_open(const char* file, int flags, ...); 18 | 19 | int syscall_openat(int dirfd, const char* file, int flags, ...); 20 | 21 | ssize_t syscall_write(int fd, const void* data, size_t len); 22 | 23 | int syscall_fsync(int fd); 24 | 25 | int syscall_fdatasync(int fd); 26 | 27 | int syscall_fstat(int fd, struct stat* stat); 28 | 29 | int syscall_ftruncate(int fd, size_t size); 30 | 31 | void* syscall_mmap(void* addr, size_t length, int prot, int flags, int fd, off_t offset); 32 | 33 | int syscall_close(int fd); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /deps/hiredis/.gitignore: -------------------------------------------------------------------------------- 1 | /hiredis-test 2 | /examples/hiredis-example* 3 | /*.o 4 | /*.so 5 | /*.dylib 6 | /*.a 7 | /*.pc 8 | -------------------------------------------------------------------------------- /deps/hiredis/.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | sudo: false 3 | compiler: 4 | - gcc 5 | - clang 6 | 7 | os: 8 | - linux 9 | - osx 10 | 11 | before_script: 12 | - if [ "$TRAVIS_OS_NAME" == "osx" ] ; then brew update; brew install redis; fi 13 | 14 | addons: 15 | apt: 16 | packages: 17 | - libc6-dbg 18 | - libc6-dev 19 | - libc6:i386 20 | - libc6-dev-i386 21 | - libc6-dbg:i386 22 | - gcc-multilib 23 | - valgrind 24 | 25 | env: 26 | - CFLAGS="-Werror" 27 | - PRE="valgrind --track-origins=yes --leak-check=full" 28 | - TARGET="32bit" TARGET_VARS="32bit-vars" CFLAGS="-Werror" 29 | - TARGET="32bit" TARGET_VARS="32bit-vars" PRE="valgrind --track-origins=yes --leak-check=full" 30 | 31 | matrix: 32 | exclude: 33 | - os: osx 34 | env: PRE="valgrind --track-origins=yes --leak-check=full" 35 | 36 | - os: osx 37 | env: TARGET="32bit" TARGET_VARS="32bit-vars" PRE="valgrind --track-origins=yes --leak-check=full" 38 | 39 | script: make $TARGET CFLAGS="$CFLAGS" && make check PRE="$PRE" && make $TARGET_VARS hiredis-example 40 | -------------------------------------------------------------------------------- /deps/hiredis/appveyor.yml: -------------------------------------------------------------------------------- 1 | # Appveyor configuration file for CI build of hiredis on Windows (under Cygwin) 2 | environment: 3 | matrix: 4 | - CYG_ROOT: C:\cygwin64 5 | CYG_SETUP: setup-x86_64.exe 6 | CYG_MIRROR: http://cygwin.mirror.constant.com 7 | CYG_CACHE: C:\cygwin64\var\cache\setup 8 | CYG_BASH: C:\cygwin64\bin\bash 9 | CC: gcc 10 | - CYG_ROOT: C:\cygwin 11 | CYG_SETUP: setup-x86.exe 12 | CYG_MIRROR: http://cygwin.mirror.constant.com 13 | CYG_CACHE: C:\cygwin\var\cache\setup 14 | CYG_BASH: C:\cygwin\bin\bash 15 | CC: gcc 16 | TARGET: 32bit 17 | TARGET_VARS: 32bit-vars 18 | 19 | # Cache Cygwin files to speed up build 20 | cache: 21 | - '%CYG_CACHE%' 22 | clone_depth: 1 23 | 24 | # Attempt to ensure we don't try to convert line endings to Win32 CRLF as this will cause build to fail 25 | init: 26 | - git config --global core.autocrlf input 27 | 28 | # Install needed build dependencies 29 | install: 30 | - ps: 'Start-FileDownload "http://cygwin.com/$env:CYG_SETUP" -FileName "$env:CYG_SETUP"' 31 | - '%CYG_SETUP% --quiet-mode --no-shortcuts --only-site --root "%CYG_ROOT%" --site "%CYG_MIRROR%" --local-package-dir "%CYG_CACHE%" --packages automake,bison,gcc-core,libtool,make,gettext-devel,gettext,intltool,pkg-config,clang,llvm > NUL 2>&1' 32 | - '%CYG_BASH% -lc "cygcheck -dc cygwin"' 33 | 34 | build_script: 35 | - 'echo building...' 36 | - '%CYG_BASH% -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | void getCallback(redisAsyncContext *c, void *r, void *privdata) { 11 | redisReply *reply = r; 12 | if (reply == NULL) return; 13 | printf("argv[%s]: %s\n", (char*)privdata, reply->str); 14 | 15 | /* Disconnect after receiving the reply to GET */ 16 | redisAsyncDisconnect(c); 17 | } 18 | 19 | void connectCallback(const redisAsyncContext *c, int status) { 20 | if (status != REDIS_OK) { 21 | printf("Error: %s\n", c->errstr); 22 | return; 23 | } 24 | printf("Connected...\n"); 25 | } 26 | 27 | void disconnectCallback(const redisAsyncContext *c, int status) { 28 | if (status != REDIS_OK) { 29 | printf("Error: %s\n", c->errstr); 30 | return; 31 | } 32 | printf("Disconnected...\n"); 33 | } 34 | 35 | int main (int argc, char **argv) { 36 | signal(SIGPIPE, SIG_IGN); 37 | 38 | iv_init(); 39 | 40 | redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379); 41 | if (c->err) { 42 | /* Let *c leak for now... */ 43 | printf("Error: %s\n", c->errstr); 44 | return 1; 45 | } 46 | 47 | redisIvykisAttach(c); 48 | redisAsyncSetConnectCallback(c,connectCallback); 49 | redisAsyncSetDisconnectCallback(c,disconnectCallback); 50 | redisAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1])); 51 | redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key"); 52 | 53 | iv_main(); 54 | 55 | iv_deinit(); 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /deps/hiredis/examples/example-libev.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | void getCallback(redisAsyncContext *c, void *r, void *privdata) { 11 | redisReply *reply = r; 12 | if (reply == NULL) return; 13 | printf("argv[%s]: %s\n", (char*)privdata, reply->str); 14 | 15 | /* Disconnect after receiving the reply to GET */ 16 | redisAsyncDisconnect(c); 17 | } 18 | 19 | void connectCallback(const redisAsyncContext *c, int status) { 20 | if (status != REDIS_OK) { 21 | printf("Error: %s\n", c->errstr); 22 | return; 23 | } 24 | printf("Connected...\n"); 25 | } 26 | 27 | void disconnectCallback(const redisAsyncContext *c, int status) { 28 | if (status != REDIS_OK) { 29 | printf("Error: %s\n", c->errstr); 30 | return; 31 | } 32 | printf("Disconnected...\n"); 33 | } 34 | 35 | int main (int argc, char **argv) { 36 | signal(SIGPIPE, SIG_IGN); 37 | 38 | redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379); 39 | if (c->err) { 40 | /* Let *c leak for now... */ 41 | printf("Error: %s\n", c->errstr); 42 | return 1; 43 | } 44 | 45 | redisLibevAttach(EV_DEFAULT_ c); 46 | redisAsyncSetConnectCallback(c,connectCallback); 47 | redisAsyncSetDisconnectCallback(c,disconnectCallback); 48 | redisAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1])); 49 | redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key"); 50 | ev_loop(EV_DEFAULT_ 0); 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /deps/hiredis/examples/example-qt.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #include 5 | #include 6 | 7 | #include "example-qt.h" 8 | 9 | void getCallback(redisAsyncContext *, void * r, void * privdata) { 10 | 11 | redisReply * reply = static_cast(r); 12 | ExampleQt * ex = static_cast(privdata); 13 | if (reply == nullptr || ex == nullptr) return; 14 | 15 | cout << "key: " << reply->str << endl; 16 | 17 | ex->finish(); 18 | } 19 | 20 | void ExampleQt::run() { 21 | 22 | m_ctx = redisAsyncConnect("localhost", 6379); 23 | 24 | if (m_ctx->err) { 25 | cerr << "Error: " << m_ctx->errstr << endl; 26 | redisAsyncFree(m_ctx); 27 | emit finished(); 28 | } 29 | 30 | m_adapter.setContext(m_ctx); 31 | 32 | redisAsyncCommand(m_ctx, NULL, NULL, "SET key %s", m_value); 33 | redisAsyncCommand(m_ctx, getCallback, this, "GET key"); 34 | } 35 | 36 | int main (int argc, char **argv) { 37 | 38 | QCoreApplication app(argc, argv); 39 | 40 | ExampleQt example(argv[argc-1]); 41 | 42 | QObject::connect(&example, SIGNAL(finished()), &app, SLOT(quit())); 43 | QTimer::singleShot(0, &example, SLOT(run())); 44 | 45 | return app.exec(); 46 | } 47 | -------------------------------------------------------------------------------- /deps/hiredis/examples/example-qt.h: -------------------------------------------------------------------------------- 1 | #ifndef __HIREDIS_EXAMPLE_QT_H 2 | #define __HIREDIS_EXAMPLE_QT_H 3 | 4 | #include 5 | 6 | class ExampleQt : public QObject { 7 | 8 | Q_OBJECT 9 | 10 | public: 11 | ExampleQt(const char * value, QObject * parent = 0) 12 | : QObject(parent), m_value(value) {} 13 | 14 | signals: 15 | void finished(); 16 | 17 | public slots: 18 | void run(); 19 | 20 | private: 21 | void finish() { emit finished(); } 22 | 23 | private: 24 | const char * m_value; 25 | redisAsyncContext * m_ctx; 26 | RedisQtAdapter m_adapter; 27 | 28 | friend 29 | void getCallback(redisAsyncContext *, void *, void *); 30 | }; 31 | 32 | #endif /* !__HIREDIS_EXAMPLE_QT_H */ 33 | -------------------------------------------------------------------------------- /deps/hiredis/fmacros.h: -------------------------------------------------------------------------------- 1 | #ifndef __HIREDIS_FMACRO_H 2 | #define __HIREDIS_FMACRO_H 3 | 4 | #if defined(__linux__) 5 | #define _BSD_SOURCE 6 | #define _DEFAULT_SOURCE 7 | #endif 8 | 9 | #if defined(__CYGWIN__) 10 | #include 11 | #endif 12 | 13 | #if defined(__sun__) 14 | #define _POSIX_C_SOURCE 200112L 15 | #else 16 | #if !(defined(__APPLE__) && defined(__MACH__)) 17 | #define _XOPEN_SOURCE 600 18 | #endif 19 | #endif 20 | 21 | #if defined(__APPLE__) && defined(__MACH__) 22 | #define _OSX 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /deps/hiredis/win32.h: -------------------------------------------------------------------------------- 1 | #ifndef _WIN32_HELPER_INCLUDE 2 | #define _WIN32_HELPER_INCLUDE 3 | #ifdef _MSC_VER 4 | 5 | #ifndef inline 6 | #define inline __inline 7 | #endif 8 | 9 | #ifndef va_copy 10 | #define va_copy(d,s) ((d) = (s)) 11 | #endif 12 | 13 | #ifndef snprintf 14 | #define snprintf c99_snprintf 15 | 16 | __inline int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap) 17 | { 18 | int count = -1; 19 | 20 | if (size != 0) 21 | count = _vsnprintf_s(str, size, _TRUNCATE, format, ap); 22 | if (count == -1) 23 | count = _vscprintf(format, ap); 24 | 25 | return count; 26 | } 27 | 28 | __inline int c99_snprintf(char* str, size_t size, const char* format, ...) 29 | { 30 | int count; 31 | va_list ap; 32 | 33 | va_start(ap, format); 34 | count = c99_vsnprintf(str, size, format, ap); 35 | va_end(ap); 36 | 37 | return count; 38 | } 39 | #endif 40 | 41 | #endif 42 | #endif -------------------------------------------------------------------------------- /deps/jemalloc/.autom4te.cfg: -------------------------------------------------------------------------------- 1 | begin-language: "Autoconf-without-aclocal-m4" 2 | args: --no-cache 3 | end-language: "Autoconf-without-aclocal-m4" 4 | -------------------------------------------------------------------------------- /deps/jemalloc/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /deps/jemalloc/README: -------------------------------------------------------------------------------- 1 | jemalloc is a general purpose malloc(3) implementation that emphasizes 2 | fragmentation avoidance and scalable concurrency support. jemalloc first came 3 | into use as the FreeBSD libc allocator in 2005, and since then it has found its 4 | way into numerous applications that rely on its predictable behavior. In 2010 5 | jemalloc development efforts broadened to include developer support features 6 | such as heap profiling, Valgrind integration, and extensive monitoring/tuning 7 | hooks. Modern jemalloc releases continue to be integrated back into FreeBSD, 8 | and therefore versatility remains critical. Ongoing development efforts trend 9 | toward making jemalloc among the best allocators for a broad range of demanding 10 | applications, and eliminating/mitigating weaknesses that have practical 11 | repercussions for real world applications. 12 | 13 | The COPYING file contains copyright and licensing information. 14 | 15 | The INSTALL file contains information on how to configure, build, and install 16 | jemalloc. 17 | 18 | The ChangeLog file contains a brief summary of changes for each release. 19 | 20 | URL: http://www.canonware.com/jemalloc/ 21 | -------------------------------------------------------------------------------- /deps/jemalloc/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in autoconf; do 4 | echo "$i" 5 | $i 6 | if [ $? -ne 0 ]; then 7 | echo "Error $? in $i" 8 | exit 1 9 | fi 10 | done 11 | 12 | echo "./configure --enable-autogen $@" 13 | ./configure --enable-autogen $@ 14 | if [ $? -ne 0 ]; then 15 | echo "Error $? in ./configure" 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /deps/jemalloc/bin/jemalloc.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | 7 | @LD_PRELOAD_VAR@=${libdir}/libjemalloc.@SOREV@ 8 | export @LD_PRELOAD_VAR@ 9 | exec "$@" 10 | -------------------------------------------------------------------------------- /deps/jemalloc/config.stamp.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmem/pmem-redis/4b9cf06de20e4010d71b1803bb2348b6543a63da/deps/jemalloc/config.stamp.in -------------------------------------------------------------------------------- /deps/jemalloc/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | objdir=$1 6 | suffix=$2 7 | shift 2 8 | objs=$@ 9 | 10 | gcov -b -p -f -o "${objdir}" ${objs} 11 | 12 | # Move gcov outputs so that subsequent gcov invocations won't clobber results 13 | # for the same sources with different compilation flags. 14 | for f in `find . -maxdepth 1 -type f -name '*.gcov'` ; do 15 | mv "${f}" "${f}.${suffix}" 16 | done 17 | -------------------------------------------------------------------------------- /deps/jemalloc/doc/html.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /deps/jemalloc/doc/manpages.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /deps/jemalloc/doc/stylesheet.xsl: -------------------------------------------------------------------------------- 1 | 2 | ansi 3 | 4 | 5 | "" 6 | 7 | 8 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/base.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | #endif /* JEMALLOC_H_TYPES */ 5 | /******************************************************************************/ 6 | #ifdef JEMALLOC_H_STRUCTS 7 | 8 | #endif /* JEMALLOC_H_STRUCTS */ 9 | /******************************************************************************/ 10 | #ifdef JEMALLOC_H_EXTERNS 11 | 12 | void *base_alloc(size_t size); 13 | void base_stats_get(size_t *allocated, size_t *resident, size_t *mapped); 14 | bool base_boot(void); 15 | void base_prefork(void); 16 | void base_postfork_parent(void); 17 | void base_postfork_child(void); 18 | 19 | #endif /* JEMALLOC_H_EXTERNS */ 20 | /******************************************************************************/ 21 | #ifdef JEMALLOC_H_INLINES 22 | 23 | #endif /* JEMALLOC_H_INLINES */ 24 | /******************************************************************************/ 25 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/chunk_dss.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | typedef enum { 5 | dss_prec_disabled = 0, 6 | dss_prec_primary = 1, 7 | dss_prec_secondary = 2, 8 | 9 | dss_prec_limit = 3 10 | } dss_prec_t; 11 | #define DSS_PREC_DEFAULT dss_prec_secondary 12 | #define DSS_DEFAULT "secondary" 13 | 14 | #endif /* JEMALLOC_H_TYPES */ 15 | /******************************************************************************/ 16 | #ifdef JEMALLOC_H_STRUCTS 17 | 18 | extern const char *dss_prec_names[]; 19 | 20 | #endif /* JEMALLOC_H_STRUCTS */ 21 | /******************************************************************************/ 22 | #ifdef JEMALLOC_H_EXTERNS 23 | 24 | dss_prec_t chunk_dss_prec_get(void); 25 | bool chunk_dss_prec_set(dss_prec_t dss_prec); 26 | void *chunk_alloc_dss(arena_t *arena, void *new_addr, size_t size, 27 | size_t alignment, bool *zero, bool *commit); 28 | bool chunk_in_dss(void *chunk); 29 | bool chunk_dss_boot(void); 30 | void chunk_dss_prefork(void); 31 | void chunk_dss_postfork_parent(void); 32 | void chunk_dss_postfork_child(void); 33 | 34 | #endif /* JEMALLOC_H_EXTERNS */ 35 | /******************************************************************************/ 36 | #ifdef JEMALLOC_H_INLINES 37 | 38 | #endif /* JEMALLOC_H_INLINES */ 39 | /******************************************************************************/ 40 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/chunk_mmap.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | #endif /* JEMALLOC_H_TYPES */ 5 | /******************************************************************************/ 6 | #ifdef JEMALLOC_H_STRUCTS 7 | 8 | #endif /* JEMALLOC_H_STRUCTS */ 9 | /******************************************************************************/ 10 | #ifdef JEMALLOC_H_EXTERNS 11 | 12 | void *chunk_alloc_mmap(size_t size, size_t alignment, bool *zero, 13 | bool *commit); 14 | bool chunk_dalloc_mmap(void *chunk, size_t size); 15 | 16 | #endif /* JEMALLOC_H_EXTERNS */ 17 | /******************************************************************************/ 18 | #ifdef JEMALLOC_H_INLINES 19 | 20 | #endif /* JEMALLOC_H_INLINES */ 21 | /******************************************************************************/ 22 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/huge.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | #endif /* JEMALLOC_H_TYPES */ 5 | /******************************************************************************/ 6 | #ifdef JEMALLOC_H_STRUCTS 7 | 8 | #endif /* JEMALLOC_H_STRUCTS */ 9 | /******************************************************************************/ 10 | #ifdef JEMALLOC_H_EXTERNS 11 | 12 | void *huge_malloc(tsd_t *tsd, arena_t *arena, size_t size, bool zero, 13 | tcache_t *tcache); 14 | void *huge_palloc(tsd_t *tsd, arena_t *arena, size_t size, size_t alignment, 15 | bool zero, tcache_t *tcache); 16 | bool huge_ralloc_no_move(void *ptr, size_t oldsize, size_t usize_min, 17 | size_t usize_max, bool zero); 18 | void *huge_ralloc(tsd_t *tsd, arena_t *arena, void *ptr, size_t oldsize, 19 | size_t usize, size_t alignment, bool zero, tcache_t *tcache); 20 | #ifdef JEMALLOC_JET 21 | typedef void (huge_dalloc_junk_t)(void *, size_t); 22 | extern huge_dalloc_junk_t *huge_dalloc_junk; 23 | #endif 24 | void huge_dalloc(tsd_t *tsd, void *ptr, tcache_t *tcache); 25 | arena_t *huge_aalloc(const void *ptr); 26 | size_t huge_salloc(const void *ptr); 27 | prof_tctx_t *huge_prof_tctx_get(const void *ptr); 28 | void huge_prof_tctx_set(const void *ptr, prof_tctx_t *tctx); 29 | void huge_prof_tctx_reset(const void *ptr); 30 | 31 | #endif /* JEMALLOC_H_EXTERNS */ 32 | /******************************************************************************/ 33 | #ifdef JEMALLOC_H_INLINES 34 | 35 | #endif /* JEMALLOC_H_INLINES */ 36 | /******************************************************************************/ 37 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/jemalloc_internal_decls.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_DECLS_H 2 | #define JEMALLOC_INTERNAL_DECLS_H 3 | 4 | #include 5 | #ifdef _WIN32 6 | # include 7 | # include "msvc_compat/windows_extra.h" 8 | 9 | #else 10 | # include 11 | # include 12 | # if !defined(__pnacl__) && !defined(__native_client__) 13 | # include 14 | # if !defined(SYS_write) && defined(__NR_write) 15 | # define SYS_write __NR_write 16 | # endif 17 | # include 18 | # endif 19 | # include 20 | # include 21 | #endif 22 | #include 23 | 24 | #include 25 | #ifndef SIZE_T_MAX 26 | # define SIZE_T_MAX SIZE_MAX 27 | #endif 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #ifndef offsetof 35 | # define offsetof(type, member) ((size_t)&(((type *)NULL)->member)) 36 | #endif 37 | #include 38 | #include 39 | #include 40 | #ifdef _MSC_VER 41 | # include 42 | typedef intptr_t ssize_t; 43 | # define PATH_MAX 1024 44 | # define STDERR_FILENO 2 45 | # define __func__ __FUNCTION__ 46 | # ifdef JEMALLOC_HAS_RESTRICT 47 | # define restrict __restrict 48 | # endif 49 | /* Disable warnings about deprecated system functions. */ 50 | # pragma warning(disable: 4996) 51 | #if _MSC_VER < 1800 52 | static int 53 | isblank(int c) 54 | { 55 | 56 | return (c == '\t' || c == ' '); 57 | } 58 | #endif 59 | #else 60 | # include 61 | #endif 62 | #include 63 | 64 | #endif /* JEMALLOC_INTERNAL_H */ 65 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/pages.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | #endif /* JEMALLOC_H_TYPES */ 5 | /******************************************************************************/ 6 | #ifdef JEMALLOC_H_STRUCTS 7 | 8 | #endif /* JEMALLOC_H_STRUCTS */ 9 | /******************************************************************************/ 10 | #ifdef JEMALLOC_H_EXTERNS 11 | 12 | void *pages_map(void *addr, size_t size); 13 | void pages_unmap(void *addr, size_t size); 14 | void *pages_trim(void *addr, size_t alloc_size, size_t leadsize, 15 | size_t size); 16 | bool pages_commit(void *addr, size_t size); 17 | bool pages_decommit(void *addr, size_t size); 18 | bool pages_purge(void *addr, size_t size); 19 | 20 | #endif /* JEMALLOC_H_EXTERNS */ 21 | /******************************************************************************/ 22 | #ifdef JEMALLOC_H_INLINES 23 | 24 | #endif /* JEMALLOC_H_INLINES */ 25 | /******************************************************************************/ 26 | 27 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/private_namespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for symbol in `cat $1` ; do 4 | echo "#define ${symbol} JEMALLOC_N(${symbol})" 5 | done 6 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/private_unnamespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for symbol in `cat $1` ; do 4 | echo "#undef ${symbol}" 5 | done 6 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/public_namespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for nm in `cat $1` ; do 4 | n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` 5 | echo "#define je_${n} JEMALLOC_N(${n})" 6 | done 7 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/internal/public_unnamespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for nm in `cat $1` ; do 4 | n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` 5 | echo "#undef je_${n}" 6 | done 7 | -------------------------------------------------------------------------------- /deps/jemalloc/include/jemalloc/jemalloc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | objroot=$1 4 | 5 | cat < 5 | 6 | /* MSVC doesn't define _Bool or bool in C, but does have BOOL */ 7 | /* Note this doesn't pass autoconf's test because (bool) 0.5 != true */ 8 | /* Clang-cl uses MSVC headers, so needs msvc_compat, but has _Bool as 9 | * a built-in type. */ 10 | #ifndef __clang__ 11 | typedef BOOL _Bool; 12 | #endif 13 | 14 | #define bool _Bool 15 | #define true 1 16 | #define false 0 17 | 18 | #define __bool_true_false_are_defined 1 19 | 20 | #endif /* stdbool_h */ 21 | -------------------------------------------------------------------------------- /deps/jemalloc/include/msvc_compat/strings.h: -------------------------------------------------------------------------------- 1 | #ifndef strings_h 2 | #define strings_h 3 | 4 | /* MSVC doesn't define ffs/ffsl. This dummy strings.h header is provided 5 | * for both */ 6 | #ifdef _MSC_VER 7 | # include 8 | # pragma intrinsic(_BitScanForward) 9 | static __forceinline int ffsl(long x) 10 | { 11 | unsigned long i; 12 | 13 | if (_BitScanForward(&i, x)) 14 | return (i + 1); 15 | return (0); 16 | } 17 | 18 | static __forceinline int ffs(int x) 19 | { 20 | 21 | return (ffsl(x)); 22 | } 23 | 24 | #else 25 | # define ffsl(x) __builtin_ffsl(x) 26 | # define ffs(x) __builtin_ffs(x) 27 | #endif 28 | 29 | #endif /* strings_h */ 30 | -------------------------------------------------------------------------------- /deps/jemalloc/include/msvc_compat/windows_extra.h: -------------------------------------------------------------------------------- 1 | #ifndef MSVC_COMPAT_WINDOWS_EXTRA_H 2 | #define MSVC_COMPAT_WINDOWS_EXTRA_H 3 | 4 | #ifndef ENOENT 5 | # define ENOENT ERROR_PATH_NOT_FOUND 6 | #endif 7 | #ifndef EINVAL 8 | # define EINVAL ERROR_BAD_ARGUMENTS 9 | #endif 10 | #ifndef EAGAIN 11 | # define EAGAIN ERROR_OUTOFMEMORY 12 | #endif 13 | #ifndef EPERM 14 | # define EPERM ERROR_WRITE_FAULT 15 | #endif 16 | #ifndef EFAULT 17 | # define EFAULT ERROR_INVALID_ADDRESS 18 | #endif 19 | #ifndef ENOMEM 20 | # define ENOMEM ERROR_NOT_ENOUGH_MEMORY 21 | #endif 22 | #ifndef ERANGE 23 | # define ERANGE ERROR_INVALID_DATA 24 | #endif 25 | 26 | #endif /* MSVC_COMPAT_WINDOWS_EXTRA_H */ 27 | -------------------------------------------------------------------------------- /deps/jemalloc/jemalloc.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | install_suffix=@install_suffix@ 6 | 7 | Name: jemalloc 8 | Description: A general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. 9 | URL: http://www.canonware.com/jemalloc 10 | Version: @jemalloc_version@ 11 | Cflags: -I${includedir} 12 | Libs: -L${libdir} -ljemalloc${install_suffix} 13 | -------------------------------------------------------------------------------- /deps/jemalloc/src/atomic.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_ATOMIC_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | -------------------------------------------------------------------------------- /deps/jemalloc/src/hash.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_HASH_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | -------------------------------------------------------------------------------- /deps/jemalloc/src/mb.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_MB_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | -------------------------------------------------------------------------------- /deps/jemalloc/src/valgrind.c: -------------------------------------------------------------------------------- 1 | #include "jemalloc/internal/jemalloc_internal.h" 2 | #ifndef JEMALLOC_VALGRIND 3 | # error "This source file is for Valgrind integration." 4 | #endif 5 | 6 | #include 7 | 8 | void 9 | valgrind_make_mem_noaccess(void *ptr, size_t usize) 10 | { 11 | 12 | VALGRIND_MAKE_MEM_NOACCESS(ptr, usize); 13 | } 14 | 15 | void 16 | valgrind_make_mem_undefined(void *ptr, size_t usize) 17 | { 18 | 19 | VALGRIND_MAKE_MEM_UNDEFINED(ptr, usize); 20 | } 21 | 22 | void 23 | valgrind_make_mem_defined(void *ptr, size_t usize) 24 | { 25 | 26 | VALGRIND_MAKE_MEM_DEFINED(ptr, usize); 27 | } 28 | 29 | void 30 | valgrind_freelike_block(void *ptr, size_t usize) 31 | { 32 | 33 | VALGRIND_FREELIKE_BLOCK(ptr, usize); 34 | } 35 | -------------------------------------------------------------------------------- /deps/jemalloc/test/include/test/btalloc.h: -------------------------------------------------------------------------------- 1 | /* btalloc() provides a mechanism for allocating via permuted backtraces. */ 2 | void *btalloc(size_t size, unsigned bits); 3 | 4 | #define btalloc_n_proto(n) \ 5 | void *btalloc_##n(size_t size, unsigned bits); 6 | btalloc_n_proto(0) 7 | btalloc_n_proto(1) 8 | 9 | #define btalloc_n_gen(n) \ 10 | void * \ 11 | btalloc_##n(size_t size, unsigned bits) \ 12 | { \ 13 | void *p; \ 14 | \ 15 | if (bits == 0) \ 16 | p = mallocx(size, 0); \ 17 | else { \ 18 | switch (bits & 0x1U) { \ 19 | case 0: \ 20 | p = (btalloc_0(size, bits >> 1)); \ 21 | break; \ 22 | case 1: \ 23 | p = (btalloc_1(size, bits >> 1)); \ 24 | break; \ 25 | default: not_reached(); \ 26 | } \ 27 | } \ 28 | /* Intentionally sabotage tail call optimization. */ \ 29 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); \ 30 | return (p); \ 31 | } 32 | -------------------------------------------------------------------------------- /deps/jemalloc/test/include/test/jemalloc_test_defs.h.in: -------------------------------------------------------------------------------- 1 | #include "jemalloc/internal/jemalloc_internal_defs.h" 2 | #include "jemalloc/internal/jemalloc_internal_decls.h" 3 | 4 | /* 5 | * For use by SFMT. configure.ac doesn't actually define HAVE_SSE2 because its 6 | * dependencies are notoriously unportable in practice. 7 | */ 8 | #undef HAVE_SSE2 9 | #undef HAVE_ALTIVEC 10 | -------------------------------------------------------------------------------- /deps/jemalloc/test/include/test/mtx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mtx is a slightly simplified version of malloc_mutex. This code duplication 3 | * is unfortunate, but there are allocator bootstrapping considerations that 4 | * would leak into the test infrastructure if malloc_mutex were used directly 5 | * in tests. 6 | */ 7 | 8 | typedef struct { 9 | #ifdef _WIN32 10 | CRITICAL_SECTION lock; 11 | #elif (defined(JEMALLOC_OSSPIN)) 12 | OSSpinLock lock; 13 | #else 14 | pthread_mutex_t lock; 15 | #endif 16 | } mtx_t; 17 | 18 | bool mtx_init(mtx_t *mtx); 19 | void mtx_fini(mtx_t *mtx); 20 | void mtx_lock(mtx_t *mtx); 21 | void mtx_unlock(mtx_t *mtx); 22 | -------------------------------------------------------------------------------- /deps/jemalloc/test/include/test/thd.h: -------------------------------------------------------------------------------- 1 | /* Abstraction layer for threading in tests. */ 2 | #ifdef _WIN32 3 | typedef HANDLE thd_t; 4 | #else 5 | typedef pthread_t thd_t; 6 | #endif 7 | 8 | void thd_create(thd_t *thd, void *(*proc)(void *), void *arg); 9 | void thd_join(thd_t thd, void **ret); 10 | -------------------------------------------------------------------------------- /deps/jemalloc/test/include/test/timer.h: -------------------------------------------------------------------------------- 1 | /* Simple timer, for use in benchmark reporting. */ 2 | 3 | #include 4 | #include 5 | 6 | #define JEMALLOC_CLOCK_GETTIME defined(_POSIX_MONOTONIC_CLOCK) \ 7 | && _POSIX_MONOTONIC_CLOCK >= 0 8 | 9 | typedef struct { 10 | #ifdef _WIN32 11 | FILETIME ft0; 12 | FILETIME ft1; 13 | #elif JEMALLOC_CLOCK_GETTIME 14 | struct timespec ts0; 15 | struct timespec ts1; 16 | int clock_id; 17 | #else 18 | struct timeval tv0; 19 | struct timeval tv1; 20 | #endif 21 | } timedelta_t; 22 | 23 | void timer_start(timedelta_t *timer); 24 | void timer_stop(timedelta_t *timer); 25 | uint64_t timer_usec(const timedelta_t *timer); 26 | void timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen); 27 | -------------------------------------------------------------------------------- /deps/jemalloc/test/integration/overflow.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_overflow) 4 | { 5 | unsigned nhchunks; 6 | size_t mib[4]; 7 | size_t sz, miblen, max_size_class; 8 | void *p; 9 | 10 | sz = sizeof(unsigned); 11 | assert_d_eq(mallctl("arenas.nhchunks", &nhchunks, &sz, NULL, 0), 0, 12 | "Unexpected mallctl() error"); 13 | 14 | miblen = sizeof(mib) / sizeof(size_t); 15 | assert_d_eq(mallctlnametomib("arenas.hchunk.0.size", mib, &miblen), 0, 16 | "Unexpected mallctlnametomib() error"); 17 | mib[2] = nhchunks - 1; 18 | 19 | sz = sizeof(size_t); 20 | assert_d_eq(mallctlbymib(mib, miblen, &max_size_class, &sz, NULL, 0), 0, 21 | "Unexpected mallctlbymib() error"); 22 | 23 | assert_ptr_null(malloc(max_size_class + 1), 24 | "Expected OOM due to over-sized allocation request"); 25 | assert_ptr_null(malloc(SIZE_T_MAX), 26 | "Expected OOM due to over-sized allocation request"); 27 | 28 | assert_ptr_null(calloc(1, max_size_class + 1), 29 | "Expected OOM due to over-sized allocation request"); 30 | assert_ptr_null(calloc(1, SIZE_T_MAX), 31 | "Expected OOM due to over-sized allocation request"); 32 | 33 | p = malloc(1); 34 | assert_ptr_not_null(p, "Unexpected malloc() OOM"); 35 | assert_ptr_null(realloc(p, max_size_class + 1), 36 | "Expected OOM due to over-sized allocation request"); 37 | assert_ptr_null(realloc(p, SIZE_T_MAX), 38 | "Expected OOM due to over-sized allocation request"); 39 | free(p); 40 | } 41 | TEST_END 42 | 43 | int 44 | main(void) 45 | { 46 | 47 | return (test( 48 | test_overflow)); 49 | } 50 | -------------------------------------------------------------------------------- /deps/jemalloc/test/integration/sdallocx.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #define MAXALIGN (((size_t)1) << 25) 4 | #define NITER 4 5 | 6 | TEST_BEGIN(test_basic) 7 | { 8 | void *ptr = mallocx(64, 0); 9 | sdallocx(ptr, 64, 0); 10 | } 11 | TEST_END 12 | 13 | TEST_BEGIN(test_alignment_and_size) 14 | { 15 | size_t nsz, sz, alignment, total; 16 | unsigned i; 17 | void *ps[NITER]; 18 | 19 | for (i = 0; i < NITER; i++) 20 | ps[i] = NULL; 21 | 22 | for (alignment = 8; 23 | alignment <= MAXALIGN; 24 | alignment <<= 1) { 25 | total = 0; 26 | for (sz = 1; 27 | sz < 3 * alignment && sz < (1U << 31); 28 | sz += (alignment >> (LG_SIZEOF_PTR-1)) - 1) { 29 | for (i = 0; i < NITER; i++) { 30 | nsz = nallocx(sz, MALLOCX_ALIGN(alignment) | 31 | MALLOCX_ZERO); 32 | ps[i] = mallocx(sz, MALLOCX_ALIGN(alignment) | 33 | MALLOCX_ZERO); 34 | total += nsz; 35 | if (total >= (MAXALIGN << 1)) 36 | break; 37 | } 38 | for (i = 0; i < NITER; i++) { 39 | if (ps[i] != NULL) { 40 | sdallocx(ps[i], sz, 41 | MALLOCX_ALIGN(alignment)); 42 | ps[i] = NULL; 43 | } 44 | } 45 | } 46 | } 47 | } 48 | TEST_END 49 | 50 | int 51 | main(void) 52 | { 53 | 54 | return (test( 55 | test_basic, 56 | test_alignment_and_size)); 57 | } 58 | -------------------------------------------------------------------------------- /deps/jemalloc/test/src/btalloc.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | void * 4 | btalloc(size_t size, unsigned bits) 5 | { 6 | 7 | return (btalloc_0(size, bits)); 8 | } 9 | -------------------------------------------------------------------------------- /deps/jemalloc/test/src/btalloc_0.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | btalloc_n_gen(0) 4 | -------------------------------------------------------------------------------- /deps/jemalloc/test/src/btalloc_1.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | btalloc_n_gen(1) 4 | -------------------------------------------------------------------------------- /deps/jemalloc/test/src/math.c: -------------------------------------------------------------------------------- 1 | #define MATH_C_ 2 | #include "test/jemalloc_test.h" 3 | -------------------------------------------------------------------------------- /deps/jemalloc/test/src/mq.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | /* 4 | * Sleep for approximately ns nanoseconds. No lower *nor* upper bound on sleep 5 | * time is guaranteed. 6 | */ 7 | void 8 | mq_nanosleep(unsigned ns) 9 | { 10 | 11 | assert(ns <= 1000*1000*1000); 12 | 13 | #ifdef _WIN32 14 | Sleep(ns / 1000); 15 | #else 16 | { 17 | struct timespec timeout; 18 | 19 | if (ns < 1000*1000*1000) { 20 | timeout.tv_sec = 0; 21 | timeout.tv_nsec = ns; 22 | } else { 23 | timeout.tv_sec = 1; 24 | timeout.tv_nsec = 0; 25 | } 26 | nanosleep(&timeout, NULL); 27 | } 28 | #endif 29 | } 30 | -------------------------------------------------------------------------------- /deps/jemalloc/test/src/mtx.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifndef _CRT_SPINCOUNT 4 | #define _CRT_SPINCOUNT 4000 5 | #endif 6 | 7 | bool 8 | mtx_init(mtx_t *mtx) 9 | { 10 | 11 | #ifdef _WIN32 12 | if (!InitializeCriticalSectionAndSpinCount(&mtx->lock, _CRT_SPINCOUNT)) 13 | return (true); 14 | #elif (defined(JEMALLOC_OSSPIN)) 15 | mtx->lock = 0; 16 | #else 17 | pthread_mutexattr_t attr; 18 | 19 | if (pthread_mutexattr_init(&attr) != 0) 20 | return (true); 21 | pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_DEFAULT); 22 | if (pthread_mutex_init(&mtx->lock, &attr) != 0) { 23 | pthread_mutexattr_destroy(&attr); 24 | return (true); 25 | } 26 | pthread_mutexattr_destroy(&attr); 27 | #endif 28 | return (false); 29 | } 30 | 31 | void 32 | mtx_fini(mtx_t *mtx) 33 | { 34 | 35 | #ifdef _WIN32 36 | #elif (defined(JEMALLOC_OSSPIN)) 37 | #else 38 | pthread_mutex_destroy(&mtx->lock); 39 | #endif 40 | } 41 | 42 | void 43 | mtx_lock(mtx_t *mtx) 44 | { 45 | 46 | #ifdef _WIN32 47 | EnterCriticalSection(&mtx->lock); 48 | #elif (defined(JEMALLOC_OSSPIN)) 49 | OSSpinLockLock(&mtx->lock); 50 | #else 51 | pthread_mutex_lock(&mtx->lock); 52 | #endif 53 | } 54 | 55 | void 56 | mtx_unlock(mtx_t *mtx) 57 | { 58 | 59 | #ifdef _WIN32 60 | LeaveCriticalSection(&mtx->lock); 61 | #elif (defined(JEMALLOC_OSSPIN)) 62 | OSSpinLockUnlock(&mtx->lock); 63 | #else 64 | pthread_mutex_unlock(&mtx->lock); 65 | #endif 66 | } 67 | -------------------------------------------------------------------------------- /deps/jemalloc/test/src/thd.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifdef _WIN32 4 | void 5 | thd_create(thd_t *thd, void *(*proc)(void *), void *arg) 6 | { 7 | LPTHREAD_START_ROUTINE routine = (LPTHREAD_START_ROUTINE)proc; 8 | *thd = CreateThread(NULL, 0, routine, arg, 0, NULL); 9 | if (*thd == NULL) 10 | test_fail("Error in CreateThread()\n"); 11 | } 12 | 13 | void 14 | thd_join(thd_t thd, void **ret) 15 | { 16 | 17 | if (WaitForSingleObject(thd, INFINITE) == WAIT_OBJECT_0 && ret) { 18 | DWORD exit_code; 19 | GetExitCodeThread(thd, (LPDWORD) &exit_code); 20 | *ret = (void *)(uintptr_t)exit_code; 21 | } 22 | } 23 | 24 | #else 25 | void 26 | thd_create(thd_t *thd, void *(*proc)(void *), void *arg) 27 | { 28 | 29 | if (pthread_create(thd, NULL, proc, arg) != 0) 30 | test_fail("Error in pthread_create()\n"); 31 | } 32 | 33 | void 34 | thd_join(thd_t thd, void **ret) 35 | { 36 | 37 | pthread_join(thd, ret); 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /deps/jemalloc/test/test.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case @abi@ in 4 | macho) 5 | export DYLD_FALLBACK_LIBRARY_PATH="@objroot@lib" 6 | ;; 7 | pecoff) 8 | export PATH="${PATH}:@objroot@lib" 9 | ;; 10 | *) 11 | ;; 12 | esac 13 | 14 | # Corresponds to test_status_t. 15 | pass_code=0 16 | skip_code=1 17 | fail_code=2 18 | 19 | pass_count=0 20 | skip_count=0 21 | fail_count=0 22 | for t in $@; do 23 | if [ $pass_count -ne 0 -o $skip_count -ne 0 -o $fail_count != 0 ] ; then 24 | echo 25 | fi 26 | echo "=== ${t} ===" 27 | ${t}@exe@ @abs_srcroot@ @abs_objroot@ 28 | result_code=$? 29 | case ${result_code} in 30 | ${pass_code}) 31 | pass_count=$((pass_count+1)) 32 | ;; 33 | ${skip_code}) 34 | skip_count=$((skip_count+1)) 35 | ;; 36 | ${fail_code}) 37 | fail_count=$((fail_count+1)) 38 | ;; 39 | *) 40 | echo "Test harness error" 1>&2 41 | exit 1 42 | esac 43 | done 44 | 45 | total_count=`expr ${pass_count} + ${skip_count} + ${fail_count}` 46 | echo 47 | echo "Test suite summary: pass: ${pass_count}/${total_count}, skip: ${skip_count}/${total_count}, fail: ${fail_count}/${total_count}" 48 | 49 | if [ ${fail_count} -eq 0 ] ; then 50 | exit 0 51 | else 52 | exit 1 53 | fi 54 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/junk_alloc.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_TEST_JUNK_OPT "junk:alloc" 2 | #include "junk.c" 3 | #undef JEMALLOC_TEST_JUNK_OPT 4 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/junk_free.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_TEST_JUNK_OPT "junk:free" 2 | #include "junk.c" 3 | #undef JEMALLOC_TEST_JUNK_OPT 4 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/lg_chunk.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | /* 4 | * Make sure that opt.lg_chunk clamping is sufficient. In practice, this test 5 | * program will fail a debug assertion during initialization and abort (rather 6 | * than the test soft-failing) if clamping is insufficient. 7 | */ 8 | const char *malloc_conf = "lg_chunk:0"; 9 | 10 | TEST_BEGIN(test_lg_chunk_clamp) 11 | { 12 | void *p; 13 | 14 | p = mallocx(1, 0); 15 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); 16 | dallocx(p, 0); 17 | } 18 | TEST_END 19 | 20 | int 21 | main(void) 22 | { 23 | 24 | return (test( 25 | test_lg_chunk_clamp)); 26 | } 27 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/mtx.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #define NTHREADS 2 4 | #define NINCRS 2000000 5 | 6 | TEST_BEGIN(test_mtx_basic) 7 | { 8 | mtx_t mtx; 9 | 10 | assert_false(mtx_init(&mtx), "Unexpected mtx_init() failure"); 11 | mtx_lock(&mtx); 12 | mtx_unlock(&mtx); 13 | mtx_fini(&mtx); 14 | } 15 | TEST_END 16 | 17 | typedef struct { 18 | mtx_t mtx; 19 | unsigned x; 20 | } thd_start_arg_t; 21 | 22 | static void * 23 | thd_start(void *varg) 24 | { 25 | thd_start_arg_t *arg = (thd_start_arg_t *)varg; 26 | unsigned i; 27 | 28 | for (i = 0; i < NINCRS; i++) { 29 | mtx_lock(&arg->mtx); 30 | arg->x++; 31 | mtx_unlock(&arg->mtx); 32 | } 33 | return (NULL); 34 | } 35 | 36 | TEST_BEGIN(test_mtx_race) 37 | { 38 | thd_start_arg_t arg; 39 | thd_t thds[NTHREADS]; 40 | unsigned i; 41 | 42 | assert_false(mtx_init(&arg.mtx), "Unexpected mtx_init() failure"); 43 | arg.x = 0; 44 | for (i = 0; i < NTHREADS; i++) 45 | thd_create(&thds[i], thd_start, (void *)&arg); 46 | for (i = 0; i < NTHREADS; i++) 47 | thd_join(thds[i], NULL); 48 | assert_u_eq(arg.x, NTHREADS * NINCRS, 49 | "Race-related counter corruption"); 50 | } 51 | TEST_END 52 | 53 | int 54 | main(void) 55 | { 56 | 57 | return (test( 58 | test_mtx_basic, 59 | test_mtx_race)); 60 | } 61 | -------------------------------------------------------------------------------- /deps/jemalloc/test/unit/prof_idump.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifdef JEMALLOC_PROF 4 | const char *malloc_conf = 5 | "prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0," 6 | "lg_prof_interval:0"; 7 | #endif 8 | 9 | static bool did_prof_dump_open; 10 | 11 | static int 12 | prof_dump_open_intercept(bool propagate_err, const char *filename) 13 | { 14 | int fd; 15 | 16 | did_prof_dump_open = true; 17 | 18 | fd = open("/dev/null", O_WRONLY); 19 | assert_d_ne(fd, -1, "Unexpected open() failure"); 20 | 21 | return (fd); 22 | } 23 | 24 | TEST_BEGIN(test_idump) 25 | { 26 | bool active; 27 | void *p; 28 | 29 | test_skip_if(!config_prof); 30 | 31 | active = true; 32 | assert_d_eq(mallctl("prof.active", NULL, NULL, &active, sizeof(active)), 33 | 0, "Unexpected mallctl failure while activating profiling"); 34 | 35 | prof_dump_open = prof_dump_open_intercept; 36 | 37 | did_prof_dump_open = false; 38 | p = mallocx(1, 0); 39 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); 40 | dallocx(p, 0); 41 | assert_true(did_prof_dump_open, "Expected a profile dump"); 42 | } 43 | TEST_END 44 | 45 | int 46 | main(void) 47 | { 48 | 49 | return (test( 50 | test_idump)); 51 | } 52 | -------------------------------------------------------------------------------- /deps/jemallocat/Makefile: -------------------------------------------------------------------------------- 1 | MEMKIND_DIR=../memkind 2 | 3 | MEMKIND_GCC_FLAGS=-I$(MEMKIND_DIR)/include -L$(MEMKIND_DIR)/.libs -lmemkind 4 | 5 | all: lib/libjemallocat.a lib/libjemallocat.so tests/gen_test_case tests/do_test_case 6 | 7 | lib/libjemallocat.a: src/common.h src/jemallocat.h src/jemallocat.c 8 | mkdir -p lib 9 | gcc -std=gnu99 -c src/*.c -O3 10 | ar cr lib/libjemallocat.a *.o 11 | rm -f *.o 12 | 13 | lib/libjemallocat.so: src/common.h src/jemallocat.h src/jemallocat.c 14 | mkdir -p lib 15 | gcc -std=gnu99 src/*.c -o lib/libjemallocat.so -fPIC -shared -O3 16 | 17 | tests/gen_test_case: src/common.h tests/gen_test_case.c 18 | gcc -std=gnu99 tests/gen_test_case.c -o tests/gen_test_case -O3 -Isrc $(MEMKIND_GCC_FLAGS) 19 | 20 | tests/do_test_case: src/common.h include/jemallocat.h tests/do_test_case.c 21 | gcc -std=gnu99 tests/do_test_case.c -o tests/do_test_case -O3 -Isrc -Llib -ljemallocat $(MEMKIND_GCC_FLAGS) 22 | 23 | clean: 24 | rm -f lib/libjemallocat.a 25 | rm -f lib/libjemallocat.so 26 | rm -f tests/gen_test_case 27 | rm -f tests/do_test_case 28 | rm -f tests/gen_test_case.pmem 29 | rm -f tests/do_test_case.pmem 30 | -------------------------------------------------------------------------------- /deps/jemallocat/include/jemallocat.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOCAT_H 2 | #define JEMALLOCAT_H 3 | 4 | #include 5 | 6 | /* jemalloc对象 */ 7 | struct jemallocat 8 | { 9 | char dim[88]; // 对外为黑盒 10 | }; 11 | 12 | /* 13 | jemallocat初始化函数 14 | jemallocat: jemallocat对象 15 | total_size: 分配器管理的空间的大小 16 | page_size: 页的大小 17 | max_small_size: 最大的small size(参加jemalloc的尺度划分) 18 | udata: 私有数据 19 | base_addr: 分配器中,获取基地址的函数 20 | malloc: 分配器中,分配内存的函数(务必确保je_mallocx()带有MALLOCX_TCACHE_NONE标记) 21 | free: 分配器中,释放内存的函数 22 | standardize_size: 分配器中,标准化传给malloc()的size的函数 23 | is_page_allocatable: 分配器中,判断页是否可分配的函数 24 | 成功返回1,失败返回0 25 | */ 26 | int jemallocat_init(struct jemallocat* jemallocat, 27 | size_t total_size, 28 | size_t page_size, 29 | size_t max_small_size, 30 | void* udata, 31 | void* (*base_addr)(void* udata), 32 | void* (*malloc)(void* udata, size_t size), 33 | void (*free)(void* udata, void* ptr), 34 | size_t (*standardize_size)(void* udata, size_t size), 35 | int (*is_page_allocatable)(void* udata, size_t index)); 36 | 37 | /* 38 | 向jemallocat添加一个已被占用的区域 39 | jemallocat: jemallocat对象 40 | offset: 偏移量 41 | size: 区域大小 42 | 成功返回1,失败返回0 43 | */ 44 | int jemallocat_add(struct jemallocat* jemallocat, size_t offset, size_t size); 45 | 46 | /* 47 | 告知jemallocat,已经添加完所有区域,开始执行malloc_at()操作 48 | jemallocat: jemallocat对象 49 | 成功返回1,失败返回0 50 | */ 51 | int jemallocat_finish(struct jemallocat* jemallocat); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /deps/jemallocat/src/common.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_H 2 | #define COMMON_H 3 | 4 | #include 5 | 6 | #ifdef NO_ASSERT 7 | #define assert(x) ((void*)0) 8 | #endif 9 | 10 | #define ERROR(ret, show_errstr, msgs...) \ 11 | do \ 12 | { \ 13 | fprintf(stderr, "[<%s> @ %s: %d]: ", __FUNCTION__, __FILE__, __LINE__); \ 14 | fprintf(stderr, ##msgs); \ 15 | if(show_errstr) \ 16 | perror(0); \ 17 | else \ 18 | printf("\n"); \ 19 | return (ret); \ 20 | } \ 21 | while(0) 22 | 23 | #ifndef assert 24 | #include 25 | #endif 26 | 27 | #endif -------------------------------------------------------------------------------- /deps/jemallocat/tests/env.sh: -------------------------------------------------------------------------------- 1 | MEMKIND_DIR=../../memkind 2 | 3 | export LD_LIBRARY_PATH=$(cd ..; pwd)/lib:$(cd $MEMKIND_DIR; pwd)/.libs -------------------------------------------------------------------------------- /deps/jemallocat/tests/infinite_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source env.sh 3 | 4 | count=0 5 | while true 6 | do 7 | ./gen_test_case 1024 8192 1000000 20 > /tmp/jemallocat.testcase 8 | if [ $? -eq 0 ]; then 9 | ./do_test_case 1024 < /tmp/jemallocat.testcase 10 | if [ $? -ne 0 ]; then 11 | echo "test case not passed!" 12 | exit 1 13 | fi 14 | count=$((${count} + 1)) 15 | echo "${count} tests done" 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /deps/linenoise/.gitignore: -------------------------------------------------------------------------------- 1 | linenoise_example 2 | *.dSYM 3 | history.txt 4 | -------------------------------------------------------------------------------- /deps/linenoise/Makefile: -------------------------------------------------------------------------------- 1 | STD= 2 | WARN= -Wall 3 | OPT= -Os 4 | 5 | R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) 6 | R_LDFLAGS= $(LDFLAGS) 7 | DEBUG= -g 8 | 9 | R_CC=$(CC) $(R_CFLAGS) 10 | R_LD=$(CC) $(R_LDFLAGS) 11 | 12 | linenoise.o: linenoise.h linenoise.c 13 | 14 | linenoise_example: linenoise.o example.o 15 | $(R_LD) -o $@ $^ 16 | 17 | .c.o: 18 | $(R_CC) -c $< 19 | 20 | clean: 21 | rm -f linenoise_example *.o 22 | -------------------------------------------------------------------------------- /deps/lua/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Lua License 2 | ----------- 3 | 4 | Lua is licensed under the terms of the MIT license reproduced below. 5 | This means that Lua is free software and can be used for both academic 6 | and commercial purposes at absolutely no cost. 7 | 8 | For details and rationale, see http://www.lua.org/license.html . 9 | 10 | =============================================================================== 11 | 12 | Copyright (C) 1994-2012 Lua.org, PUC-Rio. 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a copy 15 | of this software and associated documentation files (the "Software"), to deal 16 | in the Software without restriction, including without limitation the rights 17 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | copies of the Software, and to permit persons to whom the Software is 19 | furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in 22 | all copies or substantial portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | THE SOFTWARE. 31 | 32 | =============================================================================== 33 | 34 | (end of COPYRIGHT) 35 | -------------------------------------------------------------------------------- /deps/lua/README: -------------------------------------------------------------------------------- 1 | README for Lua 5.1 2 | 3 | See INSTALL for installation instructions. 4 | See HISTORY for a summary of changes since the last released version. 5 | 6 | * What is Lua? 7 | ------------ 8 | Lua is a powerful, light-weight programming language designed for extending 9 | applications. Lua is also frequently used as a general-purpose, stand-alone 10 | language. Lua is free software. 11 | 12 | For complete information, visit Lua's web site at http://www.lua.org/ . 13 | For an executive summary, see http://www.lua.org/about.html . 14 | 15 | Lua has been used in many different projects around the world. 16 | For a short list, see http://www.lua.org/uses.html . 17 | 18 | * Availability 19 | ------------ 20 | Lua is freely available for both academic and commercial purposes. 21 | See COPYRIGHT and http://www.lua.org/license.html for details. 22 | Lua can be downloaded at http://www.lua.org/download.html . 23 | 24 | * Installation 25 | ------------ 26 | Lua is implemented in pure ANSI C, and compiles unmodified in all known 27 | platforms that have an ANSI C compiler. In most Unix-like platforms, simply 28 | do "make" with a suitable target. See INSTALL for detailed instructions. 29 | 30 | * Origin 31 | ------ 32 | Lua is developed at Lua.org, a laboratory of the Department of Computer 33 | Science of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro 34 | in Brazil). 35 | For more information about the authors, see http://www.lua.org/authors.html . 36 | 37 | (end of README) 38 | -------------------------------------------------------------------------------- /deps/lua/doc/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmem/pmem-redis/4b9cf06de20e4010d71b1803bb2348b6543a63da/deps/lua/doc/cover.png -------------------------------------------------------------------------------- /deps/lua/doc/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmem/pmem-redis/4b9cf06de20e4010d71b1803bb2348b6543a63da/deps/lua/doc/logo.gif -------------------------------------------------------------------------------- /deps/lua/doc/lua.css: -------------------------------------------------------------------------------- 1 | body { 2 | color: #000000 ; 3 | background-color: #FFFFFF ; 4 | font-family: Helvetica, Arial, sans-serif ; 5 | text-align: justify ; 6 | margin-right: 30px ; 7 | margin-left: 30px ; 8 | } 9 | 10 | h1, h2, h3, h4 { 11 | font-family: Verdana, Geneva, sans-serif ; 12 | font-weight: normal ; 13 | font-style: italic ; 14 | } 15 | 16 | h2 { 17 | padding-top: 0.4em ; 18 | padding-bottom: 0.4em ; 19 | padding-left: 30px ; 20 | padding-right: 30px ; 21 | margin-left: -30px ; 22 | background-color: #E0E0FF ; 23 | } 24 | 25 | h3 { 26 | padding-left: 0.5em ; 27 | border-left: solid #E0E0FF 1em ; 28 | } 29 | 30 | table h3 { 31 | padding-left: 0px ; 32 | border-left: none ; 33 | } 34 | 35 | a:link { 36 | color: #000080 ; 37 | background-color: inherit ; 38 | text-decoration: none ; 39 | } 40 | 41 | a:visited { 42 | background-color: inherit ; 43 | text-decoration: none ; 44 | } 45 | 46 | a:link:hover, a:visited:hover { 47 | color: #000080 ; 48 | background-color: #E0E0FF ; 49 | } 50 | 51 | a:link:active, a:visited:active { 52 | color: #FF0000 ; 53 | } 54 | 55 | hr { 56 | border: 0 ; 57 | height: 1px ; 58 | color: #a0a0a0 ; 59 | background-color: #a0a0a0 ; 60 | } 61 | 62 | :target { 63 | background-color: #F8F8F8 ; 64 | padding: 8px ; 65 | border: solid #a0a0a0 2px ; 66 | } 67 | 68 | .footer { 69 | color: gray ; 70 | font-size: small ; 71 | } 72 | 73 | input[type=text] { 74 | border: solid #a0a0a0 2px ; 75 | border-radius: 2em ; 76 | -moz-border-radius: 2em ; 77 | background-image: url('images/search.png') ; 78 | background-repeat: no-repeat; 79 | background-position: 4px center ; 80 | padding-left: 20px ; 81 | height: 2em ; 82 | } 83 | 84 | -------------------------------------------------------------------------------- /deps/lua/doc/manual.css: -------------------------------------------------------------------------------- 1 | h3 code { 2 | font-family: inherit ; 3 | font-size: inherit ; 4 | } 5 | 6 | pre, code { 7 | font-size: 12pt ; 8 | } 9 | 10 | span.apii { 11 | float: right ; 12 | font-family: inherit ; 13 | font-style: normal ; 14 | font-size: small ; 15 | color: gray ; 16 | } 17 | 18 | p+h1, ul+h1 { 19 | padding-top: 0.4em ; 20 | padding-bottom: 0.4em ; 21 | padding-left: 30px ; 22 | margin-left: -30px ; 23 | background-color: #E0E0FF ; 24 | } 25 | -------------------------------------------------------------------------------- /deps/lua/doc/readme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Lua documentation 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 | Lua 12 | Documentation 13 |

14 | 15 | This is the documentation included in the source distribution of Lua 5.1.5. 16 | 17 | 25 | 26 | Lua's 27 | official web site 28 | contains updated documentation, 29 | especially the 30 | reference manual. 31 |

32 | 33 |


34 | 35 | Last update: 36 | Fri Feb 3 09:44:42 BRST 2012 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /deps/lua/etc/Makefile: -------------------------------------------------------------------------------- 1 | # makefile for Lua etc 2 | 3 | TOP= .. 4 | LIB= $(TOP)/src 5 | INC= $(TOP)/src 6 | BIN= $(TOP)/src 7 | SRC= $(TOP)/src 8 | TST= $(TOP)/test 9 | 10 | CC= gcc 11 | CFLAGS= -O2 -Wall -I$(INC) $(MYCFLAGS) 12 | MYCFLAGS= 13 | MYLDFLAGS= -Wl,-E 14 | MYLIBS= -lm 15 | #MYLIBS= -lm -Wl,-E -ldl -lreadline -lhistory -lncurses 16 | RM= rm -f 17 | 18 | default: 19 | @echo 'Please choose a target: min noparser one strict clean' 20 | 21 | min: min.c 22 | $(CC) $(CFLAGS) $@.c -L$(LIB) -llua $(MYLIBS) 23 | echo 'print"Hello there!"' | ./a.out 24 | 25 | noparser: noparser.o 26 | $(CC) noparser.o $(SRC)/lua.o -L$(LIB) -llua $(MYLIBS) 27 | $(BIN)/luac $(TST)/hello.lua 28 | -./a.out luac.out 29 | -./a.out -e'a=1' 30 | 31 | one: 32 | $(CC) $(CFLAGS) all.c $(MYLIBS) 33 | ./a.out $(TST)/hello.lua 34 | 35 | strict: 36 | -$(BIN)/lua -e 'print(a);b=2' 37 | -$(BIN)/lua -lstrict -e 'print(a)' 38 | -$(BIN)/lua -e 'function f() b=2 end f()' 39 | -$(BIN)/lua -lstrict -e 'function f() b=2 end f()' 40 | 41 | clean: 42 | $(RM) a.out core core.* *.o luac.out 43 | 44 | .PHONY: default min noparser one strict clean 45 | -------------------------------------------------------------------------------- /deps/lua/etc/README: -------------------------------------------------------------------------------- 1 | This directory contains some useful files and code. 2 | Unlike the code in ../src, everything here is in the public domain. 3 | 4 | If any of the makes fail, you're probably not using the same libraries 5 | used to build Lua. Set MYLIBS in Makefile accordingly. 6 | 7 | all.c 8 | Full Lua interpreter in a single file. 9 | Do "make one" for a demo. 10 | 11 | lua.hpp 12 | Lua header files for C++ using 'extern "C"'. 13 | 14 | lua.ico 15 | A Lua icon for Windows (and web sites: save as favicon.ico). 16 | Drawn by hand by Markus Gritsch . 17 | 18 | lua.pc 19 | pkg-config data for Lua 20 | 21 | luavs.bat 22 | Script to build Lua under "Visual Studio .NET Command Prompt". 23 | Run it from the toplevel as etc\luavs.bat. 24 | 25 | min.c 26 | A minimal Lua interpreter. 27 | Good for learning and for starting your own. 28 | Do "make min" for a demo. 29 | 30 | noparser.c 31 | Linking with noparser.o avoids loading the parsing modules in lualib.a. 32 | Do "make noparser" for a demo. 33 | 34 | strict.lua 35 | Traps uses of undeclared global variables. 36 | Do "make strict" for a demo. 37 | 38 | -------------------------------------------------------------------------------- /deps/lua/etc/all.c: -------------------------------------------------------------------------------- 1 | /* 2 | * all.c -- Lua core, libraries and interpreter in a single file 3 | */ 4 | 5 | #define luaall_c 6 | 7 | #include "lapi.c" 8 | #include "lcode.c" 9 | #include "ldebug.c" 10 | #include "ldo.c" 11 | #include "ldump.c" 12 | #include "lfunc.c" 13 | #include "lgc.c" 14 | #include "llex.c" 15 | #include "lmem.c" 16 | #include "lobject.c" 17 | #include "lopcodes.c" 18 | #include "lparser.c" 19 | #include "lstate.c" 20 | #include "lstring.c" 21 | #include "ltable.c" 22 | #include "ltm.c" 23 | #include "lundump.c" 24 | #include "lvm.c" 25 | #include "lzio.c" 26 | 27 | #include "lauxlib.c" 28 | #include "lbaselib.c" 29 | #include "ldblib.c" 30 | #include "liolib.c" 31 | #include "linit.c" 32 | #include "lmathlib.c" 33 | #include "loadlib.c" 34 | #include "loslib.c" 35 | #include "lstrlib.c" 36 | #include "ltablib.c" 37 | 38 | #include "lua.c" 39 | -------------------------------------------------------------------------------- /deps/lua/etc/lua.hpp: -------------------------------------------------------------------------------- 1 | // lua.hpp 2 | // Lua header files for C++ 3 | // <> not supplied automatically because Lua also compiles as C++ 4 | 5 | extern "C" { 6 | #include "lua.h" 7 | #include "lualib.h" 8 | #include "lauxlib.h" 9 | } 10 | -------------------------------------------------------------------------------- /deps/lua/etc/lua.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmem/pmem-redis/4b9cf06de20e4010d71b1803bb2348b6543a63da/deps/lua/etc/lua.ico -------------------------------------------------------------------------------- /deps/lua/etc/lua.pc: -------------------------------------------------------------------------------- 1 | # lua.pc -- pkg-config data for Lua 2 | 3 | # vars from install Makefile 4 | 5 | # grep '^V=' ../Makefile 6 | V= 5.1 7 | # grep '^R=' ../Makefile 8 | R= 5.1.5 9 | 10 | # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/' 11 | prefix= /usr/local 12 | INSTALL_BIN= ${prefix}/bin 13 | INSTALL_INC= ${prefix}/include 14 | INSTALL_LIB= ${prefix}/lib 15 | INSTALL_MAN= ${prefix}/man/man1 16 | INSTALL_LMOD= ${prefix}/share/lua/${V} 17 | INSTALL_CMOD= ${prefix}/lib/lua/${V} 18 | 19 | # canonical vars 20 | exec_prefix=${prefix} 21 | libdir=${exec_prefix}/lib 22 | includedir=${prefix}/include 23 | 24 | Name: Lua 25 | Description: An Extensible Extension Language 26 | Version: ${R} 27 | Requires: 28 | Libs: -L${libdir} -llua -lm 29 | Cflags: -I${includedir} 30 | 31 | # (end of lua.pc) 32 | -------------------------------------------------------------------------------- /deps/lua/etc/luavs.bat: -------------------------------------------------------------------------------- 1 | @rem Script to build Lua under "Visual Studio .NET Command Prompt". 2 | @rem Do not run from this directory; run it from the toplevel: etc\luavs.bat . 3 | @rem It creates lua51.dll, lua51.lib, lua.exe, and luac.exe in src. 4 | @rem (contributed by David Manura and Mike Pall) 5 | 6 | @setlocal 7 | @set MYCOMPILE=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE 8 | @set MYLINK=link /nologo 9 | @set MYMT=mt /nologo 10 | 11 | cd src 12 | %MYCOMPILE% /DLUA_BUILD_AS_DLL l*.c 13 | del lua.obj luac.obj 14 | %MYLINK% /DLL /out:lua51.dll l*.obj 15 | if exist lua51.dll.manifest^ 16 | %MYMT% -manifest lua51.dll.manifest -outputresource:lua51.dll;2 17 | %MYCOMPILE% /DLUA_BUILD_AS_DLL lua.c 18 | %MYLINK% /out:lua.exe lua.obj lua51.lib 19 | if exist lua.exe.manifest^ 20 | %MYMT% -manifest lua.exe.manifest -outputresource:lua.exe 21 | %MYCOMPILE% l*.c print.c 22 | del lua.obj linit.obj lbaselib.obj ldblib.obj liolib.obj lmathlib.obj^ 23 | loslib.obj ltablib.obj lstrlib.obj loadlib.obj 24 | %MYLINK% /out:luac.exe *.obj 25 | if exist luac.exe.manifest^ 26 | %MYMT% -manifest luac.exe.manifest -outputresource:luac.exe 27 | del *.obj *.manifest 28 | cd .. 29 | -------------------------------------------------------------------------------- /deps/lua/etc/min.c: -------------------------------------------------------------------------------- 1 | /* 2 | * min.c -- a minimal Lua interpreter 3 | * loads stdin only with minimal error handling. 4 | * no interaction, and no standard library, only a "print" function. 5 | */ 6 | 7 | #include 8 | 9 | #include "lua.h" 10 | #include "lauxlib.h" 11 | 12 | static int print(lua_State *L) 13 | { 14 | int n=lua_gettop(L); 15 | int i; 16 | for (i=1; i<=n; i++) 17 | { 18 | if (i>1) printf("\t"); 19 | if (lua_isstring(L,i)) 20 | printf("%s",lua_tostring(L,i)); 21 | else if (lua_isnil(L,i)) 22 | printf("%s","nil"); 23 | else if (lua_isboolean(L,i)) 24 | printf("%s",lua_toboolean(L,i) ? "true" : "false"); 25 | else 26 | printf("%s:%p",luaL_typename(L,i),lua_topointer(L,i)); 27 | } 28 | printf("\n"); 29 | return 0; 30 | } 31 | 32 | int main(void) 33 | { 34 | lua_State *L=lua_open(); 35 | lua_register(L,"print",print); 36 | if (luaL_dofile(L,NULL)!=0) fprintf(stderr,"%s\n",lua_tostring(L,-1)); 37 | lua_close(L); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /deps/lua/etc/noparser.c: -------------------------------------------------------------------------------- 1 | /* 2 | * The code below can be used to make a Lua core that does not contain the 3 | * parsing modules (lcode, llex, lparser), which represent 35% of the total core. 4 | * You'll only be able to load binary files and strings, precompiled with luac. 5 | * (Of course, you'll have to build luac with the original parsing modules!) 6 | * 7 | * To use this module, simply compile it ("make noparser" does that) and list 8 | * its object file before the Lua libraries. The linker should then not load 9 | * the parsing modules. To try it, do "make luab". 10 | * 11 | * If you also want to avoid the dump module (ldump.o), define NODUMP. 12 | * #define NODUMP 13 | */ 14 | 15 | #define LUA_CORE 16 | 17 | #include "llex.h" 18 | #include "lparser.h" 19 | #include "lzio.h" 20 | 21 | LUAI_FUNC void luaX_init (lua_State *L) { 22 | UNUSED(L); 23 | } 24 | 25 | LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { 26 | UNUSED(z); 27 | UNUSED(buff); 28 | UNUSED(name); 29 | lua_pushliteral(L,"parser not loaded"); 30 | lua_error(L); 31 | return NULL; 32 | } 33 | 34 | #ifdef NODUMP 35 | #include "lundump.h" 36 | 37 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) { 38 | UNUSED(f); 39 | UNUSED(w); 40 | UNUSED(data); 41 | UNUSED(strip); 42 | #if 1 43 | UNUSED(L); 44 | return 0; 45 | #else 46 | lua_pushliteral(L,"dumper not loaded"); 47 | lua_error(L); 48 | #endif 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /deps/lua/etc/strict.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- strict.lua 3 | -- checks uses of undeclared global variables 4 | -- All global variables must be 'declared' through a regular assignment 5 | -- (even assigning nil will do) in a main chunk before being used 6 | -- anywhere or assigned to inside a function. 7 | -- 8 | 9 | local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget 10 | 11 | local mt = getmetatable(_G) 12 | if mt == nil then 13 | mt = {} 14 | setmetatable(_G, mt) 15 | end 16 | 17 | mt.__declared = {} 18 | 19 | local function what () 20 | local d = getinfo(3, "S") 21 | return d and d.what or "C" 22 | end 23 | 24 | mt.__newindex = function (t, n, v) 25 | if not mt.__declared[n] then 26 | local w = what() 27 | if w ~= "main" and w ~= "C" then 28 | error("assign to undeclared variable '"..n.."'", 2) 29 | end 30 | mt.__declared[n] = true 31 | end 32 | rawset(t, n, v) 33 | end 34 | 35 | mt.__index = function (t, n) 36 | if not mt.__declared[n] and what() ~= "C" then 37 | error("variable '"..n.."' is not declared", 2) 38 | end 39 | return rawget(t, n) 40 | end 41 | 42 | -------------------------------------------------------------------------------- /deps/lua/src/fpconv.h: -------------------------------------------------------------------------------- 1 | /* Lua CJSON floating point conversion routines */ 2 | 3 | /* Buffer required to store the largest string representation of a double. 4 | * 5 | * Longest double printed with %.14g is 21 characters long: 6 | * -1.7976931348623e+308 */ 7 | # define FPCONV_G_FMT_BUFSIZE 32 8 | 9 | #ifdef USE_INTERNAL_FPCONV 10 | static inline void fpconv_init() 11 | { 12 | /* Do nothing - not required */ 13 | } 14 | #else 15 | extern void fpconv_init(); 16 | #endif 17 | 18 | extern int fpconv_g_fmt(char*, double, int); 19 | extern double fpconv_strtod(const char*, char**); 20 | 21 | /* vi:ai et sw=4 ts=4: 22 | */ 23 | -------------------------------------------------------------------------------- /deps/lua/src/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /deps/lua/src/ldebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions from Debug Interface module 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldebug_h 8 | #define ldebug_h 9 | 10 | 11 | #include "lstate.h" 12 | 13 | 14 | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) 15 | 16 | #define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) 17 | 18 | #define resethookcount(L) (L->hookcount = L->basehookcount) 19 | 20 | 21 | LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, 22 | const char *opname); 23 | LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); 24 | LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, 25 | const TValue *p2); 26 | LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, 27 | const TValue *p2); 28 | LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); 29 | LUAI_FUNC void luaG_errormsg (lua_State *L); 30 | LUAI_FUNC int luaG_checkcode (const Proto *pt); 31 | LUAI_FUNC int luaG_checkopenop (Instruction i); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /deps/lua/src/lfunc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions to manipulate prototypes and closures 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lfunc_h 8 | #define lfunc_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ 15 | cast(int, sizeof(TValue)*((n)-1))) 16 | 17 | #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ 18 | cast(int, sizeof(TValue *)*((n)-1))) 19 | 20 | 21 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); 22 | LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); 23 | LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); 24 | LUAI_FUNC UpVal *luaF_newupval (lua_State *L); 25 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 26 | LUAI_FUNC void luaF_close (lua_State *L, StkId level); 27 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 28 | LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); 29 | LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); 30 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, 31 | int pc); 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /deps/lua/src/linit.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Initialization of libraries for lua.c 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #define linit_c 9 | #define LUA_LIB 10 | 11 | #include "lua.h" 12 | 13 | #include "lualib.h" 14 | #include "lauxlib.h" 15 | 16 | 17 | static const luaL_Reg lualibs[] = { 18 | {"", luaopen_base}, 19 | {LUA_LOADLIBNAME, luaopen_package}, 20 | {LUA_TABLIBNAME, luaopen_table}, 21 | {LUA_IOLIBNAME, luaopen_io}, 22 | {LUA_OSLIBNAME, luaopen_os}, 23 | {LUA_STRLIBNAME, luaopen_string}, 24 | {LUA_MATHLIBNAME, luaopen_math}, 25 | {LUA_DBLIBNAME, luaopen_debug}, 26 | {NULL, NULL} 27 | }; 28 | 29 | 30 | LUALIB_API void luaL_openlibs (lua_State *L) { 31 | const luaL_Reg *lib = lualibs; 32 | for (; lib->func; lib++) { 33 | lua_pushcfunction(L, lib->func); 34 | lua_pushstring(L, lib->name); 35 | lua_call(L, 1, 0); 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /deps/lua/src/lstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** String table (keep all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstring_h 8 | #define lstring_h 9 | 10 | 11 | #include "lgc.h" 12 | #include "lobject.h" 13 | #include "lstate.h" 14 | 15 | 16 | #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) 17 | 18 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) 19 | 20 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) 21 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 22 | (sizeof(s)/sizeof(char))-1)) 23 | 24 | #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) 25 | 26 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 27 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); 28 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /deps/lua/src/ltable.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua tables (hash) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltable_h 8 | #define ltable_h 9 | 10 | #include "lobject.h" 11 | 12 | 13 | #define gnode(t,i) (&(t)->node[i]) 14 | #define gkey(n) (&(n)->i_key.nk) 15 | #define gval(n) (&(n)->i_val) 16 | #define gnext(n) ((n)->i_key.nk.next) 17 | 18 | #define key2tval(n) (&(n)->i_key.tvk) 19 | 20 | 21 | LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); 22 | LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); 23 | LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); 24 | LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); 25 | LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); 26 | LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); 27 | LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); 28 | LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); 29 | LUAI_FUNC void luaH_free (lua_State *L, Table *t); 30 | LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); 31 | LUAI_FUNC int luaH_getn (Table *t); 32 | 33 | 34 | #if defined(LUA_DEBUG) 35 | LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); 36 | LUAI_FUNC int luaH_isdummy (Node *n); 37 | #endif 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /deps/lua/src/ltm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Tag methods 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltm_h 8 | #define ltm_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | /* 15 | * WARNING: if you change the order of this enumeration, 16 | * grep "ORDER TM" 17 | */ 18 | typedef enum { 19 | TM_INDEX, 20 | TM_NEWINDEX, 21 | TM_GC, 22 | TM_MODE, 23 | TM_EQ, /* last tag method with `fast' access */ 24 | TM_ADD, 25 | TM_SUB, 26 | TM_MUL, 27 | TM_DIV, 28 | TM_MOD, 29 | TM_POW, 30 | TM_UNM, 31 | TM_LEN, 32 | TM_LT, 33 | TM_LE, 34 | TM_CONCAT, 35 | TM_CALL, 36 | TM_N /* number of elements in the enum */ 37 | } TMS; 38 | 39 | 40 | 41 | #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ 42 | ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 43 | 44 | #define fasttm(l,et,e) gfasttm(G(l), et, e) 45 | 46 | LUAI_DATA const char *const luaT_typenames[]; 47 | 48 | 49 | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); 50 | LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, 51 | TMS event); 52 | LUAI_FUNC void luaT_init (lua_State *L); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /deps/lua/src/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | /* Key to file-handle type */ 15 | #define LUA_FILEHANDLE "FILE*" 16 | 17 | 18 | #define LUA_COLIBNAME "coroutine" 19 | LUALIB_API int (luaopen_base) (lua_State *L); 20 | 21 | #define LUA_TABLIBNAME "table" 22 | LUALIB_API int (luaopen_table) (lua_State *L); 23 | 24 | #define LUA_IOLIBNAME "io" 25 | LUALIB_API int (luaopen_io) (lua_State *L); 26 | 27 | #define LUA_OSLIBNAME "os" 28 | LUALIB_API int (luaopen_os) (lua_State *L); 29 | 30 | #define LUA_STRLIBNAME "string" 31 | LUALIB_API int (luaopen_string) (lua_State *L); 32 | 33 | #define LUA_MATHLIBNAME "math" 34 | LUALIB_API int (luaopen_math) (lua_State *L); 35 | 36 | #define LUA_DBLIBNAME "debug" 37 | LUALIB_API int (luaopen_debug) (lua_State *L); 38 | 39 | #define LUA_LOADLIBNAME "package" 40 | LUALIB_API int (luaopen_package) (lua_State *L); 41 | 42 | 43 | /* open all previous libraries */ 44 | LUALIB_API void (luaL_openlibs) (lua_State *L); 45 | 46 | 47 | 48 | #ifndef lua_assert 49 | #define lua_assert(x) ((void)0) 50 | #endif 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /deps/lua/src/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "lobject.h" 11 | #include "lzio.h" 12 | 13 | /* load one chunk; from lundump.c */ 14 | LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); 15 | 16 | /* make header; from lundump.c */ 17 | LUAI_FUNC void luaU_header (char* h); 18 | 19 | /* dump one chunk; from ldump.c */ 20 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); 21 | 22 | #ifdef luac_c 23 | /* print one chunk; from print.c */ 24 | LUAI_FUNC void luaU_print (const Proto* f, int full); 25 | #endif 26 | 27 | /* for header of binary files -- this is Lua 5.1 */ 28 | #define LUAC_VERSION 0x51 29 | 30 | /* for header of binary files -- this is the official format */ 31 | #define LUAC_FORMAT 0 32 | 33 | /* size of header of binary files */ 34 | #define LUAC_HEADERSIZE 12 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /deps/lua/src/lvm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua virtual machine 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lvm_h 8 | #define lvm_h 9 | 10 | 11 | #include "ldo.h" 12 | #include "lobject.h" 13 | #include "ltm.h" 14 | 15 | 16 | #define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) 17 | 18 | #define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ 19 | (((o) = luaV_tonumber(o,n)) != NULL)) 20 | 21 | #define equalobj(L,o1,o2) \ 22 | (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) 23 | 24 | 25 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); 26 | LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); 27 | LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); 28 | LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); 29 | LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, 30 | StkId val); 31 | LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, 32 | StkId val); 33 | LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); 34 | LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /deps/lua/test/README: -------------------------------------------------------------------------------- 1 | These are simple tests for Lua. Some of them contain useful code. 2 | They are meant to be run to make sure Lua is built correctly and also 3 | to be read, to see how Lua programs look. 4 | 5 | Here is a one-line summary of each program: 6 | 7 | bisect.lua bisection method for solving non-linear equations 8 | cf.lua temperature conversion table (celsius to farenheit) 9 | echo.lua echo command line arguments 10 | env.lua environment variables as automatic global variables 11 | factorial.lua factorial without recursion 12 | fib.lua fibonacci function with cache 13 | fibfor.lua fibonacci numbers with coroutines and generators 14 | globals.lua report global variable usage 15 | hello.lua the first program in every language 16 | life.lua Conway's Game of Life 17 | luac.lua bare-bones luac 18 | printf.lua an implementation of printf 19 | readonly.lua make global variables readonly 20 | sieve.lua the sieve of of Eratosthenes programmed with coroutines 21 | sort.lua two implementations of a sort function 22 | table.lua make table, grouping all data for the same item 23 | trace-calls.lua trace calls 24 | trace-globals.lua trace assigments to global variables 25 | xd.lua hex dump 26 | 27 | -------------------------------------------------------------------------------- /deps/lua/test/bisect.lua: -------------------------------------------------------------------------------- 1 | -- bisection method for solving non-linear equations 2 | 3 | delta=1e-6 -- tolerance 4 | 5 | function bisect(f,a,b,fa,fb) 6 | local c=(a+b)/2 7 | io.write(n," c=",c," a=",a," b=",b,"\n") 8 | if c==a or c==b or math.abs(a-b)>> ",string.rep(" ",level)) 9 | if t~=nil and t.currentline>=0 then io.write(t.short_src,":",t.currentline," ") end 10 | t=debug.getinfo(2) 11 | if event=="call" then 12 | level=level+1 13 | else 14 | level=level-1 if level<0 then level=0 end 15 | end 16 | if t.what=="main" then 17 | if event=="call" then 18 | io.write("begin ",t.short_src) 19 | else 20 | io.write("end ",t.short_src) 21 | end 22 | elseif t.what=="Lua" then 23 | -- table.foreach(t,print) 24 | io.write(event," ",t.name or "(Lua)"," <",t.linedefined,":",t.short_src,">") 25 | else 26 | io.write(event," ",t.name or "(C)"," [",t.what,"] ") 27 | end 28 | io.write("\n") 29 | end 30 | 31 | debug.sethook(hook,"cr") 32 | level=0 33 | -------------------------------------------------------------------------------- /deps/lua/test/trace-globals.lua: -------------------------------------------------------------------------------- 1 | -- trace assigments to global variables 2 | 3 | do 4 | -- a tostring that quotes strings. note the use of the original tostring. 5 | local _tostring=tostring 6 | local tostring=function(a) 7 | if type(a)=="string" then 8 | return string.format("%q",a) 9 | else 10 | return _tostring(a) 11 | end 12 | end 13 | 14 | local log=function (name,old,new) 15 | local t=debug.getinfo(3,"Sl") 16 | local line=t.currentline 17 | io.write(t.short_src) 18 | if line>=0 then io.write(":",line) end 19 | io.write(": ",name," is now ",tostring(new)," (was ",tostring(old),")","\n") 20 | end 21 | 22 | local g={} 23 | local set=function (t,name,value) 24 | log(name,g[name],value) 25 | g[name]=value 26 | end 27 | setmetatable(getfenv(),{__index=g,__newindex=set}) 28 | end 29 | 30 | -- an example 31 | 32 | a=1 33 | b=2 34 | a=10 35 | b=20 36 | b=nil 37 | b=200 38 | print(a,b,c) 39 | -------------------------------------------------------------------------------- /deps/lua/test/xd.lua: -------------------------------------------------------------------------------- 1 | -- hex dump 2 | -- usage: lua xd.lua < file 3 | 4 | local offset=0 5 | while true do 6 | local s=io.read(16) 7 | if s==nil then return end 8 | io.write(string.format("%08X ",offset)) 9 | string.gsub(s,"(.)", 10 | function (c) io.write(string.format("%02X ",string.byte(c))) end) 11 | io.write(string.rep(" ",3*(16-string.len(s)))) 12 | io.write(" ",string.gsub(s,"%c","."),"\n") 13 | offset=offset+16 14 | end 15 | -------------------------------------------------------------------------------- /deps/memkind/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: cpp python 3 | before_install: 4 | - ./autogen.sh 5 | - ./build_jemalloc.sh 6 | install: 7 | - CXX="g++-4.8" CC="gcc-4.8" ./configure --enable-cxx11 8 | script: 9 | - make 10 | - make test 11 | after_failure: 12 | - echo "Sad memking" 13 | - find . -name config.log -exec cat {} ";" 14 | - find . -name test-suite.log -exec cat {} ";" 15 | addons: 16 | apt: 17 | sources: 18 | - ubuntu-toolchain-r-test 19 | packages: 20 | - gcc-4.8 21 | - g++-4.8 22 | - libnuma-dev 23 | - numactl 24 | notifications: 25 | email: 26 | recipients: 27 | - krzysztof.kulakowski@intel.com 28 | - lukasz.anaczkowski@intel.com 29 | on_success: [change] 30 | on_failure: [always] 31 | -------------------------------------------------------------------------------- /deps/memkind/AUTHORS: -------------------------------------------------------------------------------- 1 | Christopher Cantalupo 2 | Vishwanath Venkatesan 3 | Steven Hampson 4 | Krzysztof Czurylo 5 | Leobardo Rountree 6 | Hector Barajas Villalobos 7 | Ruchira Sasanka 8 | Krzysztof Kulakowski 9 | Rafael Aquini 10 | Alexandr Konovalov 11 | Grzegorz Ozanski 12 | Artur Koziej 13 | Jakub Dlugolecki 14 | Lukasz Anaczkowski 15 | Agata Wozniak 16 | Grzegorz Andrejczuk 17 | Kamil Patelczyk 18 | Jeff Hammond 19 | -------------------------------------------------------------------------------- /deps/memkind/NEWS: -------------------------------------------------------------------------------- 1 | OPEN DEVELOPMENT 2 | ================ 3 | 4 | We are moving to a more open development model with memkind. 5 | 6 | - The memkind github organization: 7 | https://github.com/memkind 8 | 9 | - Rather than posting bulk patches at time of tag, we are posting more 10 | incremental patches with finer grain commit details. 11 | 12 | - There is now a "dev" branch in the memkind repository and a 13 | "memkind-dev" branch in the memkind fork of the jemalloc repository. 14 | These will be used for open development work. 15 | 16 | - There is a memkind web page here: 17 | http://memkind.github.io/memkind 18 | 19 | - We have posted an architecture document here: 20 | http://memkind.github.io/memkind/memkind_arch_20150318.pdf 21 | 22 | - We invite you to join the memkind mailing list: 23 | https://lists.01.org/mailman/listinfo/memkind 24 | 25 | - Feel free to open a github issue, especially if there is a TODO item 26 | that you would like to prioritize. 27 | 28 | - We have posted source and binary RPMs for several distributions here: 29 | http://download.opensuse.org/repositories/home:/cmcantalupo/ 30 | 31 | - memkind is also avaiable in Fedora package repository (devel, EPEL7): 32 | https://admin.fedoraproject.org/pkgdb/package/memkind/ 33 | 34 | - Pull requests are welcome. 35 | 36 | - White space formatting generally conforms to 37 | $ astyle --style=linux --indent=spaces=4 -y -S 38 | 39 | - For more information about astyle: 40 | http://astyle.sourceforge.net/ 41 | -------------------------------------------------------------------------------- /deps/memkind/README.md: -------------------------------------------------------------------------------- 1 | README -------------------------------------------------------------------------------- /deps/memkind/config_tls.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 - 2016 Intel Corporation. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 1. Redistributions of source code must retain the above copyright notice(s), 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice(s), 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS 14 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | * EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 21 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 22 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | */ 24 | 25 | /* Enables TLS usage for mapping arenas to threads */ 26 | #undef MEMKIND_TLS 27 | 28 | /* TLS model attribute */ 29 | #undef MEMKIND_TLS_MODEL 30 | -------------------------------------------------------------------------------- /deps/memkind/copying_headers/MANIFEST.freeBSD3: -------------------------------------------------------------------------------- 1 | examples/pmem_example.c 2 | -------------------------------------------------------------------------------- /deps/memkind/copying_headers/header.freeBSD: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Intel Corporation. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 1. Redistributions of source code must retain the above copyright notice(s), 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice(s), 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS 14 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | * EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 21 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 22 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | */ -------------------------------------------------------------------------------- /deps/memkind/jemalloc/.autom4te.cfg: -------------------------------------------------------------------------------- 1 | begin-language: "Autoconf-without-aclocal-m4" 2 | args: --no-cache 3 | end-language: "Autoconf-without-aclocal-m4" 4 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/README: -------------------------------------------------------------------------------- 1 | jemalloc is a general purpose malloc(3) implementation that emphasizes 2 | fragmentation avoidance and scalable concurrency support. jemalloc first came 3 | into use as the FreeBSD libc allocator in 2005, and since then it has found its 4 | way into numerous applications that rely on its predictable behavior. In 2010 5 | jemalloc development efforts broadened to include developer support features 6 | such as heap profiling, Valgrind integration, and extensive monitoring/tuning 7 | hooks. Modern jemalloc releases continue to be integrated back into FreeBSD, 8 | and therefore versatility remains critical. Ongoing development efforts trend 9 | toward making jemalloc among the best allocators for a broad range of demanding 10 | applications, and eliminating/mitigating weaknesses that have practical 11 | repercussions for real world applications. 12 | 13 | The COPYING file contains copyright and licensing information. 14 | 15 | The INSTALL file contains information on how to configure, build, and install 16 | jemalloc. 17 | 18 | The ChangeLog file contains a brief summary of changes for each release. 19 | 20 | URL: http://www.canonware.com/jemalloc/ 21 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in autoconf; do 4 | echo "$i" 5 | $i 6 | if [ $? -ne 0 ]; then 7 | echo "Error $? in $i" 8 | exit 1 9 | fi 10 | done 11 | 12 | echo "./configure --enable-autogen $@" 13 | ./configure --enable-autogen $@ 14 | if [ $? -ne 0 ]; then 15 | echo "Error $? in ./configure" 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/bin/jemalloc.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | 7 | @LD_PRELOAD_VAR@=${libdir}/libjemalloc.@SOREV@ 8 | export @LD_PRELOAD_VAR@ 9 | exec "$@" 10 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/config.stamp.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmem/pmem-redis/4b9cf06de20e4010d71b1803bb2348b6543a63da/deps/memkind/jemalloc/config.stamp.in -------------------------------------------------------------------------------- /deps/memkind/jemalloc/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | objdir=$1 6 | suffix=$2 7 | shift 2 8 | objs=$@ 9 | 10 | gcov -b -p -f -o "${objdir}" ${objs} 11 | 12 | # Move gcov outputs so that subsequent gcov invocations won't clobber results 13 | # for the same sources with different compilation flags. 14 | for f in `find . -maxdepth 1 -type f -name '*.gcov'` ; do 15 | mv "${f}" "${f}.${suffix}" 16 | done 17 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/doc/html.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/doc/manpages.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/doc/stylesheet.xsl: -------------------------------------------------------------------------------- 1 | 2 | ansi 3 | 4 | 5 | "" 6 | 7 | 8 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/include/jemalloc/internal/assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Define a custom assert() in order to reduce the chances of deadlock during 3 | * assertion failure. 4 | */ 5 | #ifndef assert 6 | #define assert(e) do { \ 7 | if (unlikely(config_debug && !(e))) { \ 8 | malloc_printf( \ 9 | ": %s:%d: Failed assertion: \"%s\"\n", \ 10 | __FILE__, __LINE__, #e); \ 11 | abort(); \ 12 | } \ 13 | } while (0) 14 | #endif 15 | 16 | #ifndef not_reached 17 | #define not_reached() do { \ 18 | if (config_debug) { \ 19 | malloc_printf( \ 20 | ": %s:%d: Unreachable code reached\n", \ 21 | __FILE__, __LINE__); \ 22 | abort(); \ 23 | } \ 24 | unreachable(); \ 25 | } while (0) 26 | #endif 27 | 28 | #ifndef not_implemented 29 | #define not_implemented() do { \ 30 | if (config_debug) { \ 31 | malloc_printf(": %s:%d: Not implemented\n", \ 32 | __FILE__, __LINE__); \ 33 | abort(); \ 34 | } \ 35 | } while (0) 36 | #endif 37 | 38 | #ifndef assert_not_implemented 39 | #define assert_not_implemented(e) do { \ 40 | if (unlikely(config_debug && !(e))) \ 41 | not_implemented(); \ 42 | } while (0) 43 | #endif 44 | 45 | 46 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/include/jemalloc/internal/base.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | #endif /* JEMALLOC_H_TYPES */ 5 | /******************************************************************************/ 6 | #ifdef JEMALLOC_H_STRUCTS 7 | 8 | #endif /* JEMALLOC_H_STRUCTS */ 9 | /******************************************************************************/ 10 | #ifdef JEMALLOC_H_EXTERNS 11 | 12 | void *base_alloc(size_t size); 13 | void base_stats_get(size_t *allocated, size_t *resident, size_t *mapped); 14 | bool base_boot(void); 15 | void base_prefork(void); 16 | void base_postfork_parent(void); 17 | void base_postfork_child(void); 18 | 19 | #endif /* JEMALLOC_H_EXTERNS */ 20 | /******************************************************************************/ 21 | #ifdef JEMALLOC_H_INLINES 22 | 23 | #endif /* JEMALLOC_H_INLINES */ 24 | /******************************************************************************/ 25 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/include/jemalloc/internal/chunk_dss.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | typedef enum { 5 | dss_prec_disabled = 0, 6 | dss_prec_primary = 1, 7 | dss_prec_secondary = 2, 8 | 9 | dss_prec_limit = 3 10 | } dss_prec_t; 11 | #define DSS_PREC_DEFAULT dss_prec_secondary 12 | #define DSS_DEFAULT "secondary" 13 | 14 | #endif /* JEMALLOC_H_TYPES */ 15 | /******************************************************************************/ 16 | #ifdef JEMALLOC_H_STRUCTS 17 | 18 | extern const char *dss_prec_names[]; 19 | 20 | #endif /* JEMALLOC_H_STRUCTS */ 21 | /******************************************************************************/ 22 | #ifdef JEMALLOC_H_EXTERNS 23 | 24 | dss_prec_t chunk_dss_prec_get(void); 25 | bool chunk_dss_prec_set(dss_prec_t dss_prec); 26 | void *chunk_alloc_dss(arena_t *arena, void *new_addr, size_t size, 27 | size_t alignment, bool *zero, bool *commit); 28 | bool chunk_in_dss(void *chunk); 29 | bool chunk_dss_boot(void); 30 | void chunk_dss_prefork(void); 31 | void chunk_dss_postfork_parent(void); 32 | void chunk_dss_postfork_child(void); 33 | 34 | #endif /* JEMALLOC_H_EXTERNS */ 35 | /******************************************************************************/ 36 | #ifdef JEMALLOC_H_INLINES 37 | 38 | #endif /* JEMALLOC_H_INLINES */ 39 | /******************************************************************************/ 40 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/include/jemalloc/internal/chunk_mmap.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | #endif /* JEMALLOC_H_TYPES */ 5 | /******************************************************************************/ 6 | #ifdef JEMALLOC_H_STRUCTS 7 | 8 | #endif /* JEMALLOC_H_STRUCTS */ 9 | /******************************************************************************/ 10 | #ifdef JEMALLOC_H_EXTERNS 11 | 12 | void *chunk_alloc_mmap(void *new_addr, size_t size, size_t alignment, 13 | bool *zero, bool *commit); 14 | bool chunk_dalloc_mmap(void *chunk, size_t size); 15 | 16 | #endif /* JEMALLOC_H_EXTERNS */ 17 | /******************************************************************************/ 18 | #ifdef JEMALLOC_H_INLINES 19 | 20 | #endif /* JEMALLOC_H_INLINES */ 21 | /******************************************************************************/ 22 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/include/jemalloc/internal/pages.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | #endif /* JEMALLOC_H_TYPES */ 5 | /******************************************************************************/ 6 | #ifdef JEMALLOC_H_STRUCTS 7 | 8 | #endif /* JEMALLOC_H_STRUCTS */ 9 | /******************************************************************************/ 10 | #ifdef JEMALLOC_H_EXTERNS 11 | 12 | void *pages_map(void *addr, size_t size); 13 | void pages_unmap(void *addr, size_t size); 14 | void *pages_trim(void *addr, size_t alloc_size, size_t leadsize, 15 | size_t size); 16 | bool pages_commit(void *addr, size_t size); 17 | bool pages_decommit(void *addr, size_t size); 18 | bool pages_purge(void *addr, size_t size); 19 | 20 | #endif /* JEMALLOC_H_EXTERNS */ 21 | /******************************************************************************/ 22 | #ifdef JEMALLOC_H_INLINES 23 | 24 | #endif /* JEMALLOC_H_INLINES */ 25 | /******************************************************************************/ 26 | 27 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/include/jemalloc/internal/private_namespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for symbol in `cat $1` ; do 4 | echo "#define ${symbol} JEMALLOC_N(${symbol})" 5 | done 6 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/include/jemalloc/internal/private_unnamespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for symbol in `cat $1` ; do 4 | echo "#undef ${symbol}" 5 | done 6 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/include/jemalloc/internal/public_namespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for nm in `cat $1` ; do 4 | n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` 5 | echo "#define je_${n} JEMALLOC_N(${n})" 6 | done 7 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/include/jemalloc/internal/public_unnamespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for nm in `cat $1` ; do 4 | n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` 5 | echo "#undef je_${n}" 6 | done 7 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/include/jemalloc/jemalloc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | objroot=$1 4 | 5 | cat < 5 | 6 | /* MSVC doesn't define _Bool or bool in C, but does have BOOL */ 7 | /* Note this doesn't pass autoconf's test because (bool) 0.5 != true */ 8 | /* Clang-cl uses MSVC headers, so needs msvc_compat, but has _Bool as 9 | * a built-in type. */ 10 | #ifndef __clang__ 11 | typedef BOOL _Bool; 12 | #endif 13 | 14 | #define bool _Bool 15 | #define true 1 16 | #define false 0 17 | 18 | #define __bool_true_false_are_defined 1 19 | 20 | #endif /* stdbool_h */ 21 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/include/msvc_compat/strings.h: -------------------------------------------------------------------------------- 1 | #ifndef strings_h 2 | #define strings_h 3 | 4 | /* MSVC doesn't define ffs/ffsl. This dummy strings.h header is provided 5 | * for both */ 6 | #ifdef _MSC_VER 7 | # include 8 | # pragma intrinsic(_BitScanForward) 9 | static __forceinline int ffsl(long x) 10 | { 11 | unsigned long i; 12 | 13 | if (_BitScanForward(&i, x)) 14 | return (i + 1); 15 | return (0); 16 | } 17 | 18 | static __forceinline int ffs(int x) 19 | { 20 | 21 | return (ffsl(x)); 22 | } 23 | 24 | # ifdef _M_X64 25 | # pragma intrinsic(_BitScanForward64) 26 | # endif 27 | 28 | static __forceinline int ffsll(unsigned __int64 x) 29 | { 30 | unsigned long i; 31 | #ifdef _M_X64 32 | if (_BitScanForward64(&i, x)) 33 | return (i + 1); 34 | return (0); 35 | #else 36 | // Fallback for 32-bit build where 64-bit version not available 37 | // assuming little endian 38 | union { 39 | unsigned __int64 ll; 40 | unsigned long l[2]; 41 | } s; 42 | 43 | s.ll = x; 44 | 45 | if (_BitScanForward(&i, s.l[0])) 46 | return (i + 1); 47 | else if(_BitScanForward(&i, s.l[1])) 48 | return (i + 33); 49 | return (0); 50 | #endif 51 | } 52 | 53 | #else 54 | # define ffsll(x) __builtin_ffsll(x) 55 | # define ffsl(x) __builtin_ffsl(x) 56 | # define ffs(x) __builtin_ffs(x) 57 | #endif 58 | 59 | #endif /* strings_h */ 60 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/include/msvc_compat/windows_extra.h: -------------------------------------------------------------------------------- 1 | #ifndef MSVC_COMPAT_WINDOWS_EXTRA_H 2 | #define MSVC_COMPAT_WINDOWS_EXTRA_H 3 | 4 | #ifndef ENOENT 5 | # define ENOENT ERROR_PATH_NOT_FOUND 6 | #endif 7 | #ifndef EINVAL 8 | # define EINVAL ERROR_BAD_ARGUMENTS 9 | #endif 10 | #ifndef EAGAIN 11 | # define EAGAIN ERROR_OUTOFMEMORY 12 | #endif 13 | #ifndef EPERM 14 | # define EPERM ERROR_WRITE_FAULT 15 | #endif 16 | #ifndef EFAULT 17 | # define EFAULT ERROR_INVALID_ADDRESS 18 | #endif 19 | #ifndef ENOMEM 20 | # define ENOMEM ERROR_NOT_ENOUGH_MEMORY 21 | #endif 22 | #ifndef ERANGE 23 | # define ERANGE ERROR_INVALID_DATA 24 | #endif 25 | 26 | #endif /* MSVC_COMPAT_WINDOWS_EXTRA_H */ 27 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/jemalloc.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | install_suffix=@install_suffix@ 6 | 7 | Name: jemalloc 8 | Description: A general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. 9 | URL: http://www.canonware.com/jemalloc 10 | Version: @jemalloc_version@ 11 | Cflags: -I${includedir} 12 | Libs: -L${libdir} -ljemalloc${install_suffix} 13 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/msvc/ReadMe.txt: -------------------------------------------------------------------------------- 1 | 2 | How to build jemalloc for Windows 3 | ================================= 4 | 5 | 1. Install Cygwin with at least the following packages: 6 | * autoconf 7 | * autogen 8 | * gawk 9 | * grep 10 | * sed 11 | 12 | 2. Install Visual Studio 2015 with Visual C++ 13 | 14 | 3. Add Cygwin\bin to the PATH environment variable 15 | 16 | 4. Open "VS2015 x86 Native Tools Command Prompt" 17 | (note: x86/x64 doesn't matter at this point) 18 | 19 | 5. Generate header files: 20 | sh -c "./autogen.sh CC=cl --enable-lazy-lock=no" 21 | 22 | 6. Now the project can be opened and built in Visual Studio: 23 | msvc\jemalloc_vc2015.sln 24 | 25 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/msvc/projects/vc2015/test_threads/test_threads.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | int test_threads(); 4 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/msvc/projects/vc2015/test_threads/test_threads.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | 22 | 23 | Header Files 24 | 25 | 26 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/msvc/projects/vc2015/test_threads/test_threads_main.cpp: -------------------------------------------------------------------------------- 1 | #include "test_threads.h" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std::chrono_literals; 7 | 8 | int main(int argc, char** argv) 9 | { 10 | int rc = test_threads(); 11 | return rc; 12 | } 13 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/src/atomic.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_ATOMIC_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/src/hash.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_HASH_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/src/mb.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_MB_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/src/prng.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_PRNG_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/src/ticker.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_TICKER_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/src/valgrind.c: -------------------------------------------------------------------------------- 1 | #include "jemalloc/internal/jemalloc_internal.h" 2 | #ifndef JEMALLOC_VALGRIND 3 | # error "This source file is for Valgrind integration." 4 | #endif 5 | 6 | #include 7 | 8 | void 9 | valgrind_make_mem_noaccess(void *ptr, size_t usize) 10 | { 11 | 12 | VALGRIND_MAKE_MEM_NOACCESS(ptr, usize); 13 | } 14 | 15 | void 16 | valgrind_make_mem_undefined(void *ptr, size_t usize) 17 | { 18 | 19 | VALGRIND_MAKE_MEM_UNDEFINED(ptr, usize); 20 | } 21 | 22 | void 23 | valgrind_make_mem_defined(void *ptr, size_t usize) 24 | { 25 | 26 | VALGRIND_MAKE_MEM_DEFINED(ptr, usize); 27 | } 28 | 29 | void 30 | valgrind_freelike_block(void *ptr, size_t usize) 31 | { 32 | 33 | VALGRIND_FREELIKE_BLOCK(ptr, usize); 34 | } 35 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/include/test/btalloc.h: -------------------------------------------------------------------------------- 1 | /* btalloc() provides a mechanism for allocating via permuted backtraces. */ 2 | void *btalloc(size_t size, unsigned bits); 3 | 4 | #define btalloc_n_proto(n) \ 5 | void *btalloc_##n(size_t size, unsigned bits); 6 | btalloc_n_proto(0) 7 | btalloc_n_proto(1) 8 | 9 | #define btalloc_n_gen(n) \ 10 | void * \ 11 | btalloc_##n(size_t size, unsigned bits) \ 12 | { \ 13 | void *p; \ 14 | \ 15 | if (bits == 0) \ 16 | p = mallocx(size, 0); \ 17 | else { \ 18 | switch (bits & 0x1U) { \ 19 | case 0: \ 20 | p = (btalloc_0(size, bits >> 1)); \ 21 | break; \ 22 | case 1: \ 23 | p = (btalloc_1(size, bits >> 1)); \ 24 | break; \ 25 | default: not_reached(); \ 26 | } \ 27 | } \ 28 | /* Intentionally sabotage tail call optimization. */ \ 29 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); \ 30 | return (p); \ 31 | } 32 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/include/test/jemalloc_test_defs.h.in: -------------------------------------------------------------------------------- 1 | #include "jemalloc/internal/jemalloc_internal_defs.h" 2 | #include "jemalloc/internal/jemalloc_internal_decls.h" 3 | 4 | /* 5 | * For use by SFMT. configure.ac doesn't actually define HAVE_SSE2 because its 6 | * dependencies are notoriously unportable in practice. 7 | */ 8 | #undef HAVE_SSE2 9 | #undef HAVE_ALTIVEC 10 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/include/test/mtx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mtx is a slightly simplified version of malloc_mutex. This code duplication 3 | * is unfortunate, but there are allocator bootstrapping considerations that 4 | * would leak into the test infrastructure if malloc_mutex were used directly 5 | * in tests. 6 | */ 7 | 8 | typedef struct { 9 | #ifdef _WIN32 10 | CRITICAL_SECTION lock; 11 | #elif (defined(JEMALLOC_OSSPIN)) 12 | OSSpinLock lock; 13 | #else 14 | pthread_mutex_t lock; 15 | #endif 16 | } mtx_t; 17 | 18 | bool mtx_init(mtx_t *mtx); 19 | void mtx_fini(mtx_t *mtx); 20 | void mtx_lock(mtx_t *mtx); 21 | void mtx_unlock(mtx_t *mtx); 22 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/include/test/thd.h: -------------------------------------------------------------------------------- 1 | /* Abstraction layer for threading in tests. */ 2 | #ifdef _WIN32 3 | typedef HANDLE thd_t; 4 | #else 5 | typedef pthread_t thd_t; 6 | #endif 7 | 8 | void thd_create(thd_t *thd, void *(*proc)(void *), void *arg); 9 | void thd_join(thd_t thd, void **ret); 10 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/include/test/timer.h: -------------------------------------------------------------------------------- 1 | /* Simple timer, for use in benchmark reporting. */ 2 | 3 | typedef struct { 4 | nstime_t t0; 5 | nstime_t t1; 6 | } timedelta_t; 7 | 8 | void timer_start(timedelta_t *timer); 9 | void timer_stop(timedelta_t *timer); 10 | uint64_t timer_usec(const timedelta_t *timer); 11 | void timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen); 12 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/integration/overflow.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_overflow) 4 | { 5 | unsigned nhchunks; 6 | size_t mib[4]; 7 | size_t sz, miblen, max_size_class; 8 | void *p; 9 | 10 | sz = sizeof(unsigned); 11 | assert_d_eq(mallctl("arenas.nhchunks", &nhchunks, &sz, NULL, 0), 0, 12 | "Unexpected mallctl() error"); 13 | 14 | miblen = sizeof(mib) / sizeof(size_t); 15 | assert_d_eq(mallctlnametomib("arenas.hchunk.0.size", mib, &miblen), 0, 16 | "Unexpected mallctlnametomib() error"); 17 | mib[2] = nhchunks - 1; 18 | 19 | sz = sizeof(size_t); 20 | assert_d_eq(mallctlbymib(mib, miblen, &max_size_class, &sz, NULL, 0), 0, 21 | "Unexpected mallctlbymib() error"); 22 | 23 | assert_ptr_null(malloc(max_size_class + 1), 24 | "Expected OOM due to over-sized allocation request"); 25 | assert_ptr_null(malloc(SIZE_T_MAX), 26 | "Expected OOM due to over-sized allocation request"); 27 | 28 | assert_ptr_null(calloc(1, max_size_class + 1), 29 | "Expected OOM due to over-sized allocation request"); 30 | assert_ptr_null(calloc(1, SIZE_T_MAX), 31 | "Expected OOM due to over-sized allocation request"); 32 | 33 | p = malloc(1); 34 | assert_ptr_not_null(p, "Unexpected malloc() OOM"); 35 | assert_ptr_null(realloc(p, max_size_class + 1), 36 | "Expected OOM due to over-sized allocation request"); 37 | assert_ptr_null(realloc(p, SIZE_T_MAX), 38 | "Expected OOM due to over-sized allocation request"); 39 | free(p); 40 | } 41 | TEST_END 42 | 43 | int 44 | main(void) 45 | { 46 | 47 | return (test( 48 | test_overflow)); 49 | } 50 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/integration/sdallocx.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #define MAXALIGN (((size_t)1) << 25) 4 | #define NITER 4 5 | 6 | TEST_BEGIN(test_basic) 7 | { 8 | void *ptr = mallocx(64, 0); 9 | sdallocx(ptr, 64, 0); 10 | } 11 | TEST_END 12 | 13 | TEST_BEGIN(test_alignment_and_size) 14 | { 15 | size_t nsz, sz, alignment, total; 16 | unsigned i; 17 | void *ps[NITER]; 18 | 19 | for (i = 0; i < NITER; i++) 20 | ps[i] = NULL; 21 | 22 | for (alignment = 8; 23 | alignment <= MAXALIGN; 24 | alignment <<= 1) { 25 | total = 0; 26 | for (sz = 1; 27 | sz < 3 * alignment && sz < (1U << 31); 28 | sz += (alignment >> (LG_SIZEOF_PTR-1)) - 1) { 29 | for (i = 0; i < NITER; i++) { 30 | nsz = nallocx(sz, MALLOCX_ALIGN(alignment) | 31 | MALLOCX_ZERO); 32 | ps[i] = mallocx(sz, MALLOCX_ALIGN(alignment) | 33 | MALLOCX_ZERO); 34 | total += nsz; 35 | if (total >= (MAXALIGN << 1)) 36 | break; 37 | } 38 | for (i = 0; i < NITER; i++) { 39 | if (ps[i] != NULL) { 40 | sdallocx(ps[i], sz, 41 | MALLOCX_ALIGN(alignment)); 42 | ps[i] = NULL; 43 | } 44 | } 45 | } 46 | } 47 | } 48 | TEST_END 49 | 50 | int 51 | main(void) 52 | { 53 | 54 | return (test( 55 | test_basic, 56 | test_alignment_and_size)); 57 | } 58 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/src/btalloc.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | void * 4 | btalloc(size_t size, unsigned bits) 5 | { 6 | 7 | return (btalloc_0(size, bits)); 8 | } 9 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/src/btalloc_0.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | btalloc_n_gen(0) 4 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/src/btalloc_1.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | btalloc_n_gen(1) 4 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/src/math.c: -------------------------------------------------------------------------------- 1 | #define MATH_C_ 2 | #include "test/jemalloc_test.h" 3 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/src/mq.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | /* 4 | * Sleep for approximately ns nanoseconds. No lower *nor* upper bound on sleep 5 | * time is guaranteed. 6 | */ 7 | void 8 | mq_nanosleep(unsigned ns) 9 | { 10 | 11 | assert(ns <= 1000*1000*1000); 12 | 13 | #ifdef _WIN32 14 | Sleep(ns / 1000); 15 | #else 16 | { 17 | struct timespec timeout; 18 | 19 | if (ns < 1000*1000*1000) { 20 | timeout.tv_sec = 0; 21 | timeout.tv_nsec = ns; 22 | } else { 23 | timeout.tv_sec = 1; 24 | timeout.tv_nsec = 0; 25 | } 26 | nanosleep(&timeout, NULL); 27 | } 28 | #endif 29 | } 30 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/src/mtx.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifndef _CRT_SPINCOUNT 4 | #define _CRT_SPINCOUNT 4000 5 | #endif 6 | 7 | bool 8 | mtx_init(mtx_t *mtx) 9 | { 10 | 11 | #ifdef _WIN32 12 | if (!InitializeCriticalSectionAndSpinCount(&mtx->lock, _CRT_SPINCOUNT)) 13 | return (true); 14 | #elif (defined(JEMALLOC_OSSPIN)) 15 | mtx->lock = 0; 16 | #else 17 | pthread_mutexattr_t attr; 18 | 19 | if (pthread_mutexattr_init(&attr) != 0) 20 | return (true); 21 | pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_DEFAULT); 22 | if (pthread_mutex_init(&mtx->lock, &attr) != 0) { 23 | pthread_mutexattr_destroy(&attr); 24 | return (true); 25 | } 26 | pthread_mutexattr_destroy(&attr); 27 | #endif 28 | return (false); 29 | } 30 | 31 | void 32 | mtx_fini(mtx_t *mtx) 33 | { 34 | 35 | #ifdef _WIN32 36 | #elif (defined(JEMALLOC_OSSPIN)) 37 | #else 38 | pthread_mutex_destroy(&mtx->lock); 39 | #endif 40 | } 41 | 42 | void 43 | mtx_lock(mtx_t *mtx) 44 | { 45 | 46 | #ifdef _WIN32 47 | EnterCriticalSection(&mtx->lock); 48 | #elif (defined(JEMALLOC_OSSPIN)) 49 | OSSpinLockLock(&mtx->lock); 50 | #else 51 | pthread_mutex_lock(&mtx->lock); 52 | #endif 53 | } 54 | 55 | void 56 | mtx_unlock(mtx_t *mtx) 57 | { 58 | 59 | #ifdef _WIN32 60 | LeaveCriticalSection(&mtx->lock); 61 | #elif (defined(JEMALLOC_OSSPIN)) 62 | OSSpinLockUnlock(&mtx->lock); 63 | #else 64 | pthread_mutex_unlock(&mtx->lock); 65 | #endif 66 | } 67 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/src/thd.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifdef _WIN32 4 | void 5 | thd_create(thd_t *thd, void *(*proc)(void *), void *arg) 6 | { 7 | LPTHREAD_START_ROUTINE routine = (LPTHREAD_START_ROUTINE)proc; 8 | *thd = CreateThread(NULL, 0, routine, arg, 0, NULL); 9 | if (*thd == NULL) 10 | test_fail("Error in CreateThread()\n"); 11 | } 12 | 13 | void 14 | thd_join(thd_t thd, void **ret) 15 | { 16 | 17 | if (WaitForSingleObject(thd, INFINITE) == WAIT_OBJECT_0 && ret) { 18 | DWORD exit_code; 19 | GetExitCodeThread(thd, (LPDWORD) &exit_code); 20 | *ret = (void *)(uintptr_t)exit_code; 21 | } 22 | } 23 | 24 | #else 25 | void 26 | thd_create(thd_t *thd, void *(*proc)(void *), void *arg) 27 | { 28 | 29 | if (pthread_create(thd, NULL, proc, arg) != 0) 30 | test_fail("Error in pthread_create()\n"); 31 | } 32 | 33 | void 34 | thd_join(thd_t thd, void **ret) 35 | { 36 | 37 | pthread_join(thd, ret); 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/src/timer.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | void 4 | timer_start(timedelta_t *timer) 5 | { 6 | 7 | nstime_init(&timer->t0, 0); 8 | nstime_update(&timer->t0); 9 | } 10 | 11 | void 12 | timer_stop(timedelta_t *timer) 13 | { 14 | 15 | nstime_copy(&timer->t1, &timer->t0); 16 | nstime_update(&timer->t1); 17 | } 18 | 19 | uint64_t 20 | timer_usec(const timedelta_t *timer) 21 | { 22 | nstime_t delta; 23 | 24 | nstime_copy(&delta, &timer->t1); 25 | nstime_subtract(&delta, &timer->t0); 26 | return (nstime_ns(&delta) / 1000); 27 | } 28 | 29 | void 30 | timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen) 31 | { 32 | uint64_t t0 = timer_usec(a); 33 | uint64_t t1 = timer_usec(b); 34 | uint64_t mult; 35 | unsigned i = 0; 36 | unsigned j; 37 | int n; 38 | 39 | /* Whole. */ 40 | n = malloc_snprintf(&buf[i], buflen-i, "%"FMTu64, t0 / t1); 41 | i += n; 42 | if (i >= buflen) 43 | return; 44 | mult = 1; 45 | for (j = 0; j < n; j++) 46 | mult *= 10; 47 | 48 | /* Decimal. */ 49 | n = malloc_snprintf(&buf[i], buflen-i, "."); 50 | i += n; 51 | 52 | /* Fraction. */ 53 | while (i < buflen-1) { 54 | uint64_t round = (i+1 == buflen-1 && ((t0 * mult * 10 / t1) % 10 55 | >= 5)) ? 1 : 0; 56 | n = malloc_snprintf(&buf[i], buflen-i, 57 | "%"FMTu64, (t0 * mult / t1) % 10 + round); 58 | i += n; 59 | mult *= 10; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/test.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case @abi@ in 4 | macho) 5 | export DYLD_FALLBACK_LIBRARY_PATH="@objroot@lib" 6 | ;; 7 | pecoff) 8 | export PATH="${PATH}:@objroot@lib" 9 | ;; 10 | *) 11 | ;; 12 | esac 13 | 14 | # Corresponds to test_status_t. 15 | pass_code=0 16 | skip_code=1 17 | fail_code=2 18 | 19 | pass_count=0 20 | skip_count=0 21 | fail_count=0 22 | for t in $@; do 23 | if [ $pass_count -ne 0 -o $skip_count -ne 0 -o $fail_count != 0 ] ; then 24 | echo 25 | fi 26 | echo "=== ${t} ===" 27 | ${t}@exe@ @abs_srcroot@ @abs_objroot@ 28 | result_code=$? 29 | case ${result_code} in 30 | ${pass_code}) 31 | pass_count=$((pass_count+1)) 32 | ;; 33 | ${skip_code}) 34 | skip_count=$((skip_count+1)) 35 | ;; 36 | ${fail_code}) 37 | fail_count=$((fail_count+1)) 38 | ;; 39 | *) 40 | echo "Test harness error" 1>&2 41 | exit 1 42 | esac 43 | done 44 | 45 | total_count=`expr ${pass_count} + ${skip_count} + ${fail_count}` 46 | echo 47 | echo "Test suite summary: pass: ${pass_count}/${total_count}, skip: ${skip_count}/${total_count}, fail: ${fail_count}/${total_count}" 48 | 49 | if [ ${fail_count} -eq 0 ] ; then 50 | exit 0 51 | else 52 | exit 1 53 | fi 54 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/unit/junk_alloc.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_TEST_JUNK_OPT "junk:alloc" 2 | #include "junk.c" 3 | #undef JEMALLOC_TEST_JUNK_OPT 4 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/unit/junk_free.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_TEST_JUNK_OPT "junk:free" 2 | #include "junk.c" 3 | #undef JEMALLOC_TEST_JUNK_OPT 4 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/unit/lg_chunk.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | /* 4 | * Make sure that opt.lg_chunk clamping is sufficient. In practice, this test 5 | * program will fail a debug assertion during initialization and abort (rather 6 | * than the test soft-failing) if clamping is insufficient. 7 | */ 8 | const char *malloc_conf = "lg_chunk:0"; 9 | 10 | TEST_BEGIN(test_lg_chunk_clamp) 11 | { 12 | void *p; 13 | 14 | p = mallocx(1, 0); 15 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); 16 | dallocx(p, 0); 17 | } 18 | TEST_END 19 | 20 | int 21 | main(void) 22 | { 23 | 24 | return (test( 25 | test_lg_chunk_clamp)); 26 | } 27 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/unit/mtx.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #define NTHREADS 2 4 | #define NINCRS 2000000 5 | 6 | TEST_BEGIN(test_mtx_basic) 7 | { 8 | mtx_t mtx; 9 | 10 | assert_false(mtx_init(&mtx), "Unexpected mtx_init() failure"); 11 | mtx_lock(&mtx); 12 | mtx_unlock(&mtx); 13 | mtx_fini(&mtx); 14 | } 15 | TEST_END 16 | 17 | typedef struct { 18 | mtx_t mtx; 19 | unsigned x; 20 | } thd_start_arg_t; 21 | 22 | static void * 23 | thd_start(void *varg) 24 | { 25 | thd_start_arg_t *arg = (thd_start_arg_t *)varg; 26 | unsigned i; 27 | 28 | for (i = 0; i < NINCRS; i++) { 29 | mtx_lock(&arg->mtx); 30 | arg->x++; 31 | mtx_unlock(&arg->mtx); 32 | } 33 | return (NULL); 34 | } 35 | 36 | TEST_BEGIN(test_mtx_race) 37 | { 38 | thd_start_arg_t arg; 39 | thd_t thds[NTHREADS]; 40 | unsigned i; 41 | 42 | assert_false(mtx_init(&arg.mtx), "Unexpected mtx_init() failure"); 43 | arg.x = 0; 44 | for (i = 0; i < NTHREADS; i++) 45 | thd_create(&thds[i], thd_start, (void *)&arg); 46 | for (i = 0; i < NTHREADS; i++) 47 | thd_join(thds[i], NULL); 48 | assert_u_eq(arg.x, NTHREADS * NINCRS, 49 | "Race-related counter corruption"); 50 | } 51 | TEST_END 52 | 53 | int 54 | main(void) 55 | { 56 | 57 | return (test( 58 | test_mtx_basic, 59 | test_mtx_race)); 60 | } 61 | -------------------------------------------------------------------------------- /deps/memkind/jemalloc/test/unit/prof_idump.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifdef JEMALLOC_PROF 4 | const char *malloc_conf = 5 | "prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0," 6 | "lg_prof_interval:0"; 7 | #endif 8 | 9 | static bool did_prof_dump_open; 10 | 11 | static int 12 | prof_dump_open_intercept(bool propagate_err, const char *filename) 13 | { 14 | int fd; 15 | 16 | did_prof_dump_open = true; 17 | 18 | fd = open("/dev/null", O_WRONLY); 19 | assert_d_ne(fd, -1, "Unexpected open() failure"); 20 | 21 | return (fd); 22 | } 23 | 24 | TEST_BEGIN(test_idump) 25 | { 26 | bool active; 27 | void *p; 28 | 29 | test_skip_if(!config_prof); 30 | 31 | active = true; 32 | assert_d_eq(mallctl("prof.active", NULL, NULL, &active, sizeof(active)), 33 | 0, "Unexpected mallctl failure while activating profiling"); 34 | 35 | prof_dump_open = prof_dump_open_intercept; 36 | 37 | did_prof_dump_open = false; 38 | p = mallocx(1, 0); 39 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); 40 | dallocx(p, 0); 41 | assert_true(did_prof_dump_open, "Expected a profile dump"); 42 | } 43 | TEST_END 44 | 45 | int 46 | main(void) 47 | { 48 | 49 | return (test( 50 | test_idump)); 51 | } 52 | -------------------------------------------------------------------------------- /deps/memkind/test/allocator_perf_tool/Iterator.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 - 2016 Intel Corporation. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 1. Redistributions of source code must retain the above copyright notice(s), 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice(s), 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS 14 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | * EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 21 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 22 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | */ 24 | #pragma once 25 | 26 | template 27 | class Iterator 28 | { 29 | public: 30 | virtual bool has_next() const = 0; 31 | virtual T next() = 0; 32 | virtual size_t size() const = 0; 33 | }; 34 | 35 | -------------------------------------------------------------------------------- /deps/memkind/test/allocator_perf_tool/Runnable.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 - 2016 Intel Corporation. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 1. Redistributions of source code must retain the above copyright notice(s), 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice(s), 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS 14 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | * EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 21 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 22 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | */ 24 | #pragma once 25 | 26 | class Runnable 27 | { 28 | public: 29 | virtual void run() = 0; 30 | virtual ~Runnable() {}; 31 | }; -------------------------------------------------------------------------------- /deps/memkind/test/allocator_perf_tool/Workload.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 - 2016 Intel Corporation. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 1. Redistributions of source code must retain the above copyright notice(s), 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice(s), 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS 14 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | * EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 21 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 22 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | */ 24 | #pragma once 25 | 26 | #include "Allocator.hpp" 27 | 28 | class Workload 29 | { 30 | public: 31 | virtual bool run() = 0; 32 | virtual ~Workload(void) {} 33 | 34 | protected: 35 | Allocator* allocator; 36 | }; 37 | 38 | -------------------------------------------------------------------------------- /deps/memkind/test/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 - 2016 Intel Corporation. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 1. Redistributions of source code must retain the above copyright notice(s), 8 | * this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright notice(s), 10 | * this list of conditions and the following disclaimer in the documentation 11 | * and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS 14 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | * EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 21 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 22 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | */ 24 | 25 | #include "common.h" 26 | 27 | 28 | int main(int argc, char **argv) 29 | { 30 | testing::InitGoogleTest(&argc, argv); 31 | return RUN_ALL_TESTS(); 32 | } 33 | -------------------------------------------------------------------------------- /deps/memkind/test/memkind-afts-ext.ts: -------------------------------------------------------------------------------- 1 | /usr/share/mpss/test/memkind-dt/all_tests -a --gtest_filter=-PerformanceTest.* 2 | /usr/share/mpss/test/memkind-dt/decorator_test -a 3 | /usr/share/mpss/test/memkind-dt/gb_page_tests_bind_policy -a 4 | /usr/share/mpss/test/memkind-dt/gb_page_tests_preferred_policy -a 5 | /usr/share/mpss/test/memkind-dt/bat_bind_tests -a 6 | /usr/share/mpss/test/memkind-dt/bat_interleave_tests -a 7 | -------------------------------------------------------------------------------- /deps/memkind/test/memkind-afts.ts: -------------------------------------------------------------------------------- 1 | /usr/share/mpss/test/memkind-dt/all_tests -a --gtest_filter=-PerformanceTest.*:*.*ext* 2 | /usr/share/mpss/test/memkind-dt/decorator_test -a 3 | /usr/share/mpss/test/memkind-dt/gb_page_tests_bind_policy -a --gtest_filter=-*.*ext* 4 | /usr/share/mpss/test/memkind-dt/gb_page_tests_bind_policy -a --gtest_filter=-*.*ext* 5 | /usr/share/mpss/test/memkind-dt/bat_bind_tests -a 6 | /usr/share/mpss/test/memkind-dt/bat_interleave_tests -a 7 | -------------------------------------------------------------------------------- /deps/memkind/test/memkind-perf-ext.ts: -------------------------------------------------------------------------------- 1 | /usr/share/mpss/test/memkind-dt/all_tests -a --gtest_filter=PerformanceTest.* 2 | /usr/share/mpss/test/memkind-dt/allocator_perf_tool_tests -a --gtest_filter=HeapManagerInitPerfTest*:AllocPerformanceTest* 3 | -------------------------------------------------------------------------------- /deps/memkind/test/memkind-perf.ts: -------------------------------------------------------------------------------- 1 | /usr/share/mpss/test/memkind-dt/all_tests -a --gtest_filter=PerformanceTest.* 2 | /usr/share/mpss/test/memkind-dt/allocator_perf_tool_tests -a --gtest_filter=HeapManagerInitPerfTest*:AllocPerformanceTest*:-*.*ext* 3 | -------------------------------------------------------------------------------- /deps/memkind/test/memkind-pytests.ts: -------------------------------------------------------------------------------- 1 | -k "test_TC_MEMKIND_" 2 | -------------------------------------------------------------------------------- /deps/memkind/test/memkind-slts.ts: -------------------------------------------------------------------------------- 1 | /usr/share/mpss/test/memkind-dt/allocator_perf_tool_tests -a --gtest_filter=AllocateToMaxStressTests*:HugePageTest* 2 | -------------------------------------------------------------------------------- /deps/memkind/test/python_framework/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Intel Corporation. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright notice(s), 8 | # this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright notice(s), 10 | # this list of conditions and the following disclaimer in the documentation 11 | # and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS 14 | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 16 | # EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 21 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 22 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | # 24 | 25 | from python_framework.cmd_helper import CMD_helper -------------------------------------------------------------------------------- /deps/update-jemalloc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | VER=$1 3 | URL="http://www.canonware.com/download/jemalloc/jemalloc-${VER}.tar.bz2" 4 | echo "Downloading $URL" 5 | curl $URL > /tmp/jemalloc.tar.bz2 6 | tar xvjf /tmp/jemalloc.tar.bz2 7 | rm -rf jemalloc 8 | mv jemalloc-${VER} jemalloc 9 | echo "Use git status, add all files and commit changes." 10 | -------------------------------------------------------------------------------- /deps/update-pmdk.sh: -------------------------------------------------------------------------------- 1 | cd pmdk 2 | git checkout 1.5-rc1 3 | -------------------------------------------------------------------------------- /runtest: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | TCL_VERSIONS="8.5 8.6" 3 | TCLSH="" 4 | export LD_LIBRARY_PATH=deps/memkind/.libs/ 5 | 6 | export LD_LIBRARY_PATH=deps/memkind/.libs/ 7 | for VERSION in $TCL_VERSIONS; do 8 | TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL 9 | done 10 | 11 | if [ -z $TCLSH ] 12 | then 13 | echo "You need tcl 8.5 or newer in order to run the Redis test" 14 | exit 1 15 | fi 16 | $TCLSH tests/test_helper.tcl $* 17 | -------------------------------------------------------------------------------- /runtest-cluster: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | TCL_VERSIONS="8.5 8.6" 3 | TCLSH="" 4 | 5 | for VERSION in $TCL_VERSIONS; do 6 | TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL 7 | done 8 | 9 | if [ -z $TCLSH ] 10 | then 11 | echo "You need tcl 8.5 or newer in order to run the Redis Sentinel test" 12 | exit 1 13 | fi 14 | $TCLSH tests/cluster/run.tcl $* 15 | -------------------------------------------------------------------------------- /runtest-sentinel: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | TCL_VERSIONS="8.5 8.6" 3 | TCLSH="" 4 | 5 | for VERSION in $TCL_VERSIONS; do 6 | TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL 7 | done 8 | 9 | if [ -z $TCLSH ] 10 | then 11 | echo "You need tcl 8.5 or newer in order to run the Redis Sentinel test" 12 | exit 1 13 | fi 14 | $TCLSH tests/sentinel/run.tcl $* 15 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | *.gcda 2 | *.gcno 3 | *.gcov 4 | redis.info 5 | lcov-html 6 | -------------------------------------------------------------------------------- /src/crc64.h: -------------------------------------------------------------------------------- 1 | #ifndef CRC64_H 2 | #define CRC64_H 3 | 4 | #include 5 | 6 | uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l); 7 | 8 | #ifdef REDIS_TEST 9 | int crc64Test(int argc, char *argv[]); 10 | #endif 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/geo.h: -------------------------------------------------------------------------------- 1 | #ifndef __GEO_H__ 2 | #define __GEO_H__ 3 | 4 | #include "server.h" 5 | 6 | /* Structures used inside geo.c in order to represent points and array of 7 | * points on the earth. */ 8 | typedef struct geoPoint { 9 | double longitude; 10 | double latitude; 11 | double dist; 12 | double score; 13 | char *member; 14 | } geoPoint; 15 | 16 | typedef struct geoArray { 17 | struct geoPoint *array; 18 | size_t buckets; 19 | size_t used; 20 | } geoArray; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/mkreleasehdr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | GIT_SHA1=`(git show-ref --head --hash=8 2> /dev/null || echo 00000000) | head -n1` 3 | GIT_DIRTY=`git diff --no-ext-diff 2> /dev/null | wc -l` 4 | BUILD_ID=`uname -n`"-"`date +%s` 5 | test -f release.h || touch release.h 6 | (cat release.h | grep SHA1 | grep $GIT_SHA1) && \ 7 | (cat release.h | grep DIRTY | grep $GIT_DIRTY) && exit 0 # Already up-to-date 8 | echo "#define REDIS_GIT_SHA1 \"$GIT_SHA1\"" > release.h 9 | echo "#define REDIS_GIT_DIRTY \"$GIT_DIRTY\"" >> release.h 10 | echo "#define REDIS_BUILD_ID \"$BUILD_ID\"" >> release.h 11 | touch release.c # Force recompile of release.c 12 | -------------------------------------------------------------------------------- /src/modules/.gitignore: -------------------------------------------------------------------------------- 1 | *.so 2 | *.xo 3 | -------------------------------------------------------------------------------- /src/modules/Makefile: -------------------------------------------------------------------------------- 1 | 2 | # find the OS 3 | uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') 4 | 5 | # Compile flags for linux / osx 6 | ifeq ($(uname_S),Linux) 7 | SHOBJ_CFLAGS ?= -W -Wall -fno-common -g -ggdb -std=c99 -O2 8 | SHOBJ_LDFLAGS ?= -shared 9 | else 10 | SHOBJ_CFLAGS ?= -W -Wall -dynamic -fno-common -g -ggdb -std=c99 -O2 11 | SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup 12 | endif 13 | 14 | .SUFFIXES: .c .so .xo .o 15 | 16 | all: helloworld.so hellotype.so helloblock.so testmodule.so 17 | 18 | .c.xo: 19 | $(CC) -I. $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC -c $< -o $@ 20 | 21 | helloworld.xo: ../redismodule.h 22 | 23 | helloworld.so: helloworld.xo 24 | $(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc 25 | 26 | hellotype.xo: ../redismodule.h 27 | 28 | hellotype.so: hellotype.xo 29 | $(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc 30 | 31 | helloblock.xo: ../redismodule.h 32 | 33 | helloblock.so: helloblock.xo 34 | $(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lpthread -lc 35 | 36 | testmodule.xo: ../redismodule.h 37 | 38 | testmodule.so: testmodule.xo 39 | $(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc 40 | 41 | clean: 42 | rm -rf *.xo *.so 43 | -------------------------------------------------------------------------------- /src/sha1.h: -------------------------------------------------------------------------------- 1 | #ifndef SHA1_H 2 | #define SHA1_H 3 | /* ================ sha1.h ================ */ 4 | /* 5 | SHA-1 in C 6 | By Steve Reid 7 | 100% Public Domain 8 | */ 9 | 10 | typedef struct { 11 | uint32_t state[5]; 12 | uint32_t count[2]; 13 | unsigned char buffer[64]; 14 | } SHA1_CTX; 15 | 16 | void SHA1Transform(uint32_t state[5], const unsigned char buffer[64]); 17 | void SHA1Init(SHA1_CTX* context); 18 | void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len); 19 | void SHA1Final(unsigned char digest[20], SHA1_CTX* context); 20 | 21 | #ifdef REDIS_TEST 22 | int sha1Test(int argc, char **argv); 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /src/valgrind.sup: -------------------------------------------------------------------------------- 1 | { 2 | 3 | Memcheck:Cond 4 | fun:lzf_compress 5 | } 6 | 7 | { 8 | 9 | Memcheck:Value4 10 | fun:lzf_compress 11 | } 12 | 13 | { 14 | 15 | Memcheck:Value8 16 | fun:lzf_compress 17 | } 18 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | #define REDIS_VERSION "4.0.0" 2 | -------------------------------------------------------------------------------- /tests/assets/default.conf: -------------------------------------------------------------------------------- 1 | # Redis configuration for testing. 2 | 3 | always-show-logo yes 4 | notify-keyspace-events KEA 5 | daemonize no 6 | pidfile /var/run/redis.pid 7 | port 6379 8 | timeout 0 9 | bind 127.0.0.1 10 | loglevel verbose 11 | logfile '' 12 | databases 16 13 | latency-monitor-threshold 1 14 | 15 | save 10 2 16 | save 300 10 17 | save 60 10000 18 | 19 | rdbcompression yes 20 | dbfilename dump.rdb 21 | dir ./ 22 | 23 | slave-serve-stale-data yes 24 | appendonly no 25 | appendfsync everysec 26 | no-appendfsync-on-rewrite no 27 | activerehashing yes 28 | 29 | pointer-based-aof yes 30 | -------------------------------------------------------------------------------- /tests/assets/encodings.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmem/pmem-redis/4b9cf06de20e4010d71b1803bb2348b6543a63da/tests/assets/encodings.rdb -------------------------------------------------------------------------------- /tests/assets/hash-zipmap.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmem/pmem-redis/4b9cf06de20e4010d71b1803bb2348b6543a63da/tests/assets/hash-zipmap.rdb -------------------------------------------------------------------------------- /tests/bkc_scripts/auth_slave.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | ssh-keygen 3 | ssh-copy-id root@192.168.16.100 4 | -------------------------------------------------------------------------------- /tests/bkc_scripts/env_prepare.sh: -------------------------------------------------------------------------------- 1 | echo never > /sys/kernel/mm/transparent_hugepage/enabled 2 | sysctl vm.overcommit_memory=1 3 | sysctl -w net.core.somaxconn=65535 4 | cpupower frequency-set -g performance 5 | echo 3 >/proc/sys/vm/drop_caches 6 | -------------------------------------------------------------------------------- /tests/cce_scipts/aepwatch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | log=$1 3 | kickoff=$2 4 | if [ $kickoff = 1 ]; then 5 | source /home/dennis/AEPWatch_1.1.0_linux_package/AEPWatch_1.1.0/aep_vars.sh 6 | echo "AEPWatch 1 > $log &" 7 | AEPWatch 1 > $log & 8 | else 9 | source /home/dennis/AEPWatch_1.1.0_linux_package/AEPWatch_1.1.0/aep_vars.sh 10 | AEPWatch-stop 11 | fi 12 | -------------------------------------------------------------------------------- /tests/cce_scipts/create_aep_file.sh: -------------------------------------------------------------------------------- 1 | size=$1 2 | inst=$2 3 | port_start=$3 4 | aep_device=$4 5 | for i in `seq $inst`; 6 | do 7 | port=$((port_start+i)) 8 | touch ${aep_device}/redis-port-${port}-${size}GB-AEP & 9 | done 10 | 11 | waitforcpdone() { 12 | while true 13 | do 14 | ret=`ps aux | grep -v grep | grep "cp /mnt/pmem"|wc -l` 15 | if [ $ret == 0 ]; then 16 | echo "completed! " 17 | break 18 | fi 19 | sleep 1 20 | done 21 | } 22 | 23 | waitforcpdone 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/cce_scipts/emon.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ret=`ps aux | grep -v grep | grep "emon -i /home/dennis/emon/skx-2s-events.txt"|wc -l` 3 | if [ $ret == 0 ]; then 4 | /home/dennis/emon/sepdk/src/rmmod-sep 5 | /home/dennis/emon/sepdk/src/insmod-sep 6 | echo "/home/dennis/emon/bin64/emon -i /home/dennis/emon/skx-2s-events.txt > $1 &" 7 | /home/dennis/emon/bin64/emon -i /home/dennis/emon/skx-2s-events.txt > $1 & 8 | fi 9 | -------------------------------------------------------------------------------- /tests/cce_scipts/run_parse.sh: -------------------------------------------------------------------------------- 1 | ./parse.sh conf4_a 2 | -------------------------------------------------------------------------------- /tests/cce_scipts/run_redis.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #./auto_redis_a.sh append_4 3 | ./auto_redis.sh refresh_ad 4 | ./auto_redis.sh refresh_dram 5 | 6 | -------------------------------------------------------------------------------- /tests/cce_scipts/zero-out.sh: -------------------------------------------------------------------------------- 1 | size=$1 2 | aep_device=$2 3 | num=$((size*1024)) 4 | for i in `ls $aep_device` 5 | do 6 | dd if=/dev/zero of=${aep_device}/$i bs=1024k count=$num & 7 | done 8 | 9 | waitforzerooutdone() { 10 | while true 11 | do 12 | ret=`ps aux | grep -v grep | grep "dd if=/dev/zero"|wc -l` 13 | if [ $ret == 0 ]; then 14 | echo "completed! " 15 | break 16 | fi 17 | sleep 1 18 | done 19 | } 20 | 21 | waitforzerooutdone 22 | -------------------------------------------------------------------------------- /tests/cluster/run.tcl: -------------------------------------------------------------------------------- 1 | # Cluster test suite. Copyright (C) 2014 Salvatore Sanfilippo antirez@gmail.com 2 | # This software is released under the BSD License. See the COPYING file for 3 | # more information. 4 | 5 | cd tests/cluster 6 | source cluster.tcl 7 | source ../instances.tcl 8 | source ../../support/cluster.tcl ; # Redis Cluster client. 9 | 10 | set ::instances_count 20 ; # How many instances we use at max. 11 | 12 | proc main {} { 13 | parse_options 14 | spawn_instance redis $::redis_base_port $::instances_count { 15 | "cluster-enabled yes" 16 | "appendonly yes" 17 | } 18 | run_tests 19 | cleanup 20 | end_tests 21 | } 22 | 23 | if {[catch main e]} { 24 | puts $::errorInfo 25 | if {$::pause_on_error} pause_on_error 26 | cleanup 27 | exit 1 28 | } 29 | -------------------------------------------------------------------------------- /tests/cluster/tests/01-faildet.tcl: -------------------------------------------------------------------------------- 1 | # Check the basic monitoring and failover capabilities. 2 | 3 | source "../tests/includes/init-tests.tcl" 4 | 5 | test "Create a 5 nodes cluster" { 6 | create_cluster 5 5 7 | } 8 | 9 | test "Cluster should start ok" { 10 | assert_cluster_state ok 11 | } 12 | 13 | test "Killing two slave nodes" { 14 | kill_instance redis 5 15 | kill_instance redis 6 16 | } 17 | 18 | test "Cluster should be still up" { 19 | assert_cluster_state ok 20 | } 21 | 22 | test "Killing one master node" { 23 | kill_instance redis 0 24 | } 25 | 26 | # Note: the only slave of instance 0 is already down so no 27 | # failover is possible, that would change the state back to ok. 28 | test "Cluster should be down now" { 29 | assert_cluster_state fail 30 | } 31 | 32 | test "Restarting master node" { 33 | restart_instance redis 0 34 | } 35 | 36 | test "Cluster should be up again" { 37 | assert_cluster_state ok 38 | } 39 | -------------------------------------------------------------------------------- /tests/cluster/tests/02-failover.tcl: -------------------------------------------------------------------------------- 1 | # Check the basic monitoring and failover capabilities. 2 | 3 | source "../tests/includes/init-tests.tcl" 4 | 5 | test "Create a 5 nodes cluster" { 6 | create_cluster 5 5 7 | } 8 | 9 | test "Cluster is up" { 10 | assert_cluster_state ok 11 | } 12 | 13 | test "Cluster is writable" { 14 | cluster_write_test 0 15 | } 16 | 17 | test "Instance #5 is a slave" { 18 | assert {[RI 5 role] eq {slave}} 19 | } 20 | 21 | test "Instance #5 synced with the master" { 22 | wait_for_condition 1000 50 { 23 | [RI 5 master_link_status] eq {up} 24 | } else { 25 | fail "Instance #5 master link status is not up" 26 | } 27 | } 28 | 29 | set current_epoch [CI 1 cluster_current_epoch] 30 | 31 | test "Killing one master node" { 32 | kill_instance redis 0 33 | } 34 | 35 | test "Wait for failover" { 36 | wait_for_condition 1000 50 { 37 | [CI 1 cluster_current_epoch] > $current_epoch 38 | } else { 39 | fail "No failover detected" 40 | } 41 | } 42 | 43 | test "Cluster should eventually be up again" { 44 | assert_cluster_state ok 45 | } 46 | 47 | test "Cluster is writable" { 48 | cluster_write_test 1 49 | } 50 | 51 | test "Instance #5 is now a master" { 52 | assert {[RI 5 role] eq {master}} 53 | } 54 | 55 | test "Restarting the previously killed master node" { 56 | restart_instance redis 0 57 | } 58 | 59 | test "Instance #0 gets converted into a slave" { 60 | wait_for_condition 1000 50 { 61 | [RI 0 role] eq {slave} 62 | } else { 63 | fail "Old master was not converted into slave" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/cluster/tests/09-pubsub.tcl: -------------------------------------------------------------------------------- 1 | # Test PUBLISH propagation across the cluster. 2 | 3 | source "../tests/includes/init-tests.tcl" 4 | 5 | test "Create a 5 nodes cluster" { 6 | create_cluster 5 5 7 | } 8 | 9 | proc test_cluster_publish {instance instances} { 10 | # Subscribe all the instances but the one we use to send. 11 | for {set j 0} {$j < $instances} {incr j} { 12 | if {$j != $instance} { 13 | R $j deferred 1 14 | R $j subscribe testchannel 15 | R $j read; # Read the subscribe reply 16 | } 17 | } 18 | 19 | set data [randomValue] 20 | R $instance PUBLISH testchannel $data 21 | 22 | # Read the message back from all the nodes. 23 | for {set j 0} {$j < $instances} {incr j} { 24 | if {$j != $instance} { 25 | set msg [R $j read] 26 | assert {$data eq [lindex $msg 2]} 27 | R $j unsubscribe testchannel 28 | R $j read; # Read the unsubscribe reply 29 | R $j deferred 0 30 | } 31 | } 32 | } 33 | 34 | test "Test publishing to master" { 35 | test_cluster_publish 0 10 36 | } 37 | 38 | test "Test publishing to slave" { 39 | test_cluster_publish 5 10 40 | } 41 | -------------------------------------------------------------------------------- /tests/cluster/tests/11-manual-takeover.tcl: -------------------------------------------------------------------------------- 1 | # Manual takeover test 2 | 3 | source "../tests/includes/init-tests.tcl" 4 | 5 | test "Create a 5 nodes cluster" { 6 | create_cluster 5 5 7 | } 8 | 9 | test "Cluster is up" { 10 | assert_cluster_state ok 11 | } 12 | 13 | test "Cluster is writable" { 14 | cluster_write_test 0 15 | } 16 | 17 | test "Killing majority of master nodes" { 18 | kill_instance redis 0 19 | kill_instance redis 1 20 | kill_instance redis 2 21 | } 22 | 23 | test "Cluster should eventually be down" { 24 | assert_cluster_state fail 25 | } 26 | 27 | test "Use takeover to bring slaves back" { 28 | R 5 cluster failover takeover 29 | R 6 cluster failover takeover 30 | R 7 cluster failover takeover 31 | } 32 | 33 | test "Cluster should eventually be up again" { 34 | assert_cluster_state ok 35 | } 36 | 37 | test "Cluster is writable" { 38 | cluster_write_test 4 39 | } 40 | 41 | test "Instance #5, #6, #7 are now masters" { 42 | assert {[RI 5 role] eq {master}} 43 | assert {[RI 6 role] eq {master}} 44 | assert {[RI 7 role] eq {master}} 45 | } 46 | 47 | test "Restarting the previously killed master nodes" { 48 | restart_instance redis 0 49 | restart_instance redis 1 50 | restart_instance redis 2 51 | } 52 | 53 | test "Instance #0, #1, #2 gets converted into a slaves" { 54 | wait_for_condition 1000 50 { 55 | [RI 0 role] eq {slave} && [RI 1 role] eq {slave} && [RI 2 role] eq {slave} 56 | } else { 57 | fail "Old masters not converted into slaves" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /tests/cluster/tests/helpers/onlydots.tcl: -------------------------------------------------------------------------------- 1 | # Read the standard input and only shows dots in the output, filtering out 2 | # all the other characters. Designed to avoid bufferization so that when 3 | # we get the output of redis-trib and want to show just the dots, we'll see 4 | # the dots as soon as redis-trib will output them. 5 | 6 | fconfigure stdin -buffering none 7 | 8 | while 1 { 9 | set c [read stdin 1] 10 | if {$c eq {}} { 11 | exit 0; # EOF 12 | } elseif {$c eq {.}} { 13 | puts -nonewline . 14 | flush stdout 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/cluster/tmp/.gitignore: -------------------------------------------------------------------------------- 1 | redis_* 2 | sentinel_* 3 | -------------------------------------------------------------------------------- /tests/helpers/bg_complex_data.tcl: -------------------------------------------------------------------------------- 1 | source tests/support/redis.tcl 2 | source tests/support/util.tcl 3 | 4 | proc bg_complex_data {host port db ops} { 5 | set r [redis $host $port] 6 | $r select $db 7 | createComplexDataset $r $ops 8 | } 9 | 10 | bg_complex_data [lindex $argv 0] [lindex $argv 1] [lindex $argv 2] [lindex $argv 3] 11 | -------------------------------------------------------------------------------- /tests/helpers/gen_write_load.tcl: -------------------------------------------------------------------------------- 1 | source tests/support/redis.tcl 2 | 3 | proc gen_write_load {host port seconds} { 4 | set start_time [clock seconds] 5 | set r [redis $host $port 1] 6 | $r select 9 7 | while 1 { 8 | $r set [expr rand()] [expr rand()] 9 | if {[clock seconds]-$start_time > $seconds} { 10 | exit 0 11 | } 12 | } 13 | } 14 | 15 | gen_write_load [lindex $argv 0] [lindex $argv 1] [lindex $argv 2] 16 | -------------------------------------------------------------------------------- /tests/integration/aof-race.tcl: -------------------------------------------------------------------------------- 1 | set defaults { appendonly {yes} appendfilename {appendonly.aof} } 2 | set server_path [tmpdir server.aof] 3 | set aof_path "$server_path/appendonly.aof" 4 | 5 | proc start_server_aof {overrides code} { 6 | upvar defaults defaults srv srv server_path server_path 7 | set config [concat $defaults $overrides] 8 | start_server [list overrides $config] $code 9 | } 10 | 11 | tags {"aof"} { 12 | # Specific test for a regression where internal buffers were not properly 13 | # cleaned after a child responsible for an AOF rewrite exited. This buffer 14 | # was subsequently appended to the new AOF, resulting in duplicate commands. 15 | start_server_aof [list dir $server_path] { 16 | set client [redis [srv host] [srv port]] 17 | set bench [open "|src/redis-benchmark -q -p [srv port] -c 20 -n 20000 incr foo" "r+"] 18 | after 100 19 | 20 | # Benchmark should be running by now: start background rewrite 21 | $client bgrewriteaof 22 | 23 | # Read until benchmark pipe reaches EOF 24 | while {[string length [read $bench]] > 0} {} 25 | 26 | # Check contents of foo 27 | assert_equal 20000 [$client get foo] 28 | } 29 | 30 | # Restart server to replay AOF 31 | start_server_aof [list dir $server_path] { 32 | set client [redis [srv host] [srv port]] 33 | assert_equal 20000 [$client get foo] 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/integration/convert-zipmap-hash-on-load.tcl: -------------------------------------------------------------------------------- 1 | # Copy RDB with zipmap encoded hash to server path 2 | set server_path [tmpdir "server.convert-zipmap-hash-on-load"] 3 | 4 | exec cp -f tests/assets/hash-zipmap.rdb $server_path 5 | start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb"]] { 6 | test "RDB load zipmap hash: converts to ziplist" { 7 | r select 0 8 | 9 | assert_match "*ziplist*" [r debug object hash] 10 | assert_equal 2 [r hlen hash] 11 | assert_match {v1 v2} [r hmget hash f1 f2] 12 | } 13 | } 14 | 15 | exec cp -f tests/assets/hash-zipmap.rdb $server_path 16 | start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb" "hash-max-ziplist-entries" 1]] { 17 | test "RDB load zipmap hash: converts to hash table when hash-max-ziplist-entries is exceeded" { 18 | r select 0 19 | 20 | assert_match "*hashtable*" [r debug object hash] 21 | assert_equal 2 [r hlen hash] 22 | assert_match {v1 v2} [r hmget hash f1 f2] 23 | } 24 | } 25 | 26 | exec cp -f tests/assets/hash-zipmap.rdb $server_path 27 | start_server [list overrides [list "dir" $server_path "dbfilename" "hash-zipmap.rdb" "hash-max-ziplist-value" 1]] { 28 | test "RDB load zipmap hash: converts to hash table when hash-max-ziplist-value is exceeded" { 29 | r select 0 30 | 31 | assert_match "*hashtable*" [r debug object hash] 32 | assert_equal 2 [r hlen hash] 33 | assert_match {v1 v2} [r hmget hash f1 f2] 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/integration/logging.tcl: -------------------------------------------------------------------------------- 1 | set server_path [tmpdir server.log] 2 | set system_name [string tolower [exec uname -s]] 3 | 4 | if {$system_name eq {linux} || $system_name eq {darwin}} { 5 | start_server [list overrides [list dir $server_path]] { 6 | test "Server is able to generate a stack trace on selected systems" { 7 | r config set watchdog-period 200 8 | r debug sleep 1 9 | set pattern "*debugCommand*" 10 | set retry 10 11 | while {$retry} { 12 | set result [exec tail -100 < [srv 0 stdout]] 13 | if {[string match $pattern $result]} { 14 | break 15 | } 16 | incr retry -1 17 | after 1000 18 | } 19 | if {$retry == 0} { 20 | error "assertion:expected stack trace not found into log file" 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/py-tests/list_stress.py: -------------------------------------------------------------------------------- 1 | import redis 2 | import random 3 | 4 | def connect_server(host, port): 5 | pool = redis.ConnectionPool(host = host, port = port, decode_responses = True) 6 | server = redis.Redis(connection_pool = pool) 7 | return server 8 | 9 | server = connect_server('localhost', 6379) 10 | 11 | server.flushall() 12 | 13 | for i in range(100000): 14 | op = random.randint(0, 5) 15 | small_signed_count = random.randint(-4, 5) 16 | if random.randint(0, 1) == 0: 17 | ele = random.randint(0, 999) 18 | else: 19 | ele = 'x' * random.randint(0, 99) + str(random.randint(0, 999)) 20 | try: 21 | if op == 0: 22 | server.lpush('key', ele) 23 | elif op == 1: 24 | server.rpush('key', ele) 25 | elif op == 2: 26 | server.lpop('key') 27 | elif op == 3: 28 | server.rpop('key') 29 | elif op == 4: 30 | server.lset('key', small_signed_count, ele) 31 | elif op == 5: 32 | otherele = random.randint(0, 999) 33 | if random.randint(0, 1) == 0: 34 | where = 'before' 35 | else: 36 | where = 'after' 37 | server.linsert('key', where, otherele, ele) 38 | except redis.exceptions.ResponseError: 39 | pass 40 | 41 | -------------------------------------------------------------------------------- /tests/sentinel/run.tcl: -------------------------------------------------------------------------------- 1 | # Sentinel test suite. Copyright (C) 2014 Salvatore Sanfilippo antirez@gmail.com 2 | # This software is released under the BSD License. See the COPYING file for 3 | # more information. 4 | 5 | cd tests/sentinel 6 | source ../instances.tcl 7 | 8 | set ::instances_count 5 ; # How many instances we use at max. 9 | 10 | proc main {} { 11 | parse_options 12 | spawn_instance sentinel $::sentinel_base_port $::instances_count 13 | spawn_instance redis $::redis_base_port $::instances_count 14 | run_tests 15 | cleanup 16 | end_tests 17 | } 18 | 19 | if {[catch main e]} { 20 | puts $::errorInfo 21 | cleanup 22 | exit 1 23 | } 24 | -------------------------------------------------------------------------------- /tests/sentinel/tests/01-conf-update.tcl: -------------------------------------------------------------------------------- 1 | # Test Sentinel configuration consistency after partitions heal. 2 | 3 | source "../tests/includes/init-tests.tcl" 4 | 5 | test "We can failover with Sentinel 1 crashed" { 6 | set old_port [RI $master_id tcp_port] 7 | set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 8 | assert {[lindex $addr 1] == $old_port} 9 | 10 | # Crash Sentinel 1 11 | kill_instance sentinel 1 12 | 13 | kill_instance redis $master_id 14 | foreach_sentinel_id id { 15 | if {$id != 1} { 16 | wait_for_condition 1000 50 { 17 | [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port 18 | } else { 19 | fail "Sentinel $id did not received failover info" 20 | } 21 | } 22 | } 23 | restart_instance redis $master_id 24 | set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 25 | set master_id [get_instance_id_by_port redis [lindex $addr 1]] 26 | } 27 | 28 | test "After Sentinel 1 is restarted, its config gets updated" { 29 | restart_instance sentinel 1 30 | wait_for_condition 1000 50 { 31 | [lindex [S 1 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port 32 | } else { 33 | fail "Restarted Sentinel did not received failover info" 34 | } 35 | } 36 | 37 | test "New master [join $addr {:}] role matches" { 38 | assert {[RI $master_id role] eq {master}} 39 | } 40 | -------------------------------------------------------------------------------- /tests/sentinel/tests/03-runtime-reconf.tcl: -------------------------------------------------------------------------------- 1 | # Test runtime reconfiguration command SENTINEL SET. 2 | -------------------------------------------------------------------------------- /tests/sentinel/tests/04-slave-selection.tcl: -------------------------------------------------------------------------------- 1 | # Test slave selection algorithm. 2 | # 3 | # This unit should test: 4 | # 1) That when there are no suitable slaves no failover is performed. 5 | # 2) That among the available slaves, the one with better offset is picked. 6 | -------------------------------------------------------------------------------- /tests/sentinel/tests/05-manual.tcl: -------------------------------------------------------------------------------- 1 | # Test manual failover 2 | 3 | source "../tests/includes/init-tests.tcl" 4 | 5 | test "Manual failover works" { 6 | set old_port [RI $master_id tcp_port] 7 | set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 8 | assert {[lindex $addr 1] == $old_port} 9 | catch {S 0 SENTINEL FAILOVER mymaster} reply 10 | assert {$reply eq "OK"} 11 | foreach_sentinel_id id { 12 | wait_for_condition 1000 50 { 13 | [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port 14 | } else { 15 | fail "At least one Sentinel did not received failover info" 16 | } 17 | } 18 | set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 19 | set master_id [get_instance_id_by_port redis [lindex $addr 1]] 20 | } 21 | 22 | test "New master [join $addr {:}] role matches" { 23 | assert {[RI $master_id role] eq {master}} 24 | } 25 | 26 | test "All the other slaves now point to the new master" { 27 | foreach_redis_id id { 28 | if {$id != $master_id && $id != 0} { 29 | wait_for_condition 1000 50 { 30 | [RI $id master_port] == [lindex $addr 1] 31 | } else { 32 | fail "Redis ID $id not configured to replicate with new master" 33 | } 34 | } 35 | } 36 | } 37 | 38 | test "The old master eventually gets reconfigured as a slave" { 39 | wait_for_condition 1000 50 { 40 | [RI 0 master_port] == [lindex $addr 1] 41 | } else { 42 | fail "Old master not reconfigured as slave of new master" 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /tests/sentinel/tests/06-ckquorum.tcl: -------------------------------------------------------------------------------- 1 | # Test for the SENTINEL CKQUORUM command 2 | 3 | source "../tests/includes/init-tests.tcl" 4 | set num_sentinels [llength $::sentinel_instances] 5 | 6 | test "CKQUORUM reports OK and the right amount of Sentinels" { 7 | foreach_sentinel_id id { 8 | assert_match "*OK $num_sentinels usable*" [S $id SENTINEL CKQUORUM mymaster] 9 | } 10 | } 11 | 12 | test "CKQUORUM detects quorum cannot be reached" { 13 | set orig_quorum [expr {$num_sentinels/2+1}] 14 | S 0 SENTINEL SET mymaster quorum [expr {$num_sentinels+1}] 15 | catch {[S 0 SENTINEL CKQUORUM mymaster]} err 16 | assert_match "*NOQUORUM*" $err 17 | S 0 SENTINEL SET mymaster quorum $orig_quorum 18 | } 19 | 20 | test "CKQUORUM detects failover authorization cannot be reached" { 21 | set orig_quorum [expr {$num_sentinels/2+1}] 22 | S 0 SENTINEL SET mymaster quorum 1 23 | kill_instance sentinel 1 24 | kill_instance sentinel 2 25 | kill_instance sentinel 3 26 | after 5000 27 | catch {[S 0 SENTINEL CKQUORUM mymaster]} err 28 | assert_match "*NOQUORUM*" $err 29 | S 0 SENTINEL SET mymaster quorum $orig_quorum 30 | restart_instance sentinel 1 31 | restart_instance sentinel 2 32 | restart_instance sentinel 3 33 | } 34 | 35 | -------------------------------------------------------------------------------- /tests/sentinel/tmp/.gitignore: -------------------------------------------------------------------------------- 1 | redis_* 2 | sentinel_* 3 | -------------------------------------------------------------------------------- /tests/support/tmpfile.tcl: -------------------------------------------------------------------------------- 1 | set ::tmpcounter 0 2 | set ::tmproot "./tests/tmp" 3 | file mkdir $::tmproot 4 | 5 | # returns a dirname unique to this process to write to 6 | proc tmpdir {basename} { 7 | set dir [file join $::tmproot $basename.[pid].[incr ::tmpcounter]] 8 | file mkdir $dir 9 | set _ $dir 10 | } 11 | 12 | # return a filename unique to this process to write to 13 | proc tmpfile {basename} { 14 | file join $::tmproot $basename.[pid].[incr ::tmpcounter] 15 | } 16 | -------------------------------------------------------------------------------- /tests/unit/auth.tcl: -------------------------------------------------------------------------------- 1 | start_server {tags {"auth"}} { 2 | test {AUTH fails if there is no password configured server side} { 3 | catch {r auth foo} err 4 | set _ $err 5 | } {ERR*no password*} 6 | } 7 | 8 | start_server {tags {"auth"} overrides {requirepass foobar}} { 9 | test {AUTH fails when a wrong password is given} { 10 | catch {r auth wrong!} err 11 | set _ $err 12 | } {ERR*invalid password} 13 | 14 | test {Arbitrary command gives an error when AUTH is required} { 15 | catch {r set foo bar} err 16 | set _ $err 17 | } {NOAUTH*} 18 | 19 | test {AUTH succeeds when the right password is given} { 20 | r auth foobar 21 | } {OK} 22 | 23 | test {Once AUTH succeeded we can actually send commands to the server} { 24 | r set foo 100 25 | r incr foo 26 | } {101} 27 | } 28 | -------------------------------------------------------------------------------- /tests/unit/introspection-2.tcl: -------------------------------------------------------------------------------- 1 | start_server {tags {"introspection"}} { 2 | test {TTL and TYPYE do not alter the last access time of a key} { 3 | r set foo bar 4 | after 3000 5 | r ttl foo 6 | r type foo 7 | assert {[r object idletime foo] >= 2} 8 | } 9 | 10 | test {TOUCH alters the last access time of a key} { 11 | r set foo bar 12 | after 3000 13 | r touch foo 14 | assert {[r object idletime foo] < 2} 15 | } 16 | 17 | test {TOUCH returns the number of existing keys specified} { 18 | r flushdb 19 | r set key1 1 20 | r set key2 2 21 | r touch key0 key1 key2 key3 22 | } 2 23 | } 24 | -------------------------------------------------------------------------------- /tests/unit/lazyfree.tcl: -------------------------------------------------------------------------------- 1 | start_server {tags {"lazyfree"}} { 2 | test "UNLINK can reclaim memory in background" { 3 | set orig_mem [s used_memory] 4 | set args {} 5 | for {set i 0} {$i < 100000} {incr i} { 6 | lappend args $i 7 | } 8 | r sadd myset {*}$args 9 | assert {[r scard myset] == 100000} 10 | set peak_mem [s used_memory] 11 | assert {[r unlink myset] == 1} 12 | assert {$peak_mem > $orig_mem+1000000} 13 | wait_for_condition 50 100 { 14 | [s used_memory] < $peak_mem && 15 | [s used_memory] < $orig_mem*2 16 | } else { 17 | fail "Memory is not reclaimed by UNLINK" 18 | } 19 | } 20 | 21 | test "FLUSHDB ASYNC can reclaim memory in background" { 22 | set orig_mem [s used_memory] 23 | set args {} 24 | for {set i 0} {$i < 100000} {incr i} { 25 | lappend args $i 26 | } 27 | r sadd myset {*}$args 28 | assert {[r scard myset] == 100000} 29 | set peak_mem [s used_memory] 30 | r flushdb async 31 | assert {$peak_mem > $orig_mem+1000000} 32 | wait_for_condition 50 100 { 33 | [s used_memory] < $peak_mem && 34 | [s used_memory] < $orig_mem*2 35 | } else { 36 | fail "Memory is not reclaimed by FLUSHDB ASYNC" 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/unit/limits.tcl: -------------------------------------------------------------------------------- 1 | start_server {tags {"limits"} overrides {maxclients 10}} { 2 | test {Check if maxclients works refusing connections} { 3 | set c 0 4 | catch { 5 | while {$c < 50} { 6 | incr c 7 | set rd [redis_deferring_client] 8 | $rd ping 9 | $rd read 10 | after 100 11 | } 12 | } e 13 | assert {$c > 8 && $c <= 10} 14 | set e 15 | } {*ERR max*reached*} 16 | } 17 | -------------------------------------------------------------------------------- /tests/unit/printver.tcl: -------------------------------------------------------------------------------- 1 | start_server {} { 2 | set i [r info] 3 | regexp {redis_version:(.*?)\r\n} $i - version 4 | regexp {redis_git_sha1:(.*?)\r\n} $i - sha1 5 | puts "Testing Redis version $version ($sha1)" 6 | } 7 | -------------------------------------------------------------------------------- /tests/unit/quit.tcl: -------------------------------------------------------------------------------- 1 | start_server {tags {"quit"}} { 2 | proc format_command {args} { 3 | set cmd "*[llength $args]\r\n" 4 | foreach a $args { 5 | append cmd "$[string length $a]\r\n$a\r\n" 6 | } 7 | set _ $cmd 8 | } 9 | 10 | test "QUIT returns OK" { 11 | reconnect 12 | assert_equal OK [r quit] 13 | assert_error * {r ping} 14 | } 15 | 16 | test "Pipelined commands after QUIT must not be executed" { 17 | reconnect 18 | r write [format_command quit] 19 | r write [format_command set foo bar] 20 | r flush 21 | assert_equal OK [r read] 22 | assert_error * {r read} 23 | 24 | reconnect 25 | assert_equal {} [r get foo] 26 | } 27 | 28 | test "Pipelined commands after QUIT that exceed read buffer size" { 29 | reconnect 30 | r write [format_command quit] 31 | r write [format_command set foo [string repeat "x" 1024]] 32 | r flush 33 | assert_equal OK [r read] 34 | assert_error * {r read} 35 | 36 | reconnect 37 | assert_equal {} [r get foo] 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/unit/type/list-common.tcl: -------------------------------------------------------------------------------- 1 | # We need a value larger than list-max-ziplist-value to make sure 2 | # the list has the right encoding when it is swapped in again. 3 | array set largevalue {} 4 | set largevalue(ziplist) "hello" 5 | set largevalue(linkedlist) [string repeat "hello" 4] 6 | -------------------------------------------------------------------------------- /tests/unit/wait.tcl: -------------------------------------------------------------------------------- 1 | start_server {tags {"wait"}} { 2 | start_server {} { 3 | set slave [srv 0 client] 4 | set slave_host [srv 0 host] 5 | set slave_port [srv 0 port] 6 | set master [srv -1 client] 7 | set master_host [srv -1 host] 8 | set master_port [srv -1 port] 9 | 10 | test {Setup slave} { 11 | $slave slaveof $master_host $master_port 12 | wait_for_condition 50 100 { 13 | [s 0 master_link_status] eq {up} 14 | } else { 15 | fail "Replication not started." 16 | } 17 | } 18 | 19 | test {WAIT should acknowledge 1 additional copy of the data} { 20 | $master set foo 0 21 | $master incr foo 22 | $master incr foo 23 | $master incr foo 24 | assert {[$master wait 1 5000] == 1} 25 | assert {[$slave get foo] == 3} 26 | } 27 | 28 | test {WAIT should not acknowledge 2 additional copies of the data} { 29 | $master incr foo 30 | assert {[$master wait 2 1000] <= 1} 31 | } 32 | 33 | test {WAIT should not acknowledge 1 additional copy if slave is blocked} { 34 | exec src/redis-cli -h $slave_host -p $slave_port debug sleep 5 > /dev/null 2> /dev/null & 35 | after 1000 ;# Give redis-cli the time to execute the command. 36 | $master set foo 0 37 | $master incr foo 38 | $master incr foo 39 | $master incr foo 40 | assert {[$master wait 1 3000] == 0} 41 | } 42 | }} 43 | -------------------------------------------------------------------------------- /utils/build-static-symbols.tcl: -------------------------------------------------------------------------------- 1 | # Build a symbol table for static symbols of redis.c 2 | # Useful to get stack traces on segfault without a debugger. See redis.c 3 | # for more information. 4 | # 5 | # Copyright(C) 2009 Salvatore Sanfilippo, under the BSD license. 6 | 7 | set fd [open redis.c] 8 | set symlist {} 9 | while {[gets $fd line] != -1} { 10 | if {[regexp {^static +[A-z0-9]+[ *]+([A-z0-9]*)\(} $line - sym]} { 11 | lappend symlist $sym 12 | } 13 | } 14 | set symlist [lsort -unique $symlist] 15 | puts "static struct redisFunctionSym symsTable\[\] = {" 16 | foreach sym $symlist { 17 | puts "{\"$sym\",(unsigned long)$sym}," 18 | } 19 | puts "{NULL,0}" 20 | puts "};" 21 | 22 | close $fd 23 | -------------------------------------------------------------------------------- /utils/cluster_fail_time.tcl: -------------------------------------------------------------------------------- 1 | # This simple script is used in order to estimate the average PFAIL->FAIL 2 | # state switch after a failure. 3 | 4 | set ::sleep_time 10 ; # How much to sleep to trigger PFAIL. 5 | set ::fail_port 30016 ; # Node to put in sleep. 6 | set ::other_port 30001 ; # Node to use to monitor the flag switch. 7 | 8 | proc avg vector { 9 | set sum 0.0 10 | foreach x $vector { 11 | set sum [expr {$sum+$x}] 12 | } 13 | expr {$sum/[llength $vector]} 14 | } 15 | 16 | set samples {} 17 | while 1 { 18 | exec redis-cli -p $::fail_port debug sleep $::sleep_time > /dev/null & 19 | 20 | # Wait for fail? to appear. 21 | while 1 { 22 | set output [exec redis-cli -p $::other_port cluster nodes] 23 | if {[string match {*fail\?*} $output]} break 24 | after 100 25 | } 26 | 27 | puts "FAIL?" 28 | set start [clock milliseconds] 29 | 30 | # Wait for fail? to disappear. 31 | while 1 { 32 | set output [exec redis-cli -p $::other_port cluster nodes] 33 | if {![string match {*fail\?*} $output]} break 34 | after 100 35 | } 36 | 37 | puts "FAIL" 38 | set now [clock milliseconds] 39 | set elapsed [expr {$now-$start}] 40 | puts $elapsed 41 | lappend samples $elapsed 42 | 43 | puts "AVG([llength $samples]): [avg $samples]" 44 | 45 | # Wait for the instance to be available again. 46 | exec redis-cli -p $::fail_port ping 47 | 48 | # Wait for the fail flag to be cleared. 49 | after 2000 50 | } 51 | -------------------------------------------------------------------------------- /utils/corrupt_rdb.c: -------------------------------------------------------------------------------- 1 | /* Trivia program to corrupt an RDB file in order to check the RDB check 2 | * program behavior and effectiveness. 3 | * 4 | * Copyright (C) 2016 Salvatore Sanfilippo. 5 | * This software is released in the 3-clause BSD license. */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | int main(int argc, char **argv) { 15 | struct stat stat; 16 | int fd, cycles; 17 | 18 | if (argc != 3) { 19 | fprintf(stderr,"Usage: \n"); 20 | exit(1); 21 | } 22 | 23 | srand(time(NULL)); 24 | cycles = atoi(argv[2]); 25 | fd = open("dump.rdb",O_RDWR); 26 | if (fd == -1) { 27 | perror("open"); 28 | exit(1); 29 | } 30 | fstat(fd,&stat); 31 | 32 | while(cycles--) { 33 | unsigned char buf[32]; 34 | unsigned long offset = rand()%stat.st_size; 35 | int writelen = 1+rand()%31; 36 | int j; 37 | 38 | for (j = 0; j < writelen; j++) buf[j] = (char)rand(); 39 | lseek(fd,offset,SEEK_SET); 40 | printf("Writing %d bytes at offset %lu\n", writelen, offset); 41 | write(fd,buf,writelen); 42 | } 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /utils/create-cluster/.gitignore: -------------------------------------------------------------------------------- 1 | config.sh 2 | *.rdb 3 | *.aof 4 | *.conf 5 | *.log 6 | -------------------------------------------------------------------------------- /utils/create-cluster/README: -------------------------------------------------------------------------------- 1 | Create-custer is a small script used to easily start a big number of Redis 2 | instances configured to run in cluster mode. Its main goal is to allow manual 3 | testing in a condition which is not easy to replicate with the Redis cluster 4 | unit tests, for example when a lot of instances are needed in order to trigger 5 | a given bug. 6 | 7 | The tool can also be used just to easily create a number of instances in a 8 | Redis Cluster in order to experiment a bit with the system. 9 | 10 | USAGE 11 | --- 12 | 13 | To create a cluster, follow these steps: 14 | 15 | 1. Edit create-cluster and change the start / end port, depending on the 16 | number of instances you want to create. 17 | 2. Use "./create-cluster start" in order to run the instances. 18 | 3. Use "./create-cluster create" in order to execute redis-trib create, so that 19 | an actual Redis cluster will be created. 20 | 4. Now you are ready to play with the cluster. AOF files and logs for each instances are created in the current directory. 21 | 22 | In order to stop a cluster: 23 | 24 | 1. Use "./create-cluster stop" to stop all the instances. After you stopped the instances you can use "./create-cluster start" to restart them if you change your mind. 25 | 2. Use "./create-cluster clean" to remove all the AOF / log files to restart with a clean environment. 26 | 27 | Use the command "./create-cluster help" to get the full list of features. 28 | -------------------------------------------------------------------------------- /utils/graphs/commits-over-time/README.md: -------------------------------------------------------------------------------- 1 | This Tcl script is what I used in order to generate the graph you 2 | can find at http://antirez.com/news/98. It's really quick & dirty, more 3 | a trow away program than anything else, but probably could be reused or 4 | modified in the future in order to visualize other similar data or an 5 | updated version of the same data. 6 | 7 | The usage is trivial: 8 | 9 | ./genhtml.tcl > output.html 10 | 11 | The generated HTML is quite broken but good enough to grab a screenshot 12 | from the browser. Feel free to improve it if you got time / interest. 13 | 14 | Note that the code filtering the tags, and the hardcoded branch name, does 15 | not make the script, as it is, able to analyze a different repository. 16 | However the changes needed are trivial. 17 | -------------------------------------------------------------------------------- /utils/hashtable/README: -------------------------------------------------------------------------------- 1 | Hash table implementation related utilities. 2 | 3 | rehashing.c 4 | --- 5 | 6 | Visually show buckets in the two hash tables between rehashings. Also stress 7 | test getRandomKeys() implementation, that may actually disappear from 8 | Redis soon, however visualizaiton some code is reusable in new bugs 9 | investigation. 10 | 11 | Compile with: 12 | 13 | cc -I ../../src/ rehashing.c ../../src/zmalloc.c ../../src/dict.c -o rehashing_test 14 | -------------------------------------------------------------------------------- /utils/hyperloglog/.gitignore: -------------------------------------------------------------------------------- 1 | *.txt 2 | -------------------------------------------------------------------------------- /utils/hyperloglog/hll-err.rb: -------------------------------------------------------------------------------- 1 | # hll-err.rb - Copyright (C) 2014 Salvatore Sanfilippo 2 | # BSD license, See the COPYING file for more information. 3 | # 4 | # Check error of HyperLogLog Redis implementation for different set sizes. 5 | 6 | require 'rubygems' 7 | require 'redis' 8 | require 'digest/sha1' 9 | 10 | r = Redis.new 11 | r.del('hll') 12 | i = 0 13 | while true do 14 | 100.times { 15 | elements = [] 16 | 1000.times { 17 | ele = Digest::SHA1.hexdigest(i.to_s) 18 | elements << ele 19 | i += 1 20 | } 21 | r.pfadd('hll',*elements) 22 | } 23 | approx = r.pfcount('hll') 24 | abs_err = (approx-i).abs 25 | rel_err = 100.to_f*abs_err/i 26 | puts "#{i} vs #{approx}: #{rel_err}%" 27 | end 28 | -------------------------------------------------------------------------------- /utils/lru/README: -------------------------------------------------------------------------------- 1 | The test-lru.rb program can be used in order to check the behavior of the 2 | Redis approximated LRU algorithm against the theoretical output of true 3 | LRU algorithm. 4 | 5 | In order to use the program you need to recompile Redis setting the define 6 | REDIS_LRU_CLOCK_RESOLUTION to 1, by editing the file server.h. 7 | This allows to execute the program in a fast way since the 1 ms resolution 8 | is enough for all the objects to have a different enough time stamp during 9 | the test. 10 | 11 | The program is executed like this: 12 | 13 | ruby test-lru.rb /tmp/lru.html 14 | 15 | You can optionally specify a number of times to run, so that the program 16 | will output averages of different runs, by adding an additional argument. 17 | For instance in order to run the test 10 times use: 18 | 19 | ruby test-lru.rb /tmp/lru.html 10 20 | -------------------------------------------------------------------------------- /utils/redis-copy.rb: -------------------------------------------------------------------------------- 1 | # redis-copy.rb - Copyright (C) 2009-2010 Salvatore Sanfilippo 2 | # BSD license, See the COPYING file for more information. 3 | # 4 | # Copy the whole dataset from one Redis instance to another one 5 | # 6 | # WARNING: this utility is deprecated and serves as a legacy adapter 7 | # for the more-robust redis-copy gem. 8 | 9 | require 'shellwords' 10 | 11 | def redisCopy(opts={}) 12 | src = "#{opts[:srchost]}:#{opts[:srcport]}" 13 | dst = "#{opts[:dsthost]}:#{opts[:dstport]}" 14 | `redis-copy #{src.shellescape} #{dst.shellescape}` 15 | rescue Errno::ENOENT 16 | $stderr.puts 'This utility requires the redis-copy executable', 17 | 'from the redis-copy gem on https://rubygems.org', 18 | 'To install it, run `gem install redis-copy`.' 19 | exit 1 20 | end 21 | 22 | $stderr.puts "This utility is deprecated. Use the redis-copy gem instead." 23 | if ARGV.length != 4 24 | puts "Usage: redis-copy.rb " 25 | exit 1 26 | end 27 | puts "WARNING: it's up to you to FLUSHDB the destination host before to continue, press any key when ready." 28 | STDIN.gets 29 | srchost = ARGV[0] 30 | srcport = ARGV[1] 31 | dsthost = ARGV[2] 32 | dstport = ARGV[3] 33 | puts "Copying #{srchost}:#{srcport} into #{dsthost}:#{dstport}" 34 | redisCopy(:srchost => srchost, :srcport => srcport.to_i, 35 | :dsthost => dsthost, :dstport => dstport.to_i) 36 | -------------------------------------------------------------------------------- /utils/redis_init_script: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Simple Redis init.d script conceived to work on Linux systems 4 | # as it does use of the /proc filesystem. 5 | 6 | REDISPORT=6379 7 | EXEC=/usr/local/bin/redis-server 8 | CLIEXEC=/usr/local/bin/redis-cli 9 | 10 | PIDFILE=/var/run/redis_${REDISPORT}.pid 11 | CONF="/etc/redis/${REDISPORT}.conf" 12 | 13 | case "$1" in 14 | start) 15 | if [ -f $PIDFILE ] 16 | then 17 | echo "$PIDFILE exists, process is already running or crashed" 18 | else 19 | echo "Starting Redis server..." 20 | $EXEC $CONF 21 | fi 22 | ;; 23 | stop) 24 | if [ ! -f $PIDFILE ] 25 | then 26 | echo "$PIDFILE does not exist, process is not running" 27 | else 28 | PID=$(cat $PIDFILE) 29 | echo "Stopping ..." 30 | $CLIEXEC -p $REDISPORT shutdown 31 | while [ -x /proc/${PID} ] 32 | do 33 | echo "Waiting for Redis to shutdown ..." 34 | sleep 1 35 | done 36 | echo "Redis stopped" 37 | fi 38 | ;; 39 | *) 40 | echo "Please use start or stop as first argument" 41 | ;; 42 | esac 43 | -------------------------------------------------------------------------------- /utils/redis_init_script.tpl: -------------------------------------------------------------------------------- 1 | 2 | case "$1" in 3 | start) 4 | if [ -f $PIDFILE ] 5 | then 6 | echo "$PIDFILE exists, process is already running or crashed" 7 | else 8 | echo "Starting Redis server..." 9 | $EXEC $CONF 10 | fi 11 | ;; 12 | stop) 13 | if [ ! -f $PIDFILE ] 14 | then 15 | echo "$PIDFILE does not exist, process is not running" 16 | else 17 | PID=$(cat $PIDFILE) 18 | echo "Stopping ..." 19 | $CLIEXEC -p $REDISPORT shutdown 20 | while [ -x /proc/${PID} ] 21 | do 22 | echo "Waiting for Redis to shutdown ..." 23 | sleep 1 24 | done 25 | echo "Redis stopped" 26 | fi 27 | ;; 28 | status) 29 | PID=$(cat $PIDFILE) 30 | if [ ! -x /proc/${PID} ] 31 | then 32 | echo 'Redis is not running' 33 | else 34 | echo "Redis is running ($PID)" 35 | fi 36 | ;; 37 | restart) 38 | $0 stop 39 | $0 start 40 | ;; 41 | *) 42 | echo "Please use start, stop, restart or status as first argument" 43 | ;; 44 | esac 45 | -------------------------------------------------------------------------------- /utils/releasetools/01_create_tarball.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ $# != "1" ] 3 | then 4 | echo "Usage: ./mkrelease.sh " 5 | exit 1 6 | fi 7 | 8 | TAG=$1 9 | TARNAME="redis-${TAG}.tar" 10 | echo "Generating /tmp/${TARNAME}" 11 | cd ~/hack/redis 12 | git archive $TAG --prefix redis-${TAG}/ > /tmp/$TARNAME || exit 1 13 | echo "Gizipping the archive" 14 | rm -f /tmp/$TARNAME.gz 15 | gzip -9 /tmp/$TARNAME 16 | -------------------------------------------------------------------------------- /utils/releasetools/02_upload_tarball.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Uploading..." 3 | scp /tmp/redis-${1}.tar.gz antirez@antirez.com:/var/virtual/download.redis.io/httpdocs/releases/ 4 | echo "Updating web site... (press any key if it is a stable release, or Ctrl+C)" 5 | read x 6 | ssh antirez@antirez.com "cd /var/virtual/download.redis.io/httpdocs; ./update.sh ${1}" 7 | -------------------------------------------------------------------------------- /utils/releasetools/03_test_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ $# != "1" ] 3 | then 4 | echo "Usage: ${0} " 5 | exit 1 6 | fi 7 | 8 | TAG=$1 9 | TARNAME="redis-${TAG}.tar.gz" 10 | DOWNLOADURL="http://download.redis.io/releases/${TARNAME}" 11 | 12 | ssh antirez@metal "export TERM=xterm; 13 | cd /tmp; 14 | rm -rf test_release_tmp_dir; 15 | cd test_release_tmp_dir; 16 | rm -f $TARNAME; 17 | rm -rf redis-${TAG}; 18 | wget $DOWNLOADURL; 19 | tar xvzf $TARNAME; 20 | cd redis-${TAG}; 21 | make; 22 | ./runtest; 23 | ./runtest-sentinel; 24 | if [ -x runtest-cluster ]; then 25 | ./runtest-cluster; 26 | fi" 27 | -------------------------------------------------------------------------------- /utils/releasetools/04_release_hash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | SHA=$(curl -s http://download.redis.io/releases/redis-${1}.tar.gz | shasum -a 256 | cut -f 1 -d' ') 3 | ENTRY="hash redis-${1}.tar.gz sha256 $SHA http://download.redis.io/releases/redis-${1}.tar.gz" 4 | echo $ENTRY >> ~/hack/redis-hashes/README 5 | vi ~/hack/redis-hashes/README 6 | echo "Press any key to commit, Ctrl-C to abort)." 7 | read yes 8 | (cd ~/hack/redis-hashes; git commit -a -m "${1} hash."; git push) 9 | -------------------------------------------------------------------------------- /utils/releasetools/changelog.tcl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env tclsh 2 | 3 | if {[llength $::argv] != 2} { 4 | puts "Usage: $::argv0 " 5 | exit 1 6 | } 7 | 8 | set branch [lindex $::argv 0] 9 | set ver [lindex $::argv 1] 10 | 11 | set template { 12 | ================================================================================ 13 | Redis %ver% Released %date% 14 | ================================================================================ 15 | 16 | Upgrade urgency : 17 | } 18 | 19 | set template [string trim $template] 20 | append template "\n\n" 21 | set date [clock format [clock seconds]] 22 | set template [string map [list %ver% $ver %date% $date] $template] 23 | 24 | append template [exec git log $branch~30..$branch "--format=format:%an in commit %h:%n %s" --shortstat] 25 | 26 | #Older, more verbose version. 27 | # 28 | #append template [exec git log $branch~30..$branch "--format=format:+-------------------------------------------------------------------------------%n| %s%n| By %an, %ai%n+--------------------------------------------------------------------------------%nhttps://github.com/antirez/redis/commit/%H%n%n%b" --stat] 29 | 30 | puts $template 31 | -------------------------------------------------------------------------------- /utils/whatisdoing.sh: -------------------------------------------------------------------------------- 1 | # This script is from http://poormansprofiler.org/ 2 | # 3 | # NOTE: Instead of using this script, you should use the Redis 4 | # Software Watchdog, which provides a similar functionality but in 5 | # a more reliable / easy to use way. 6 | # 7 | # Check http://redis.io/topics/latency for more information. 8 | 9 | #!/bin/bash 10 | nsamples=1 11 | sleeptime=0 12 | pid=$(ps auxww | grep '[r]edis-server' | awk '{print $2}') 13 | 14 | for x in $(seq 1 $nsamples) 15 | do 16 | gdb -ex "set pagination 0" -ex "thread apply all bt" -batch -p $pid 17 | sleep $sleeptime 18 | done | \ 19 | awk ' 20 | BEGIN { s = ""; } 21 | /Thread/ { print s; s = ""; } 22 | /^\#/ { if (s != "" ) { s = s "," $4} else { s = $4 } } 23 | END { print s }' | \ 24 | sort | uniq -c | sort -r -n -k 1,1 25 | --------------------------------------------------------------------------------