1. 12 Mar, 2019 9 commits
    • Dan Melnic's avatar
      Fix typo · 7ecfb621
      Dan Melnic authored
      Summary: Fix typo
      
      Reviewed By: aary
      
      Differential Revision: D14411090
      
      fbshipit-source-id: 4ca0273201facebc815db26d23662d0d192c831f
      7ecfb621
    • Yedidya Feldblum's avatar
      Move FOLLY_DEFINE_CPO to folly/lang/CustomizationPoint.h · ca91b0ed
      Yedidya Feldblum authored
      Summary:
      [Folly] Move `FOLLY_DEFINE_CPO` to `folly/lang/CustomizationPoint.h`.
      
      And move `StaticConst` to top-level `folly` namespace and into `folly/lang/`.
      
      And Americanize the spellings of words in the comments.
      
      Reviewed By: ericniebler, lewissbaker
      
      Differential Revision: D14402315
      
      fbshipit-source-id: e13dbc9d471ee73ba0a289d375c235734334b920
      ca91b0ed
    • Jacob Lacouture's avatar
      Future<Try<T>> -> Future<T> · 4008ab21
      Jacob Lacouture authored
      Summary:
      future.then([] -> T)  currently returns Future<T>
      future.then([] -> Try<T>)  currently returns Future<Try<T>>
      
      This changes that behavior, such that future.then([] -> Try<T>) will
      return Future<T>.
      
      This is a more desirable interface for futures. It also simplifies
      implementation of a separate task (propagating exceptions more
      efficiently through chained callbacks) because it enables us to internally
      substitute lambdas returning T with lambdas returning Try<T>.
      
      Reviewed By: yfeldblum, ryantimwilson
      
      Differential Revision: D14318624
      
      fbshipit-source-id: 51363e82ceb86bfecf87ae661188be9ca3dd8002
      4008ab21
    • Orvid King's avatar
      Remove the fd overload of AsyncUDPServerSocket->getFD() · d10d3f04
      Orvid King authored
      Summary: Instead prefer the NetworkSocket version
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14371075
      
      fbshipit-source-id: 5dfa34e21b360cae987b1ffb1dd5f5ee7b105623
      d10d3f04
    • Joe Loser's avatar
      Use common IsNothrowSwappable in F14Policy.h (#1049) · 5c000f05
      Joe Loser authored
      Summary:
      - Instead of defining our own version of whether a type is nothrow
        swappable, reuse the existing definition from `folly/Traits.h` which
        is spelled `IsNothrowSwappable`.
      Pull Request resolved: https://github.com/facebook/folly/pull/1049
      
      Reviewed By: Orvid
      
      Differential Revision: D14402098
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 5b61bd6d43db939b4499e908b26a3eb61f8929a3
      5c000f05
    • Joe Loser's avatar
      Cut remove_cvref_t from pushmi/traits.h (#1048) · 4e39e4da
      Joe Loser authored
      Summary:
      - Remove `remove_cvref_t` alias template from `pusmhi/traits.h` in favor of
        `folly::remove_cvref_t` from `folly/Traits.h` which is the same
        definition.
      Pull Request resolved: https://github.com/facebook/folly/pull/1048
      
      Reviewed By: ericniebler
      
      Differential Revision: D14402040
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: baba640e5fa410e0c48e666ea004de61b7f12a12
      4e39e4da
    • Joe Loser's avatar
      Replace Not with folly::Negation in PolyDetail.h (#1045) · f52d7dc8
      Joe Loser authored
      Summary:
      - Replace `Not` template alias from `PolyDetail.h` with `folly::Negation` from
       `folly/Traits.h` which does the same thing.
      Pull Request resolved: https://github.com/facebook/folly/pull/1045
      
      Reviewed By: ericniebler
      
      Differential Revision: D14402105
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 100347dbdc159c5217c7452b202650d58d80850c
      f52d7dc8
    • Dan Melnic's avatar
      Add timerfd based timers · ac744ab3
      Dan Melnic authored
      Summary: Add timerfd based timers
      
      Reviewed By: djwatson
      
      Differential Revision: D13809490
      
      fbshipit-source-id: 9ae70d9cc4d481245623efbc3e74ce5ff8c8f3ca
      ac744ab3
    • Yunus Rahbar's avatar
      Fix ShipIt sync · 9f5c7e1e
      Yunus Rahbar authored
      fbshipit-source-id: 4c8ab4cdad047a4311c84b302b28160dd2bc9ed4
      9f5c7e1e
  2. 11 Mar, 2019 5 commits
    • Joe Loser's avatar
      Remove extraneous libfolly.pc.in pkg-config file (#1050) · 3129c365
      Joe Loser authored
      Summary:
      - In `c2e51a8e`, i.e.
        Differential Revision: D9213429
        fbshipit-source-id: 849c0fce01d4903d3f8a7b6d196037bf950e5921
        a `libfolly.pc.in` file was placed in the `CMake` directory so that
        the `libfolly.pc` file is installed during CMake configure time.
      - Note that the `libfolly.pc.in` in the `folly` directory is not
        referenced anywhere in the build tree, and it has been superseded with
        the one in the `CMake` directory. As such, remove it.
      Pull Request resolved: https://github.com/facebook/folly/pull/1050
      
      Reviewed By: calebmarchent
      
      Differential Revision: D14400016
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 4c8ab4cdad047a4311c84b302b28160dd2bc9ed4
      3129c365
    • Yedidya Feldblum's avatar
      Cut glog include in folly/Range.h · 34592733
      Yedidya Feldblum authored
      Summary: [Folly] Cut glog include in `folly/Range.h`.
      
      Reviewed By: meyering
      
      Differential Revision: D14402324
      
      fbshipit-source-id: ed37939d69b2de4016483e7a2564d73892a64b3b
      34592733
    • Matthew Glazar's avatar
      Add missing gflags #include in tests (#1051) · 3e23fe15
      Matthew Glazar authored
      Summary:
      Some tests fail to compile because gflags.h is not included:
      
          .../folly/test/FormatOtherTest.cpp: In function 'int main(int, char**)':
          .../folly/test/FormatOtherTest.cpp:113:3: error: 'gflags' has not been declared
             gflags::ParseCommandLineFlags(&argc, &argv, true);
             ^~~~~~
      
      The tests compile without issue on Travis CI without this patch, but I
      don't see how that's possible.
      
      Include gflags.h explicitly to fix the compilation of these tests.
      Pull Request resolved: https://github.com/facebook/folly/pull/1051
      
      Reviewed By: aary
      
      Differential Revision: D14400709
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 73999a940f45511373d3922ea8eb782a27af0008
      3e23fe15
    • Brandon Schlinker's avatar
      Verify socket open when handling err messages · 45cf4bf2
      Brandon Schlinker authored
      Summary:
      When a socket is configured to read from `MSG_ERRQUEUE`, the corresponding callback handler for `errMessageCallback_->errMessage(*cmsg)` may close the socket when processing a message.
      
      If this happens, `fd_` will be set to -1 (reinitialized) and subsequent calls to `netops::recvmsg(fd_, &msg, MSG_ERRQUEUE)` will fail. On the read failure, an error will be propagated via `failErrMessageRead(__func__, ex)`. This quickly becomes confusing -- you end up with an error message `::recvmsg exited with code 9` (EBADF) with little context.
      
      This diff adds logic to check if the socket is still open before each call to `netops::recvmsg(fd_, &msg, MSG_ERRQUEUE)`. If not, we exit out.
      
      It's arguable that the application is at fault in this scenario instead of the library. However, I've found this problem and given the complexity, it seems like a scenario worth guarding against in the library.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14354115
      
      fbshipit-source-id: 49e1efbbf6cecbe3bf6db7ee6bdfcac4c8aaa8c2
      45cf4bf2
    • Yedidya Feldblum's avatar
      Migrate gdb/scripts/ to platform007 · 9c1133ff
      Yedidya Feldblum authored
      Summary: [GDB] Migrate `gdb/scripts/` to `platform007`.
      
      Reviewed By: pixelb
      
      Differential Revision: D14400956
      
      fbshipit-source-id: 59f800c8770fae78ffd51d33161bb56dc6c9ff12
      9c1133ff
  3. 10 Mar, 2019 2 commits
  4. 09 Mar, 2019 3 commits
  5. 08 Mar, 2019 5 commits
    • Matthew Glazar's avatar
      Don't clobber CXXFLAGS/CMAKE_CXX_FLAGS (#1046) · 15fff7c1
      Matthew Glazar authored
      Summary:
      CMake allows the user to add additional compilation options using
      CXXFLAGS= or -DCMAKE_CXX_FLAGS=. For example, each of the following
      commands would enable GCC security features in generated code:
      
          $ CXXFLAGS=-fstack-protector-strong cmake .
          $ cmake -DCMAKE_CXX_FLAGS=-fstack-protector-strong .
      
      Unfortunately, this doesn't work with folly's build system; CXXFLAGS and
      CMAKE_CXX_FLAGS are ignored. This makes it harder for package managers
      to tweak folly's compilation.
      
      Teach folly to respect user-supplied compiler flags instead of
      overriding them.
      Pull Request resolved: https://github.com/facebook/folly/pull/1046
      
      Reviewed By: wez
      
      Differential Revision: D14383310
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: a6c527fa1659b93bb88a4e0be617a5d9022489dd
      15fff7c1
    • Matt Joras's avatar
      Print si_code even if there's no string decoding available. · 2d22dfe3
      Matt Joras authored
      Summary: We are getting SIGILLs that end up not printing a code because it's not in the cases in `signal_reason`, which isn't particularly helpful. Additionally, the check for kernel-sourced si_codes is incorrect. Any code > 0 is from the kernel. This causes folly to log nonsense PIDs and UIDs.
      
      Differential Revision: D14388102
      
      fbshipit-source-id: 3201a16bbe9eb9038ebc5601044406f5333ec9e9
      2d22dfe3
    • Tyler John Smith's avatar
      Fix ordering issue with folly dynamic subtraction and division · 01323e31
      Tyler John Smith authored
      Summary:
      folly dynamic "double / int" (division, same goes for subtraction) results in the operands switching places (always becomes "int / double") due to int and non-int checking logic.
      
      Same applies to addition and multiplication, but order doesn't matter for those.
      
      If both dynamics are doubles or both are ints, then the problematic logic is bypassed.
      
      So this is only when you have one int and one double, and the int comes second, and the operand is subtraction or division.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14379896
      
      fbshipit-source-id: e76f1fe677fc4ea69856649ab046a5080a902b0d
      01323e31
    • Phil Willoughby's avatar
      expose share count of IOBuf · 3a0d4ce4
      Phil Willoughby authored
      Summary: Exposing this counter allows us to fairly divide the memory usage of shared IOBuf buffers among all the owners in memory-usage tracking code.
      
      Reviewed By: simpkins
      
      Differential Revision: D14361976
      
      fbshipit-source-id: 73c63c473b117198786143b421c6fcb8aed684d5
      3a0d4ce4
    • Orvid King's avatar
      AsyncUDPSocket->getFD to AsyncUDPSocket->getNetworkSocket() · f988642d
      Orvid King authored
      Summary: The file descriptor backed version will be going away.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14235700
      
      fbshipit-source-id: 990b0276b085e6bb88bf3bdb83cdeba332f75ac6
      f988642d
  6. 07 Mar, 2019 2 commits
    • Ilya Maykov's avatar
      add missing experimental/crypto tests to CMakeLists.txt · c0fc7af5
      Ilya Maykov authored
      Summary: The tests were accidentally checked in without the cmake build rules to build them.
      
      Reviewed By: kevinlewi
      
      Differential Revision: D14277667
      
      fbshipit-source-id: 5e0ff305341772232579bbde2dfc60477b4f1937
      c0fc7af5
    • Chad Austin's avatar
      build folly/experimental/symbolizer:stack_trace on mac · 6eb906e6
      Chad Austin authored
      Summary:
      ssize_t is not standard, so include <sys/types.h>. (I considered
      switching to intptr_t but decided against it.)
      
      Also, on macOS, the function appears to be called backtrace, not
      unw_backtrace.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14307252
      
      fbshipit-source-id: d919bd37fea8f68b5d610e771e577c8ce385f6ec
      6eb906e6
  7. 06 Mar, 2019 5 commits
    • Orvid King's avatar
      Remove the fd overloads of AsyncSSLSocket::AsyncSSLSocket() · 7a5aa125
      Orvid King authored
      Summary: They are dead.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14192072
      
      fbshipit-source-id: dcb95be39614d9968db9d63cd9f06396f4779a0a
      7a5aa125
    • Joe Loser's avatar
      Update Ubuntu build scripts to work with CMake build (#1042) · 82336a72
      Joe Loser authored
      Summary:
      - Update Ubuntu 14.04 build script to use CMake instead of Autotools.
      - Rename Ubuntu 14.04 build script to use hyphens rather than underscores to match POSIX standard for bash scripts.
      - The Ubuntu 14.04 build script is now meant to be run from the top-level rather than from inside the `folly` source tree.
      - Remove the Ubuntu 12.04 build scripts. It was previously only needed for Travis CI, but Travis CI isn't using it anymore.
      Pull Request resolved: https://github.com/facebook/folly/pull/1042
      
      Reviewed By: Orvid
      
      Differential Revision: D14298995
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: e3151620c0f0fa73147ab258b8750480c868c44a
      82336a72
    • Lewis Baker's avatar
      Add folly::coro::semi_await_result_t<T> · 0cf8295c
      Lewis Baker authored
      Summary:
      - Change folly::coro::co_viaIfAsync to be a customization-point object.
      - Modify co_viaIfAsync() to call a .viaIfAsync() member function if one exists.
        Otherwise it calls the co_viaIfAsync() function found by ADL.
      - Add FOLLY_DEFINE_CPO() helper macro to folly/Portability.h
        Borrows some techniques from range-v3 to support CPOs in different
        compilers and C++ versions.
      - Redefined co_viaIfAsync() CPO in terms of this macro.
        This allows it to be callable as folly::coro::co_viaIfAsync() while
        still allowing other types in folly::coro namespace to define friend
        functions that customise the behaviour of this customisation point
        without causing conflicts.
      - Add folly::coro::is_semi_awaitable<T> metafunction.
      - Add folly::coro::semi_await_result_t<T> metafunction.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14016389
      
      fbshipit-source-id: 63998993b2fa8560700f81666a910dee31f3ba72
      0cf8295c
    • Erik Hortsch's avatar
      Standardize fiber baton behavior across threads and fibers · 12f18243
      Erik Hortsch authored
      Summary:
      The behavior of fiber Baton is currently inconsistent around posting of a timed out baton, and subsequent calls to try_wait().  As stated in the post, only when the waiter is a thread will a post overwrite a timeout internally, and this is observable externally because try_wait returns true only if a baton is in the POSTED state, but not the timed out state.  Example code:
      
      ```
      folly::fibers::Baton b;
      
      b.try_wait_for(std::chrono::milliseconds(1));
      b.try_wait(); // returns false
      
      b.post();
      b.try_wait(); // Returns true on threads, false on fibers
      ```
      
      Other options we could consider for the fix:
       * Update postThread to leave baton in a timeout state, and have waitThread move the baton into the timeout state on a failed wait.
       * Update try_wait() to return true if the state is either POSTED or TIMEOUT.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D14324532
      
      fbshipit-source-id: 51b993a6153cba0fc3cf5701f765fff8ad1c8e3c
      12f18243
    • Nick Terrell's avatar
      Allow counters to be disabled · 49a54a71
      Nick Terrell authored
      Summary:
      Some codecs may not want counters enabled. Right now that will
      `std::terminate`. Allow disabled counters, and add a test.
      
      Reviewed By: felixhandte
      
      Differential Revision: D14327170
      
      fbshipit-source-id: 37858518c80e192e351e8578e088b59732d2a0cb
      49a54a71
  8. 05 Mar, 2019 3 commits
    • Joe Loser's avatar
      Replace some bool_constant with constexpr bool in FBVector (#1039) · 8ef7d7f1
      Joe Loser authored
      Summary:
      - Some constant expressions are wrapped in a type carrying a bool, but
        are only used in value contexts. Remove the type wrapper
        (bool_constant) use and just use `constexpr bool` directly. This makes the
        usages not have to use `::value` everywhere.
      Pull Request resolved: https://github.com/facebook/folly/pull/1039
      
      Reviewed By: Orvid
      
      Differential Revision: D14293828
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 78399e4fb401ab680a4f1ecef63fb4c2a82927c2
      8ef7d7f1
    • Yedidya Feldblum's avatar
      Remove extraneous uses of keyword typename in fibers collectN · 0217f5e2
      Yedidya Feldblum authored
      Summary: [Folly] Remove extraneous uses of keyword `typename` in fibers `collectN`.
      
      Reviewed By: ericniebler
      
      Differential Revision: D14317102
      
      fbshipit-source-id: 1ae04081258bf2398865a1cc5461618648623158
      0217f5e2
    • Yedidya Feldblum's avatar
      Canonical SFINAE in fibers · ddc11d67
      Yedidya Feldblum authored
      Summary: [Folly] Canonical SFINAE in fibers, where the `enable_if` is on the outside.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D14294993
      
      fbshipit-source-id: 498c9bfcd346edb5e4b5b65941e2a09c93e870b6
      ddc11d67
  9. 04 Mar, 2019 2 commits
    • Joe Loser's avatar
      Fix to handle empty CMAKE_SYSTEM_ARCHITECTURE (#1040) · 1cb1ad79
      Joe Loser authored
      Summary:
      - On some platforms, `CMAKE_SYSTEM_ARCHITECTURE` may resolve to an empty
        string.
      - When this value is used without quotes to the `string` command, it is
        ill-formed with error:
      
      ```
        CMake Error at CMakeLists.txt:174 (string):
        string sub-command FIND requires 3 or 4 parameters.
      ```
      
      - Explicitly wrap the value to the `string` operation in quotes to treat
        `CMAKE_SYSTEM_ARCHITECTURE` as a string, which is allowed to be empty.
        The result is that the `string` operation will not result in a hard
        error.
      Pull Request resolved: https://github.com/facebook/folly/pull/1040
      
      Reviewed By: calebmarchent
      
      Differential Revision: D14293784
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: cd5924fa62277aa07e930c7b088197ef596be977
      1cb1ad79
    • Lewis Baker's avatar
      Fix property_set_insert_t metafunction in pushmi · 8d53d77b
      Lewis Baker authored
      Summary: The property_set_insert_t<PS1, PS2> template metafunction had a bug that meant that it would fail to replace elements in the base set that had the same category as elements from the set being inserted.
      
      Reviewed By: ericniebler, kirkshoop
      
      Differential Revision: D14268145
      
      fbshipit-source-id: ccc64e455bc6ff2073229e028a19d64dc7050092
      8d53d77b
  10. 02 Mar, 2019 2 commits
    • Yedidya Feldblum's avatar
      Mark BitIterator with the category of the base · 973c5bb8
      Yedidya Feldblum authored
      Summary:
      [Folly] Mark `BitIterator<BaseIterator>` with the iterator category of `BitIterator`.
      
      As one benefit, using `std::distance` to find the distance between two `BitIterator`s gotten from a random access container such as `std::vector` is now constant-time.
      
      Fixes #1026.
      
      Reviewed By: ot
      
      Differential Revision: D14294852
      
      fbshipit-source-id: 2345bc73dec169803ae41b9391687e89ad77207b
      973c5bb8
    • Yedidya Feldblum's avatar
      Support C++11 in folly/IPAddress.h w.r.t. aligned_union · 40df9484
      Yedidya Feldblum authored
      Summary: [Folly] Support C++11 in `folly/IPAddress.h` w.r.t. `aligned_union` by avoiding `aligned_union_t`, which is C++14.
      
      Reviewed By: spalamarchuk, mengz0
      
      Differential Revision: D14278604
      
      fbshipit-source-id: 474ac0aa0110f4939d1042d334b69feb6b2644cb
      40df9484
  11. 01 Mar, 2019 2 commits