1. 15 Apr, 2016 2 commits
    • David Goldblatt's avatar
      Correctly deduce RNG type in folly::Random · 015f5dc5
      David Goldblatt authored
      Summary:Fix a bug in folly where it can't infer any RNG type except the
      default-supplied parameter.
      
      Differential Revision: D3163421
      
      fb-gh-sync-id: 23d3963ba19dac93fa3407f3a2dfd1d9aa39ea44
      fbshipit-source-id: 23d3963ba19dac93fa3407f3a2dfd1d9aa39ea44
      015f5dc5
    • Michael Lee's avatar
      Fix build for no FOLLY_TLD_USE_FOLLY_TLS · caba7148
      Michael Lee authored
      Summary: unique_ptr doesn't cast to void*
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D3181346
      
      fb-gh-sync-id: 5b912d2b5d46f3c9953b44d5ced7a8e1b4320678
      fbshipit-source-id: 5b912d2b5d46f3c9953b44d5ced7a8e1b4320678
      caba7148
  2. 14 Apr, 2016 3 commits
    • Andrii Grynenko's avatar
      Improve folly::ThreadLocal perf · b25183f6
      Andrii Grynenko authored
      Summary: This fixes folly::ThreadLocal perf after several refactorings which touched the code.
      
      Reviewed By: ericniebler
      
      Differential Revision: D3170761
      
      fb-gh-sync-id: d44198f19aebc9f9f2588a65950efba0694e2a11
      fbshipit-source-id: d44198f19aebc9f9f2588a65950efba0694e2a11
      b25183f6
    • Andrii Grynenko's avatar
      Fix GuardPageAllocator to do mprotect lazily · a6692f12
      Andrii Grynenko authored
      Summary:Currently GuargPageAllocator mmap's a memory block enough for 100 fiber stacks and then protects a bottom page for each stack. If FiberManager is used to process a single task, protecting 100 stacks doesn't make much sense, but is costly.
      
      This change makes sure we protect a bottom page of every stack the first time given stack is requested.
      
      Reviewed By: alikhtarov
      
      Differential Revision: D3139944
      
      fb-gh-sync-id: d9d724eaa0e65a227eac1d09a33018e6cb098aae
      fbshipit-source-id: d9d724eaa0e65a227eac1d09a33018e6cb098aae
      a6692f12
    • Den Raskovalov's avatar
      remove duplicate licence prolog · 7c17b38a
      Den Raskovalov authored
      Reviewed By: yfeldblum
      
      Differential Revision: D3174112
      
      fb-gh-sync-id: 00a01f64fb43d2333818097bb2212e26e4dd5775
      fbshipit-source-id: 00a01f64fb43d2333818097bb2212e26e4dd5775
      7c17b38a
  3. 13 Apr, 2016 2 commits
    • Christopher Dykes's avatar
      Fix the includes in portability/Malloc.h · 0e657178
      Christopher Dykes authored
      Summary:We use `size_t` but didn't include `<stdlib.h>`.
      Fix #385
      
      Reviewed By: markisaa
      
      Differential Revision: D3171643
      
      fb-gh-sync-id: 1f915f9602c4be59a21cdf77b31fe18816f35f81
      fbshipit-source-id: 1f915f9602c4be59a21cdf77b31fe18816f35f81
      0e657178
    • Neel Goyal's avatar
      Add method to get the connect timeout used for an AsyncSocket · e6fd088b
      Neel Goyal authored
      Summary: Have the AsyncSocket keep track of the timeout used for connecting and add a getter to retrieve it.
      
      Reviewed By: hiteshk
      
      Differential Revision: D3170625
      
      fb-gh-sync-id: 61d0ecd8d975c49978a1cf222671aa16a2160499
      fbshipit-source-id: 61d0ecd8d975c49978a1cf222671aa16a2160499
      e6fd088b
  4. 12 Apr, 2016 1 commit
    • Michael Lee's avatar
      Sorry, forgot to add portability/Memory.cpp · fe2af2cc
      Michael Lee authored
      Summary: Add it to the Makefile.am
      
      Reviewed By: Orvid
      
      Differential Revision: D3168833
      
      fb-gh-sync-id: 7184acc565ffebde0f93bc8bdce4d38ba1a79923
      fbshipit-source-id: 7184acc565ffebde0f93bc8bdce4d38ba1a79923
      fe2af2cc
  5. 11 Apr, 2016 1 commit
    • Alexander Shaposhnikov's avatar
      Fix the order of EXPECT_EQ parameters · 54b83bda
      Alexander Shaposhnikov authored
      Summary:Change the order of EXPECT_EQ parameters to
      EXPECT_EQ(expected, actual). It will make gtest print
      the correct error message if a test fails.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3161878
      
      fb-gh-sync-id: 69e4536c6f396858d189a9d25904ef4df639ad49
      fbshipit-source-id: 69e4536c6f396858d189a9d25904ef4df639ad49
      54b83bda
  6. 10 Apr, 2016 1 commit
    • Yedidya Feldblum's avatar
      Some cleanups to folly::EventBase after converting to folly::Function · 652d34b9
      Yedidya Feldblum authored
      Summary:[Folly] Some cleanups to `folly::EventBase` after converting to `folly::Function`.
      
      * Fix up some comments referring to `std::function`.
      * Remove the `SmallFunctor` bits - `folly::Function` takes over for that.
      * Remove `runFunctionPtr` - it's unused.
      
      Reviewed By: spacedentist
      
      Differential Revision: D3155511
      
      fb-gh-sync-id: 38c75d1254993f59c8eaa7826dc8d9facb50a3a1
      fbshipit-source-id: 38c75d1254993f59c8eaa7826dc8d9facb50a3a1
      652d34b9
  7. 09 Apr, 2016 1 commit
    • Adam Norton's avatar
      Add <new> header for placement new · 2dafcc98
      Adam Norton authored
      Summary: This header is necessary for the placement new operator used in the construct method (line 265)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3156741
      
      fb-gh-sync-id: 84a64821553b42d46fb70b5ee267a401028c94f2
      fbshipit-source-id: 84a64821553b42d46fb70b5ee267a401028c94f2
      2dafcc98
  8. 07 Apr, 2016 3 commits
    • Tom Jackson's avatar
      Extensibility for folly::to<> through ADL · 54f2a4c8
      Tom Jackson authored
      Summary: Primarily to support slightly more flexible implementations of `split()`;
      
      Reviewed By: ot
      
      Differential Revision: D3116763
      
      fb-gh-sync-id: 69023c0f26058516f25b9c1f9824055efc7021f9
      fbshipit-source-id: 69023c0f26058516f25b9c1f9824055efc7021f9
      54f2a4c8
    • Alexey Spiridonov's avatar
      DynamicParser to reliably and reversibly convert JSON to structs · 4785dfe0
      Alexey Spiridonov authored
      Summary:We have a bunch of code that manually parses `folly::dynamic`s into program structures. I can be quite hard to get this parsing to be good, user-friendly, and concise. This diff was primarily motivated by the mass of JSON-parsing done by Bistro, but this pattern recurs in other pieces of internal code that parse dynamics.
      
      This diff **not** meant to replace using Thrift structs with Thrift's JSON serialization / deserialization. When all you have to deal with is correct, structured plain-old-data objects produced by another program -- **not** manually entered user input -- Thrift + JSON is perfect. Go use that.
      
      However, sometimes you need to parse human-edited configuration. The input JSON might have complex semantics, and require validation beyond type-checking. The UI for editing your configs can easily enforce correct JSON syntax. Perhaps, you can use `folly/experimental/JSONSchema.h` to have your edit UI provide type correctness. Despite all this, people can still make semantic errors, and those can be impossible to detect until you interpret the config at runtime. Also, as your system evolves, sometimes you need to break semantic backwards-compatibility for the sake of moving forward ? thus making previously valid configurations invalid, and requiring them to be fixed up manually.
      
      So, people end up needing to write manual parsers for `dynamic`s. These all have very similar recurring issues:
      
       - Verbose: to get an int field out of an object, typical code: (i) tests if the field is present, (ii) checks if the field is an integer, (iii) extracts the integer. Sometimes, you also want to handle exceptions, and compose helpful error messages. This makes the code far longer than its intent, and encourages people to write bad parsers.
      
       - Unsystematic: sometimes, we use `if (const auto* p = dyn_obj.get_ptr("key")) { ... }`, other times we use `dyn_obj.getDefault()` or `if (dyn_obj.count())`, and so on. The patterns differ subtly in meaning. Exceptions sometimes get thrown, leading to error messages that cannot be understood by the user.
      
       - Imperative parses: a typical parse proceeds step by step, and throws at the earliest error. This is bad because (i) errors have to be fixed one-by-one, instead of getting a full list upfront, (ii) even if 99% of the config is parseable, the imperative code has no way of recording the information it would have parsed after the first error.
      
       `DynamicParser` fixes all of the above, and makes your parsing so clean that you might not even bother with `JSONSchema` as your first line of defense -- type-coercing, type-enforcing, friendly-error-generating C++ ends up being more concise. Besides all the sweet syntax sugar, `DynamicParser` lets you parse **all** the valid data in your config, while recording  *all* the errors in a way that does not lose the original, buggy config. This means your code can parse a config that has errors, and still be able to meaningfully export it back to JSON. As a result, stateless clients (think REST APIs) can provide a far better user experience than just discarding the user?s input, and returning a cryptic error message.
      
      For the details, read the docs (and see the example) in `DynamicParser.h`. Here are the principles of `DynamicParser::RECORD` mode in a nutshell:
       - Pre-populate your program struct with meaningful defaults **before** you parse.
       - Any config part that fails to parse will keep the default.
       - Any config part that parses successfully will get to update the program struct.
       - Any errors will be recorded with a helpful error message, the portion of the dynamic that caused the error, and the path through the dynamic to that portion.
      
       I ported Bistro to use this in D3136954. I looked at using this for JSONSchema's parsing of schemas, but it seemed like too much trouble for the gain, since it would require major surgery on the code.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2906819
      
      fb-gh-sync-id: aa997b0399b17725f38712111715191ffe7f27aa
      fbshipit-source-id: aa997b0399b17725f38712111715191ffe7f27aa
      4785dfe0
    • Yedidya Feldblum's avatar
      Use folly::Function in folly::EventBase · 2a196d5a
      Yedidya Feldblum authored
      Summary:[Folly] Use `folly::Function` in `folly::EventBase`.
      
      `folly::Function` is moveable but noncopyable and therefore supports wrapping moveable but noncopyable lambdas - like the kind that arises when move-capturing a `std::unique_ptr`.
      
      `std::function` is copyable - therefore it does not support wrapping such noncopyable lambdas.
      
      Switching `folly::EventBase` to use it will allow callers to pass such noncopyable lambdas, allowing, e.g.:
      
      ```
      auto numptr = folly::make_unique<int>(7); // unique_ptr is noncopyable
      folly::EventBase eb;
      eb.runInLoop([numptr = std::move(numptr)] { // therefore lambda is noncopyable
        int num = *numptr;
      });
      eb.loop();
      ```
      
      This allows us to move away from the `folly::MoveWrapper` hack, which worked like:
      
      ```
      auto numptr = folly::make_unique<int>(7); // unique_ptr is noncopyable
      auto numptrw = folly::makeMoveWrapper(std::move(numptr)); // MoveWrapper is "copyable" - hacky
      folly::EventBase eb;
      eb.runInLoop([numptrw] { // therefore lambda is "copyable" - hacky
        int num = **numptrw;
      });
      ```
      
      We needed to do that hack while:
      
      But neither condition is true anymore.
      
      Reviewed By: spacedentist
      
      Differential Revision: D3143931
      
      fb-gh-sync-id: 4fbdf5fb77eb5848ed1c6de942b022382141577f
      fbshipit-source-id: 4fbdf5fb77eb5848ed1c6de942b022382141577f
      2a196d5a
  9. 06 Apr, 2016 5 commits
    • Giuseppe Ottaviano's avatar
      Remove leftover comment in Portability.h · f549d777
      Giuseppe Ottaviano authored
      Reviewed By: luciang
      
      Differential Revision: D3145033
      
      fb-gh-sync-id: f37d0a2c6e22c1866134159b78722ff43d70918b
      fbshipit-source-id: f37d0a2c6e22c1866134159b78722ff43d70918b
      f549d777
    • Bert Maher's avatar
      malloc.h doesn't exist on OSX · 5f9c9af4
      Bert Maher authored
      Summary: Use malloc/malloc.h there instead
      
      Reviewed By: Orvid
      
      Differential Revision: D3143768
      
      fb-gh-sync-id: 3258b68df49cf7fbff28a3853663d39c147aee8b
      fbshipit-source-id: 3258b68df49cf7fbff28a3853663d39c147aee8b
      5f9c9af4
    • Michael Lee's avatar
      Start compiling a bit of `-Wshadow` · 448f1272
      Michael Lee authored
      Summary: Sometimes variable shadowing is fine, sometimes it can cause subtle mistakes.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3140450
      
      fb-gh-sync-id: acf7195ad65614d4f012bef8ce7dccb3a3038456
      fbshipit-source-id: acf7195ad65614d4f012bef8ce7dccb3a3038456
      448f1272
    • Sven Over's avatar
      folly::fibers::Fiber: use folly::Function instead of std::function · 177753d9
      Sven Over authored
      Summary:We are jumping through some ugly hoops in the implementation of
      fibers to allow for non-copyable functors/lambdas. We can get rid of
      those by using folly::Function instead of std::function to store
      functions in folly::fibers::Fiber.
      
      This involves one observable interface change: the virtual function
      folly::fibers::InlineFunctionRunner::run must take a
      folly::Function<void()> argument instead of a std::function<void()>.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D3102711
      
      fb-gh-sync-id: 56705b972dc24cc0da551109ed44732b97cb6e13
      fbshipit-source-id: 56705b972dc24cc0da551109ed44732b97cb6e13
      177753d9
    • Dmitry Pleshkov's avatar
      Allow usage of Symbolizer options for ExceptionStats printing · edf8f25a
      Dmitry Pleshkov authored
      Summary: For exceptions aggregation conveniece
      
      Reviewed By: philippv
      
      Differential Revision: D3128132
      
      fb-gh-sync-id: 48c72df364228c1d2c8f29161c2b85c131b4fea8
      fbshipit-source-id: 48c72df364228c1d2c8f29161c2b85c131b4fea8
      edf8f25a
  10. 05 Apr, 2016 3 commits
    • James Sedgwick's avatar
      Function::asStdFunction() · b50d0563
      James Sedgwick authored
      Summary:This is an ugly but occassionally useful hack to accomodate cases
      where we want to propagate folly::Function but run into the brick wall that is
      std::function
      
      @override-unit-failures
      
      Reviewed By: spacedentist
      
      Differential Revision: D3118432
      
      fb-gh-sync-id: 80ed56494dfcf60e0f266013d880107acabc7dcf
      fbshipit-source-id: 80ed56494dfcf60e0f266013d880107acabc7dcf
      b50d0563
    • Giuseppe Ottaviano's avatar
      Update libgcc and boost symlinks (Disable SSO on ASan builds) · 7f813725
      Giuseppe Ottaviano authored
      Summary: Allow ASan to detect access to invalidated strings even when they are small (in-situ). See D3114022 for details.
      
      Reviewed By: luciang
      
      Differential Revision: D3118161
      
      fb-gh-sync-id: 3b83e3309d510ee9721dd505d176b09bdb7fd42d
      fbshipit-source-id: 3b83e3309d510ee9721dd505d176b09bdb7fd42d
      7f813725
    • Sven Over's avatar
      folly/futures: replace MoveWrappers with generalised lambda capture · 76663af2
      Sven Over authored
      Summary:Now that folly::Future uses folly::Function, we can use non-copyable
      callbacks. That allows us to get rid of folly::MoveWrapper in the
      implementaion.
      
      This diff also enforces perfect forwarding in the implementation of
      folly::Future, thereby reducing the number of times that a callable
      that is passed to Future::then et al. gets passed by value.
      
      Before folly::Function, Future::then(callback) has invoked the move
      constructor of the callback type 5 times for small callback objects
      (fitting into the in-place storage inside folly::detail::Core) and
      6 times for large callback objects. This has been reduced to 5 times
      in all cases with the switch to UniqueFunction. This diff reduces it
      to 2 times.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2976647
      
      fb-gh-sync-id: 9da470d7e9130bd7ad8af762fd238ef9a3ac5892
      fbshipit-source-id: 9da470d7e9130bd7ad8af762fd238ef9a3ac5892
      76663af2
  11. 04 Apr, 2016 1 commit
    • Sven Over's avatar
      folly::FunctionScheduler: replace std::function w/ folly::Function · a92b878a
      Sven Over authored
      Summary:By using folly::Function instead of std::function to internally store
      functions in FunctionScheduler, this diff allows users to pass
      non-copyable lambdas to FunctionScheduler::addFunction.
      
      All exisiting unit tests still pass. Also, passing std::function to
      addFunction still works, as the std::function will be implicitly
      converted (i.e. wrapped) in a folly::Function. However, this implies
      a performance penalty.
      
      Reviewed By: fugalh
      
      Differential Revision: D3092944
      
      fb-gh-sync-id: 1e8081e70d4717025f2eadbb6b6da173460d4373
      fbshipit-source-id: 1e8081e70d4717025f2eadbb6b6da173460d4373
      a92b878a
  12. 02 Apr, 2016 5 commits
    • Giuseppe Ottaviano's avatar
      fbstring: Make SSO disabling and insertImplDiscr implementation simpler · aafcc64b
      Giuseppe Ottaviano authored
      Summary:Instead of using preprocessor to disable SSO, use a default argument. Also
      reimplement `insertImplDiscr` to mirror `insertImpl`.
      
      Reviewed By: philippv
      
      Differential Revision: D3130901
      
      fb-gh-sync-id: a5b0ba97b3c7d91323be01ab617ca9b09dbb0fd2
      fbshipit-source-id: a5b0ba97b3c7d91323be01ab617ca9b09dbb0fd2
      aafcc64b
    • Christopher Dykes's avatar
      Add portability header for libgen.h · 0d1a8a82
      Christopher Dykes authored
      Summary: The only thing that matters in it is dirname, and Windows doesn't have it.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2977655
      
      fb-gh-sync-id: eb5703485089f5c66882fbc9cc142686214c1148
      fbshipit-source-id: eb5703485089f5c66882fbc9cc142686214c1148
      0d1a8a82
    • Christopher Dykes's avatar
      Create a portability header for syslog.h · 0b32c9eb
      Christopher Dykes authored
      Summary: Windows doesn't have it, so stub it out for now, because not getting output to the system log is a minor inconvience, not a breaking issue.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2977537
      
      fb-gh-sync-id: b05d9d3c722ad4f3953a979f91024602d17d3ed0
      fbshipit-source-id: b05d9d3c722ad4f3953a979f91024602d17d3ed0
      0b32c9eb
    • Christopher Dykes's avatar
      Don't use the plus operator unecessarily · d34f2425
      Christopher Dykes authored
      Summary: MSVC doesn't like this and complains about ambigious overloads.
      
      Reviewed By: ericniebler
      
      Differential Revision: D3107438
      
      fb-gh-sync-id: 597ba85fdb7640b0a0fda352bf53ce31cf0e38b7
      fbshipit-source-id: 597ba85fdb7640b0a0fda352bf53ce31cf0e38b7
      d34f2425
    • Sven Over's avatar
      folly::Function: fix swap function and put in correct namespace · 12d273d2
      Sven Over authored
      Summary:The swap function belongs in the same namespace as Function: folly.
      Also, to avoid amibiguities with a generic swap function in
      <algorithm>, we need two variants: one for identical types of
      folly::Function, and one for folly::Functions with different
      configurations.
      
      Reviewed By: ericniebler
      
      Differential Revision: D3106429
      
      fb-gh-sync-id: 11b04e9bc709d52016ac94c078278410f5ee43c6
      fbshipit-source-id: 11b04e9bc709d52016ac94c078278410f5ee43c6
      12d273d2
  13. 01 Apr, 2016 8 commits
    • Adam Simpkins's avatar
      update SocketAddress::setFromPath() to take a StringPiece · 4e995b4d
      Adam Simpkins authored
      Summary:Update setFromPath() to accept a StringPiece rather than just std::string
      or a plain const char*.
      
      Also fix two other minor issues:
      - Leave the old address untouched on failure.  Previously it could leave the
        SocketAddress in a partially updated state.
      - Don't assume the input is nul terminated.  Previously the input code read
        one past the specified input length, and copied this into the address,
        assuming it was a nul terminator.  The new code explicitly writes a 0 byte.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3119882
      
      fb-gh-sync-id: 3e2258f42034b4f470ade0a23ea085e132a3dd0f
      fbshipit-source-id: 3e2258f42034b4f470ade0a23ea085e132a3dd0f
      4e995b4d
    • Christopher Dykes's avatar
      Create the Builtins portability header · 98d33bb5
      Christopher Dykes authored
      Summary: Because we don't have these builtins under MSVC, and not having to deal with the differences in API in the places that use these builtins is good.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2984842
      
      fb-gh-sync-id: 34db7455debf81e4abffe57c154eb731ae097ff6
      fbshipit-source-id: 34db7455debf81e4abffe57c154eb731ae097ff6
      98d33bb5
    • Christopher Dykes's avatar
      Create the dirent.h portability header · ad4df4af
      Christopher Dykes authored
      Summary: We don't have dirent.h on Windows, but we can emulate its behavior.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2978570
      
      fb-gh-sync-id: af5ade0ea64ba22900440250e7125aa039a77f62
      fbshipit-source-id: af5ade0ea64ba22900440250e7125aa039a77f62
      ad4df4af
    • Christopher Dykes's avatar
      Create the pthread.h portability header · c63fe6c3
      Christopher Dykes authored
      Summary: The primary issue is that the pthread implementation we use for Windows defines `pthread_t` as a struct (yes, it is allowed to do this), which breaks a lot of things.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2862671
      
      fb-gh-sync-id: 551569b6a9e2e374cf77e186e148b6b397f8f25f
      fbshipit-source-id: 551569b6a9e2e374cf77e186e148b6b397f8f25f
      c63fe6c3
    • Michael Lee's avatar
      `strndup` is defined on modern OSX · 9ab69bc7
      Michael Lee authored
      Summary: `strndup` is defined on modern versions of OSX
      
      Reviewed By: Orvid, grp
      
      Differential Revision: D3122635
      
      fb-gh-sync-id: 678792765addf2fb226e835d3b7a67e155ed6dc5
      fbshipit-source-id: 678792765addf2fb226e835d3b7a67e155ed6dc5
      9ab69bc7
    • Sven Over's avatar
      folly: replace old-style header guards with "pragma once" · dee8a518
      Sven Over authored
      Summary:Most header files in folly already used "#pragma once" to
      protect against multiple inclusion. This diff removes old-style
      ifndef/define/endif header guards and replaces them with
      pragma once.
      
      In some cases the defined symbol is tested in other header
      files. In those cases the "#define" is kept.
      
      Reviewed By: igorsugak
      
      Differential Revision: D3054492
      
      fb-gh-sync-id: 20aa0b9b926a30dd021e4b8f5440e8888874681c
      fbshipit-source-id: 20aa0b9b926a30dd021e4b8f5440e8888874681c
      dee8a518
    • Sven Over's avatar
      folly/docs: add documentation about folly::Function · 94070f19
      Sven Over authored
      Summary: This diff adds folly/docs/Function.md
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3120617
      
      fb-gh-sync-id: fecc0e507e05016aaac43ba981eab49431229bd7
      fbshipit-source-id: fecc0e507e05016aaac43ba981eab49431229bd7
      94070f19
    • Andrii Grynenko's avatar
      Implement GDB pretty-printers for folly::fibers · b1e45251
      Andrii Grynenko authored
      Summary:This adds basic print functions for FiberManager, Fiber and FiberManager map.
      It also adds a global list of fibers to FiberManager. Fibers are only removed from that list on Fiber object destruction, so it shouldn't have any perf impact.
      
      Inspired by tao/server/scripts/fiber_bt.gdb
      
      FiberManager map example:
        (gdb) print_folly_fiber_manager_map
          Global FiberManager map has 2 entries.
            (folly::EventBase*)0x7fffffffdb60 -> (folly::fibers::FiberManager*)0x7ffff5b58480
            (folly::EventBase*)0x7fffffffd930 -> (folly::fibers::FiberManager*)0x7ffff5b58300
      
      FiberManager example:
        (gdb) print_folly_fiber_manager &manager
          (folly::fibers::FiberManager*)0x7fffffffdbe0
      
          Fibers active: 3
          Fibers allocated: 3
          Fibers pool size: 0
          Active fiber: (folly::fibers::Fiber*)(nil)
          Current fiber: (folly::fibers::Fiber*)(nil)
      
          Active fibers:
            (folly::fibers::Fiber*)0x7ffff5b5b000   State: Awaiting
            (folly::fibers::Fiber*)0x7ffff5b5b300   State: Awaiting
            (folly::fibers::Fiber*)0x7ffff5b5b600   State: Awaiting
      
      Fiber example: P56244621
      
      Reviewed By: yfeldblum
      
      Differential Revision: D3119616
      
      fb-gh-sync-id: defa27b84aafbd4333b2ca301f07c226f0386f44
      fbshipit-source-id: defa27b84aafbd4333b2ca301f07c226f0386f44
      b1e45251
  14. 31 Mar, 2016 4 commits
    • Nicholas Ormrod's avatar
      New strings no longer relocatable · 9a781ed4
      Nicholas Ormrod authored
      Summary:gcc-5.0 introduced non-relocatable strings in libgcc. Only treat gcc < 5 strings as relocatable. Enable relocation for fbstrings via typedef.
      
      Re https://github.com/facebook/folly/issues/316, thanks tomhughes for reporting this.
      
      Reviewed By: snarkmaster, ot
      
      Differential Revision: D3115580
      
      fb-gh-sync-id: d8aff947d55a0a0c57f6b997f651a190e05f2779
      fbshipit-source-id: d8aff947d55a0a0c57f6b997f651a190e05f2779
      9a781ed4
    • Giuseppe Ottaviano's avatar
      Simplify fbstring::insertImpl · 8ddc5992
      Giuseppe Ottaviano authored
      Summary:The current implementation of `insertImpl` assumes that
      `expand_noinit` does not reallocate if the `size() + delta <=
      capacity()`, but D3114022 makes this assumption invalid when compiling
      with ASan. It also doesn't guarantee exponential growth, so repeated
      inserting at the end could trigger quadratic behavior.
      
      The new implementation fixes the problems above, and it's much
      simpler.
      
      Reviewed By: yfeldblum, Orvid
      
      Differential Revision: D3119813
      
      fb-gh-sync-id: 946ebeeaf924a531f7f03fb7e79c75e352a50c58
      fbshipit-source-id: 946ebeeaf924a531f7f03fb7e79c75e352a50c58
      8ddc5992
    • Kyle Nekritz's avatar
      Log SSL alerts received on the server. · 2cf0e317
      Kyle Nekritz authored
      Summary: Alerts may be sent by clients, potentially letting us know why connections fail.
      
      Reviewed By: siyengar
      
      Differential Revision: D3117395
      
      fb-gh-sync-id: bddf51f2399eb9e7e397981d5440adb3e815d6d2
      fbshipit-source-id: bddf51f2399eb9e7e397981d5440adb3e815d6d2
      2cf0e317
    • Christopher Dykes's avatar
      Create the sys/resource.h portability header · f30ed164
      Christopher Dykes authored
      Summary: Windows doesn't have it, so be nice and at least stub it out.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2984232
      
      fb-gh-sync-id: 3e8871ab78c5d7c8785a52af24548245f842f19b
      fbshipit-source-id: 3e8871ab78c5d7c8785a52af24548245f842f19b
      f30ed164