1. 25 Mar, 2021 2 commits
  2. 24 Mar, 2021 6 commits
    • TJ Yin's avatar
      Make RWCursor constructible from IOBufQueue · fb645211
      TJ Yin authored
      Summary: This diff added conversion from `IOBufQueue` and `QueueAppender` to `RWCursor`. It's safe to use `RWCursor` to mutate the their underlying `IOBuf` since the structure of `IOBuf` won't changed. It's worth noting appending data to `IOBufQueue` will invalidate RWCursor (just like iterator).
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27257697
      
      fbshipit-source-id: 17887d656a6095afe1c6882426457b9e75a66c84
      fb645211
    • Michel Salim's avatar
      handle non-constant SIGSTKSZ · 7df2d7e5
      Michel Salim authored
      Summary:
      On glibc > 2.33 (e.g. on Fedora rawhide/35), `SIGSTKSZ` is no longer constant:
      http://sourceware-org.1504.n7.nabble.com/PATCH-sysconf-Add-SC-MINSIGSTKSZ-SC-SIGSTKSZ-BZ-20305-td650948.html
      
      Assume it's non-constant, and so:
      - use `std::max` rather than `folly::constexpr_max` to compute the stack size
      - cast both arguments to `size_t` since in the non-constant case we get a `long int` back
      - use `std::unique_ptr<char[]>` and compute the size at the time of use rather than make it class-wide
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27143320
      
      fbshipit-source-id: 7dcdd7cf3d5e96db605266504f443cf2b48ba18c
      7df2d7e5
    • Srivatsan Ramesh's avatar
      Using reply struct instead of folly::Function · 5b373171
      Srivatsan Ramesh authored
      Summary: Using folly::Function as node type for EventBaseAtomicNotificationQueue involves two mallocs (for creating the function and also to create the queue node). In this diff, I have created a class to hold the data required to send replies and using emplaceMessage to add to the queue.
      
      Differential Revision: D26778920
      
      fbshipit-source-id: 2dcf8395dc77db1d7c73d1d68c9a69e767191b95
      5b373171
    • Alexander Sklar's avatar
      Fix Range.h to compile in c++20 (#1542) · 7cdcfcab
      Alexander Sklar authored
      Summary:
      `std::is_pod` is deprecated in c++20, using `is_trivially_copyable` instead
      
      Pull Request resolved: https://github.com/facebook/folly/pull/1542
      
      Reviewed By: Mizuchi
      
      Differential Revision: D27214088
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 3cc6e29e16a1568cf1e9bbb73152e7bc2179f5d6
      7cdcfcab
    • Ruslan Sayfutdinov's avatar
      fix internal clang errors on Windows · a3ab5485
      Ruslan Sayfutdinov authored
      Summary: Fix clang internal error on Windows.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26994868
      
      fbshipit-source-id: 97fe79231fcbfc0fc6712626dee8e1d570dd0dd6
      a3ab5485
    • Yedidya Feldblum's avatar
      let symbolizer code use to_ascii · 01f86817
      Yedidya Feldblum authored
      Summary: Since it is documented as async-signal-safe. V.s. importing from `folly/Conv.h`.
      
      Reviewed By: Orvid
      
      Differential Revision: D27221887
      
      fbshipit-source-id: 9dbe866be84632f8f50f2e00c91697cc39f0b304
      01f86817
  3. 23 Mar, 2021 4 commits
    • Srivatsan Ramesh's avatar
      Extending putMessage() to take multiple arguments · 42b60e0e
      Srivatsan Ramesh authored
      Summary: putMessage() function takes variable number of arguments required to construct the queue node.
      
      Differential Revision: D26785602
      
      fbshipit-source-id: 0a9bc711bf75a83397e6de3764c41d316ef64d89
      42b60e0e
    • Andrew Krieger's avatar
      dynamic_view for safer traversal of dynamics · e7c48a6e
      Andrew Krieger authored
      Summary:
      Existing accessors on dynamic are cumbersome when operating on dynamics
      that have optional keys or nullable values. Safely accessing these ends
      up in very bloated or ugly client code, even when using getDefault().
      Additionally, the move semantics of `dynamic` are usually inferred based
      on the cv-ref qualification of the dynamic, and results in inconsistent
      syntax depending on the situation.
      
      `dynamic_view` attempts to resolve these issues by providing a new and
      explicit API for traversing and accessing a `dynamic`. The main new
      API is `descend`, which takes a varags list of keys and, functionally,
      repeatedly applies `operator[]` and either returns a view of the resulting
      value or an empty view if it doesn't exist or a type error occured during
      descent. It only throws if another unexpected exception occurs.
      
      `const_dynamic_view` contains copying accessors which will not throw
      on a type mismatch, or if invoked on an empty view, but instead will
      return a mandatory default value provided by the caller.
      
      The other new API is only provided by the non-const `dynamic_view` class.
      It is a set of value accessors which explicitly move the underlying value
      out of the viewed dynamic. There is a specialization for string values
      and a generic version for `dynamic`.
      
      A helper method, `folly::make_dynamic_view` is provided which determines
      the appropriate variant for a given dynamic ref.
      
      `friend` access to `dynamic` allows optimized checks and accesses over the
      regular `dynamic` APIs.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4917260
      
      fbshipit-source-id: a07d26ed502aa22a5f19dd8521373a9e83fd6c02
      e7c48a6e
    • Andrii Grynenko's avatar
      Rust-compatible adaptors for Task and AsyncGenerator · 57e3562c
      Andrii Grynenko authored
      Summary:
      This is a basic implementation of adaptors for coro::Task and coro::AsyncGenerator that are compatible with https://doc.rust-lang.org/std/future/trait.Future.html and https://docs.rs/futures/0.3.13/futures/stream/trait.Stream.html.
      Note that this performs blocking cancellation which may result in long destruction time/or even deadlocks if a given Task/AsyncGenerator doesn't support inline cancellation.
      
      Reviewed By: Imxset21, c-ryan747
      
      Differential Revision: D26938974
      
      fbshipit-source-id: fd043304441931c6f7aa078a1a5fee50ebfa2e90
      57e3562c
    • Udip Pant's avatar
      update URL for the libmnl to the official site · 8ebb6e9e
      Udip Pant authored
      Summary: submitted by mchtech in https://github.com/facebookincubator/katran/pull/117
      
      Reviewed By: sharmafb
      
      Differential Revision: D27224983
      
      fbshipit-source-id: f427f91a94ee35a48f66330e17cd56b4f9ce22c6
      8ebb6e9e
  4. 21 Mar, 2021 1 commit
    • Yedidya Feldblum's avatar
      Let assume be invocable anytime · 82fce98f
      Yedidya Feldblum authored
      Summary:
      [Folly] Let `assume` be invocable anytime, including before and after `main` and in signal handlers, by switching from `CHECK` to `FOLLY_SAFE_CHECK`.
      
      Requires further minimizing the deps of `FOLLY_SAFE_CHECK`.
      
      Reviewed By: ot, Orvid, luciang
      
      Differential Revision: D6636035
      
      fbshipit-source-id: 026b15ea92ba37acf9b11d714d834b79da80936a
      82fce98f
  5. 19 Mar, 2021 6 commits
    • Kenny Yu's avatar
      gdb: handle missing struct pthread definition when finding async stack traces · e5460d02
      Kenny Yu authored
      Summary:
      Depending on the environment, the type definition for `struct pthread`
      (pthread implementation detail for `pthread_t`) may not be available in gdb.
      If this happens, use a predefined offset for linux x86_64 to find the `specific`
      field inside `struct pthread` that holds the thread-local storage values.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27112799
      
      fbshipit-source-id: 38c88210c3cd2a6b06918de33167d862f59a676e
      e5460d02
    • Kenny Yu's avatar
      gdb: handle uninitialized folly_async_stack_root_tls_key · dd71878e
      Kenny Yu authored
      Summary:
      This fixes the gdb script to handle folly_async_stack_root_tls_key being uninitialized --
      this means that no async operation has run on this thread previously.
      
      This also catches any errors raised by the `co_bt` command to help with debugging the
      script itself, and to allow `thread apply all co_bt` to process all threads, even
      if one thread has an error.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27180105
      
      fbshipit-source-id: d6b36bdbc11b94a2f956862fc7651376e1d28af0
      dd71878e
    • Yedidya Feldblum's avatar
      thunk::fail · 8a82e909
      Yedidya Feldblum authored
      Reviewed By: iahs
      
      Differential Revision: D27036059
      
      fbshipit-source-id: 15166a6e7ec58d873a1d6799a3b1eb1ad64de420
      8a82e909
    • Srivatsan Ramesh's avatar
      A new NotificationQueue without read limit for server responses · cc95898a
      Srivatsan Ramesh authored
      Summary: Using a separate queue for server replies without any limit on the number of items read at once.
      
      Differential Revision: D27090888
      
      fbshipit-source-id: 9df44322e63a3f351a6ab4e723ead083a874b705
      cc95898a
    • Yedidya Feldblum's avatar
      copy socketpair for win32 from libevent and tor · ab129b5e
      Yedidya Feldblum authored
      Summary: Rather than conditionally depending on libevent in a way which is causing downstream conflicts.
      
      Reviewed By: Orvid
      
      Differential Revision: D27121200
      
      fbshipit-source-id: 4c4816e7cb2061718f81cd8a75ce4999b5b32042
      ab129b5e
    • Yedidya Feldblum's avatar
      move thunk into its own header · 163f3c3a
      Yedidya Feldblum authored
      Reviewed By: vitaut
      
      Differential Revision: D27036041
      
      fbshipit-source-id: 038b35b9690f17b59425c13c57176ac7dd017ea5
      163f3c3a
  6. 18 Mar, 2021 3 commits
  7. 17 Mar, 2021 3 commits
    • Yedidya Feldblum's avatar
      fix FOLLY_SAFE_CHECK under some gcc versions · 966d3350
      Yedidya Feldblum authored
      Summary: For reasons unknown, some gcc versions disliked the previous code with the constexpr pointer variable, even though most supported compilers and versions accepted it.
      
      Reviewed By: aary, luciang
      
      Differential Revision: D27083528
      
      fbshipit-source-id: b225a3f211a9b51b248cc079cf11e4e25ae30460
      966d3350
    • Aaryaman Sagar's avatar
      Add options to disable gflags to folly::InitOptions · f8c901f5
      Aaryaman Sagar authored
      Summary:
      As title.  CLI applications that don't use gflags might not care about
      process-wide gflags, so add an option to kill it.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27066900
      
      fbshipit-source-id: d412391879cd5ac89eba5903fd033775cf0ca49a
      f8c901f5
    • Lee Howes's avatar
      Make getGlobalIOExecutor return a KeepAlive<IOExecutor> · 31477657
      Lee Howes authored
      Summary: By returning a generic KeepAlive<> the global IO executor was losing the IOExecutor interface. This fixes it by returning the right type.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27061083
      
      fbshipit-source-id: d57f67982c3467a6b814b17e851e4513ffd33502
      31477657
  8. 16 Mar, 2021 5 commits
    • Yedidya Feldblum's avatar
      reset_once · 47ed7d6e
      Yedidya Feldblum authored
      Summary: Add `reset_once`, a mechanism to reset a `once_flag`.
      
      Reviewed By: Mizuchi
      
      Differential Revision: D27071246
      
      fbshipit-source-id: 4824782fb0ce6380b72e3e657e6f5073029eaf14
      47ed7d6e
    • Yedidya Feldblum's avatar
      keep_sink · ee776518
      Yedidya Feldblum authored
      Summary: A helper for use with check functions using `FOLLY_KEEP`.
      
      Reviewed By: luciang
      
      Differential Revision: D27072070
      
      fbshipit-source-id: 9c106ca1e0854b0f16453e8ad73d7001c3b7fff6
      ee776518
    • Yedidya Feldblum's avatar
      fix safe-assert test link failures without weak symbols · f4f864ef
      Yedidya Feldblum authored
      Reviewed By: luciang
      
      Differential Revision: D27071414
      
      fbshipit-source-id: 8bbe12e8f8264f2040c030e0353e1e4d59efae55
      f4f864ef
    • Jason Rahman's avatar
      Remove setZeroCopy() override · bda140dc
      Jason Rahman authored
      Summary:
      When folly::AsyncSSLSocket is used in unencrypted mode, zero copy is
      possible due to OpenSSL being bypassed, but the setZeroCopy() override in
      AsyncSSLSocket prevents zero copy from being used. Remove the override (no
      callers currently check the return value anyway).
      
      Reviewed By: yfeldblum, yqz, jalatif
      
      Differential Revision: D27044720
      
      fbshipit-source-id: ec402ad2badb84150ecd1b7639770a49e16e9183
      bda140dc
    • Oleg Osovitskiy's avatar
      Add CoInvokeWithoutArgs googletest helper · eef86a25
      Oleg Osovitskiy authored
      Summary: Add `CoInvokeWithoutArgs` helper, coroutine-aware version of `InvokeWithoutArgs`
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27060013
      
      fbshipit-source-id: 8024a5818fbe7759d3f9827d260c4e7370444bb0
      eef86a25
  9. 15 Mar, 2021 3 commits
    • Yedidya Feldblum's avatar
      deprecate try_and_catch taking explicit types · 29de57bd
      Yedidya Feldblum authored
      Summary: Encourage new uses to use the overload which does not take an explicit list of exception types.
      
      Reviewed By: aary
      
      Differential Revision: D27041702
      
      fbshipit-source-id: aa808bb432c2aea6e2c1cb10d76f2492875bae93
      29de57bd
    • Dan Melnic's avatar
      Fix -Werror,-Wshadow-uncaptured-local errors · 9a474aec
      Dan Melnic authored
      Summary: Fix -Werror,-Wshadow-uncaptured-local errors
      
      Reviewed By: yfeldblum, iahs
      
      Differential Revision: D27052090
      
      fbshipit-source-id: 843bf9374ff16bfe422ef78e889f1c1286335c1a
      9a474aec
    • Yedidya Feldblum's avatar
      revise FOLLY_SAFE_CHECK · b4f7d822
      Yedidya Feldblum authored
      Summary:
      Principally, this change shrink the code generated by `FOLLY_SAFE_CHECK` by:
      * Moving the literal arguments which would be passed to the backing functions into a constexpr data structure and passing only a pointer to that data structure.
      * Passing all the arguments through via C variadic arguments rather than inlining the sequence of calls to handle them into the caller.
      
      Reviewed By: swolchok, luciang
      
      Differential Revision: D26996101
      
      fbshipit-source-id: 61c39c08758a9de28ba0cfd342b174185e80ad9f
      b4f7d822
  10. 14 Mar, 2021 1 commit
    • Yedidya Feldblum's avatar
      let some thunk members take variadic args · 55dfcb03
      Yedidya Feldblum authored
      Summary: In particular, let `make` and `ctor` take variadic arguments since there is no cost.
      
      Reviewed By: iahs
      
      Differential Revision: D27024839
      
      fbshipit-source-id: 805c65fdc79f60af1256a4c36be94bb22c163bdd
      55dfcb03
  11. 13 Mar, 2021 3 commits
    • Yedidya Feldblum's avatar
      thunk::noop<...> · 6329dbd5
      Yedidya Feldblum authored
      Summary: So that downstream locations do not have to write their own noop functions.
      
      Reviewed By: iahs
      
      Differential Revision: D27022664
      
      fbshipit-source-id: e8f69c7babf853a71dedd24ded59c5017cf18ad6
      6329dbd5
    • Yedidya Feldblum's avatar
      expand the erased_unique_ptr facility · b3cbe1d5
      Yedidya Feldblum authored
      Summary:
      The interface:
      
        erased_unique_ptr
        to_erased_unique_ptr
        make_erased_unique
        copy_to_erased_unique_ptr
        empty_erased_unique_ptr
      
      Reviewed By: iahs
      
      Differential Revision: D26980776
      
      fbshipit-source-id: c520993a2191e7f74c5056a4854e2b85731a09a0
      b3cbe1d5
    • Yedidya Feldblum's avatar
      avoid snprintf in Elf code · 63ee5137
      Yedidya Feldblum authored
      Summary: `snprintf` may not be async-signal-safe, but Elf code is intended for use in signal handlers.
      
      Reviewed By: luciang
      
      Differential Revision: D27000080
      
      fbshipit-source-id: 818f48787b5712b7334eca782e18c71c17d03361
      63ee5137
  12. 12 Mar, 2021 3 commits