1. 12 Nov, 2017 2 commits
  2. 11 Nov, 2017 1 commit
  3. 10 Nov, 2017 5 commits
    • Sergey Doroshenko's avatar
      fix typo in Subprocess.h comments · ec525ab7
      Sergey Doroshenko authored
      Summary: (Note: this ignores all push blocking failures!)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6299313
      
      fbshipit-source-id: 95be2339f4845502e3c446698e54643eeac8055f
      ec525ab7
    • Christopher Dykes's avatar
      Minor tweaks to the wording of a couple of errors in the CMake build · 21e85af2
      Christopher Dykes authored
      Summary:
      Tweak the wording of a couple error messages to make them clearer.
      Also disable the 'digraphs not supported' warning, as none of our supported compilers actually interpret digraphs in any of our supported build configurations.
      
      Closes: https://github.com/facebook/folly/issues/706
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6299715
      
      fbshipit-source-id: 7c847ac859e082aea711f6751f626b4b43886da4
      21e85af2
    • Pádraig Brady's avatar
      folly: fix sysMembarrier() with newer kernel headers · ef20f638
      Pádraig Brady authored
      Summary:
      When __NR_membarrier is defined (on newer kernels),
      we don't define the constants, but also by default
      don't include the membarrier header to define the necessary constants.
      Therefore split the definition of the syscall value and
      the constants used with it, to ensure both are defined.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6292178
      
      fbshipit-source-id: 31ba9d4a698a4f5e14ae34de0acf8f851d75527d
      ef20f638
    • Pádraig Brady's avatar
      folly: avoid compile warning/failure due to lvalue-to-rvalue conversion · 18de341f
      Pádraig Brady authored
      Summary:
      With gcc 7.2 we get the warning:
        folly/io/async/DelayedDestructionBase.h:252:20:
        error: parameter ‘right’ set but not used [-Werror=unused-but-set-parameter]
           std::nullptr_t right) {
                          ^~~~~
      I presume this is due to the implicit conversion, hence the named parameter is
      never assigned.  Instead we use an explicit nullptr.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6279302
      
      fbshipit-source-id: ed449601b0410c178777f20e82ed09d9097bd024
      18de341f
    • Shubhanshu Agrawal's avatar
      adding a fibers compatible once flag · b529367b
      Shubhanshu Agrawal authored
      Summary:
      The current folly::once_flag is not compatible with folly fibers
      and when using it with fibers is inefficient and also cause deadlocks.
      
      This diff makes the once flag's mutex be a templatable paramter
      and overrides it in fibers library with a fiber compatible mtuex.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6288508
      
      fbshipit-source-id: 6f82e1794d1f417f8d267061f1702a26a7b4ff12
      b529367b
  4. 09 Nov, 2017 10 commits
    • Yedidya Feldblum's avatar
      Add makeSemiFuture declarations to helpers.h · 98c488e2
      Yedidya Feldblum authored
      Summary:
      [Folly] Add `makeSemiFuture` declarations to `helpers.h`.
      
      For consistency with the `makeFuture` declarations that are also there. Definitions for both are found in `Future-inl.h`.
      
      Reviewed By: LeeHowes
      
      Differential Revision: D6281826
      
      fbshipit-source-id: 4b22dd9086d05dbdebba358c6f569a772017949a
      98c488e2
    • Phil Willoughby's avatar
      Make ColdClassTest work on ancient compilers · 9f29d67a
      Phil Willoughby authored
      Summary:
      Some older versions of GCC/glibc/etc do not have the
      std::is_trivially*_constructible or std::is_trivially*_assignable traits.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6285887
      
      fbshipit-source-id: 1eb4ae4f899dc1f528321f9f087390291687aca3
      9f29d67a
    • Dan Melnic's avatar
      Remove the zerocopy write threshold support, add support for ENOBUFS · d4018226
      Dan Melnic authored
      Summary: Remove the zerocopy write threshold support since it is a little bit confusing
      
      Reviewed By: djwatson
      
      Differential Revision: D6256854
      
      fbshipit-source-id: 1c992f93d7b04c4ede2fbefebde7a7ae89de3764
      d4018226
    • Teng Qin's avatar
      Add parsing for indirect functions · bb8d886a
      Teng Qin authored
      Summary:
      Currently `folly::symbolizer`'s `getDefinitionByAddress` and `getSymbolByName` only parses `STT_OBJECT` and `STT_FUNC`. There are some standar library functions that uses the GNU indirect function feature that would have been missed:
      
        ==== For libpthread-2.23.so:
        ====== Symbol system Addr 119d0 Size 8 is a STT_GNU_IFUNC
        ====== Symbol siglongjmp Addr 10700 Size 8 is a STT_GNU_IFUNC
        ====== Symbol longjmp Addr 10700 Size 8 is a STT_GNU_IFUNC
        ====== Symbol __vfork Addr 10af0 Size 8 is a STT_GNU_IFUNC
        ====== Symbol vfork Addr 10af0 Size 8 is a STT_GNU_IFUNC
        ====== Symbol system_ifunc Addr 119d0 Size 8 is a STT_GNU_IFUNC
        ====== Symbol longjmp_ifunc Addr 10700 Size 8 is a STT_GNU_IFUNC
        ====== Symbol vfork_ifunc Addr 10af0 Size 8 is a STT_GNU_IFUNC
        ====== Symbol siglongjmp_ifunc Addr 10700 Size 8 is a STT_GNU_IFUNC
        ====== Symbol __vfork_ifunc Addr 10af0 Size 8 is a STT_GNU_IFUNC
        ====== Symbol __vfork@GLIBC_2.2.5 Addr 10af0 Size 8 is a STT_GNU_IFUNC
        ====== Symbol siglongjmp@GLIBC_2.2.5 Addr 10700 Size 8 is a STT_GNU_IFUNC
        ====== Symbol vfork@GLIBC_2.2.5 Addr 10af0 Size 8 is a STT_GNU_IFUNC
        ====== Symbol system@GLIBC_2.2.5 Addr 119d0 Size 8 is a STT_GNU_IFUNC
        ====== Symbol longjmp@GLIBC_2.2.5 Addr 10700 Size 8 is a STT_GNU_IFUNC
      
        ==== For libc-2.23.so:
        ====== Symbol __gettimeofday Addr c05e0 Size a8 is a STT_GNU_IFUNC
        ====== Symbol strcpy Addr 8e150 Size 35 is a STT_GNU_IFUNC
        ====== Symbol wmemcmp Addr afb50 Size 37 is a STT_GNU_IFUNC
        ====== Symbol strncmp Addr 8eb30 Size 41 is a STT_GNU_IFUNC
        ====== Symbol stpncpy Addr 929f0 Size 35 is a STT_GNU_IFUNC
        ====== Symbol __mempcpy_chk Addr 11cec0 Size 68 is a STT_GNU_IFUNC
        ====== Symbol strncpy Addr 903d0 Size 35 is a STT_GNU_IFUNC
        ====== Symbol time Addr c0500 Size a8 is a STT_GNU_IFUNC
        ====== Symbol strpbrk Addr 90700 Size 22 is a STT_GNU_IFUNC
        ====== Symbol strspn Addr 90a80 Size 22 is a STT_GNU_IFUNC
        ====== Symbol __stpncpy Addr 929f0 Size 35 is a STT_GNU_IFUNC
        ====== Symbol __strcasecmp Addr 92a80 Size 54 is a STT_GNU_IFUNC
        ====== Symbol memset Addr 92230 Size 41 is a STT_GNU_IFUNC
        ====== Symbol strstr Addr 916b0 Size 21 is a STT_GNU_IFUNC
        ====== Symbol strcspn Addr 8e270 Size 22 is a STT_GNU_IFUNC
        ====== Symbol memcmp Addr 91c40 Size 37 is a STT_GNU_IFUNC
        ====== Symbol mempcpy Addr 923b0 Size 68 is a STT_GNU_IFUNC
        And 80 more...
      This Diff adds parsing for `STT_GNU_IFUNC` symbols as well
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6282727
      
      fbshipit-source-id: 71b7c44831e4ddfdccf1e794cb86e049e14227bc
      bb8d886a
    • Teng Qin's avatar
      Add a multi-type version of iterateSectionsWithType · ef4c7223
      Teng Qin authored
      Summary:
      When using `folly::symbolizer`, it's very often that we want to use `iterateSectionsWithType` iterate through sections of a few types using the same callback. Current approach would require iterating the section header multiple times.
      
      This Diff add `iterateSectionsWithTypes`, which is basically just `iterateSectionsWithType` but accepts multiple section types.
      
      It is very similar to D6279651. However, in this Diff we did not change implementation of `getDefinitionByAddress` and `getSymbolByName`, since going through `.dynsym` separately would improve the efficiency of single-address or single-symbol lookup. However, for the use cases that we want to iterate through all symbols of an ELF file, this new interface would be useful.
      
      Reviewed By: anakryiko, yfeldblum
      
      Differential Revision: D6281449
      
      fbshipit-source-id: f9afe0a0e95d9fafcd041014abad8ca86d1a882f
      ef4c7223
    • Yedidya Feldblum's avatar
      Fix folly/test/Makefile.am · 67811c1b
      Yedidya Feldblum authored
      Summary:
      [Folly] Fix `folly/test/Makefile.am`.
      
      Closes #709.
      
      Reviewed By: meyering
      
      Differential Revision: D6282009
      
      fbshipit-source-id: 0f2a992e92d4b94a535f29341920c9f2959819d7
      67811c1b
    • Teng Qin's avatar
      Add a multi-type version of iterateSymbolsWithType · fddc6338
      Teng Qin authored
      Summary:
      When using `folly::symbolizer`, it's very often that we want to use `iterateSymbolsWithType` iterate through symbols of a few types using the same callback. Current approach would require iterating the section multiple times.
      
      This Diff adds `iterateSymbolsWithTypes`, which is basically just `iterateSymbolsWithType` but accepts symbol types.
      
      This Diff also updated implementation of `getDefinitionByAddress` and `getSymbolByName` which currently does two iterations for `STT_OBJECT` and `STT_FUNC`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6279651
      
      fbshipit-source-id: a661dd15f18e4f2f63dbcca615f5a86d92e528ea
      fddc6338
    • Yedidya Feldblum's avatar
      In SemiFuture members, fix DCHECK of pointer types · 3066914f
      Yedidya Feldblum authored
      Summary:
      [Folly] In `SemiFuture` members, fix `DCHECK` of pointer types.
      
      Use `nullptr !=` to avoid ` error: ISO C++ forbids comparison between pointer and integer`.
      
      Closes #708.
      
      Reviewed By: Orvid
      
      Differential Revision: D6277832
      
      fbshipit-source-id: 8f65065d5347c6ac407b99cb780c38935e901362
      3066914f
    • Phil Willoughby's avatar
      Actually mark Unexpected as cold · 72d6102e
      Phil Willoughby authored
      Summary:
      Testing indicates that GCC ignores the cold attribute when the function
      is available for inlining. Because Unexpected is a template class we
      can't make the constructors non-inline, but we can make it derive from a
      class with a cold constructor, which has the effect of making all the
      Unexpected constructors implicitly cold.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6261013
      
      fbshipit-source-id: 482e49253d5b104742018133c53fb60279dd9f9b
      72d6102e
    • Christopher Dykes's avatar
      Mark the base class of NoFutureInSplitter as public · 981ea831
      Christopher Dykes authored
      Summary: Because every other exception is already marked as public.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6275414
      
      fbshipit-source-id: 8e1fc4ceafedbdb44733ab57aecb6050c4160994
      981ea831
  5. 08 Nov, 2017 5 commits
    • Arkady Shapkin's avatar
      Fix static linking gflags and glog · b3061cbe
      Arkady Shapkin authored
      Summary:
      gflags and glog require some compile definitions when linking statically
      /cc Orvid
      Closes https://github.com/facebook/folly/pull/693
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6264382
      
      Pulled By: Orvid
      
      fbshipit-source-id: 60c8af429f10e778d9c313f40227892238829f63
      b3061cbe
    • Yedidya Feldblum's avatar
      Heterogeneous lookups for sorted_vector types · d03823c8
      Yedidya Feldblum authored
      Summary:
      [Folly] Heterogeneous lookups for `sorted_vector` types.
      
      When the `Compare` type has member type or alias `is_transparent`, enable template overloads of `count`, `find`, `lower_bound`, `upper_bound`, and `equal_range` on both `sorted_vector_set` and `sorted_vector_map`.
      
      This is the protocol found in the equivalent `std::set` and `std::map` member functions.
      
      > This overload only participates in overload resolution if the qualified-id `Compare::is_transparent` is valid and denotes a type. They allow calling this function without constructing an instance of `Key`.
      >
      > http://en.cppreference.com/w/cpp/container/set/count (same wording in all 10 cases)
      
      Reviewed By: nbronson
      
      Differential Revision: D6256989
      
      fbshipit-source-id: a40a181453a019564e8f7674e1e07e241d5ab068
      d03823c8
    • Andre Pinto's avatar
      Avoid implicitly dropping const modifier · 85ad5f46
      Andre Pinto authored
      Summary: Use const_cast instead of implicitly dropping const modifier.
      
      Reviewed By: reanimus
      
      Differential Revision: D6269200
      
      fbshipit-source-id: 61e1708c88a4139d3fdd9cf89f4ff778d0354bb2
      85ad5f46
    • Andre Pinto's avatar
      Fix oss build · b58cbabb
      Andre Pinto authored
      Summary:
      Include folly/Portability.h in GenerateFingerprintTables, so that
      gflags namespace gets defined.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6265226
      
      fbshipit-source-id: d509dc163564420151de7007ad4336d7e5ef9625
      b58cbabb
    • Igor Sugak's avatar
      fix -Wunused-variable · 78a596f1
      Igor Sugak authored
      Summary:
      Exposed by the latest clang:
      ```lang=bash
      folly/test/FixedStringTest.cpp:52:36: error: unused variable 's' [-Werror,-Wunused-variable]
        constexpr folly::FixedString<42> s{"hello world"};
                                         ^
      folly/gen/test/StringBenchmark.cpp:176:15: error: unused variable 'line' [-Werror,-Wunused-variable]
        StringPiece line(kLine);
                    ^
      ```
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6264853
      
      fbshipit-source-id: 5cf4b0a8c99eaa31c2499746c70ddc49fdd73074
      78a596f1
  6. 07 Nov, 2017 6 commits
    • Christopher Dykes's avatar
      Workaround a bug in MSVC · 29ffcc50
      Christopher Dykes authored
      Summary:
      It was broken, now it is fixed.
      https://developercommunity.visualstudio.com/content/problem/145407/incorrect-c3520-within-noexcept-expression-in-alia.html
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6254219
      
      fbshipit-source-id: a03961db97d7ac211103655229c1ea703405826a
      29ffcc50
    • Adam Simpkins's avatar
      logging: set the thread name for the AsyncFileWriter thread · 766b616c
      Adam Simpkins authored
      Summary:
      AsyncFileWriter uses a separate thread to write messages to the file
      descriptor.  This diff makes us call setThreadName() to set the name of this
      thread to `log_writer`.
      
      Reviewed By: bolinfest
      
      Differential Revision: D6238229
      
      fbshipit-source-id: 9c93d80e7ac989e03bc3160bb2f135d67e15c8be
      766b616c
    • Dave Watson's avatar
      Support movable keys · 103ad3da
      Dave Watson authored
      Summary: Use the same trick as the values, so that non-copyable keys can be used in ConcurrentHashMap.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6252711
      
      fbshipit-source-id: f0f168c4eb361d372bdfc3417f32222d66c11aaf
      103ad3da
    • Dave Watson's avatar
      Remove incorrect DCHECKS · 897877b8
      Dave Watson authored
      Summary:
      While the returned iterators are always 'valid' and can be read and iterated from,
      they may still be concurrently erased from the map.  Current erase(iter) has DCHECKS that assert we can always
      erase an iterator, but it may have already been removed.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D6221382
      
      fbshipit-source-id: 70b21f53e2fc3daa126df4fb60bc5d3ecb253c71
      897877b8
    • Giuseppe Ottaviano's avatar
      Allow to specify per-priority capacities in PriorityLifoSemMPMCQueue · a77fea17
      Giuseppe Ottaviano authored
      Summary: The `THROW` behavior of `LifoSemMPMCQueue` is unsafe when calling `join()`, because the queue may be full and `join()` will fail to enqueue the poisons. To work around this we can use `PriorityLifoSemMPMCQueue` and dedicate `LO_PRI` to the poisons, but there's no reason that the low priority queue should have the same size as the normal priority. Add a constructor to be able to specify different sizes.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6257017
      
      fbshipit-source-id: c75f33c38fcdad646ba1499bcd434ab65711250c
      a77fea17
    • Yedidya Feldblum's avatar
      crange, and range const overloads · 0718262d
      Yedidya Feldblum authored
      Summary:
      [Folly] `crange`, and `range` `const` overloads.
      
      Instead of using universal reference for `range` overloads, bifurcate explicitly between `&` and `const&` overloads. The `&` overloads return `Range<T*>` while the `const&` overloads return `Range<T const*>`.
      
      Add `crange` overloads, which may accept non-`const` arguments but will return `Range<T const*>` results anyway.
      
      Reviewed By: ot
      
      Differential Revision: D6242038
      
      fbshipit-source-id: bc373c3288ea88792f04b49a372262d12204b586
      0718262d
  7. 06 Nov, 2017 3 commits
    • Yedidya Feldblum's avatar
      Move folly/LifoSem.h · c593d8ed
      Yedidya Feldblum authored
      Summary: [Folly] Move `folly/LifoSem.h` to `folly/synchronization/`.
      
      Reviewed By: meyering
      
      Differential Revision: D6245444
      
      fbshipit-source-id: 14ffa012fa92b8c6aaf5900c930156894a492003
      c593d8ed
    • Eric Niebler's avatar
      Value-initialize the Data union member of folly::Function · d6a27b28
      Eric Niebler authored
      Summary: The Data field was not getting value-initialized, leading compilers to complain when value-initializing const folly::Function objects.
      
      Reviewed By: yfeldblum, ot
      
      Differential Revision: D6241712
      
      fbshipit-source-id: 99ce7f6016f6e7d16b1cff7aa51b7bef53ec592d
      d6a27b28
    • Phil Willoughby's avatar
      Mark constructing an Unexpected as cold · ad3fe1dd
      Phil Willoughby authored
      Summary:
      By marking the main constructors of `Unexpected` cold we are telling the compiler that we don't expect to execute them often. This can improve the locality and performance of the `Expected` branch, and reduce the code-size for the `Unexpected` branch.
      
      The constructors we have marked cold here are only the ones used to originate an `Unexpected`. We don't mark the copy- move- or conversion-constructors as `cold` because they will typically be used in error-handling branches and it is not correct to say that they are colder than their surroundings in that case. Note that the entire error-handling branch is likely to be deduced to be cold because we told the compiler that it is likely that hasValue() is true and hasError() is false.
      
      Because `makeUnexpected` unconditionally invokes one of these cold constructors it will inherit the property of being cold.
      
      The GCC function attribute reference, which describes what `cold` means, is here: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6234305
      
      fbshipit-source-id: 6876073e92ce54936ba7152175d76be653f5f463
      ad3fe1dd
  8. 05 Nov, 2017 1 commit
    • Yedidya Feldblum's avatar
      Move folly/Functional.h · 05a56e4c
      Yedidya Feldblum authored
      Summary: [Folly] Move `folly/Functional.h` to `folly/lang/RValueReferenceWrapper.h`.
      
      Reviewed By: Orvid
      
      Differential Revision: D6242160
      
      fbshipit-source-id: a8ec42106cfe0ea617c87d382694d5eb2f0f61a0
      05a56e4c
  9. 04 Nov, 2017 3 commits
    • Yedidya Feldblum's avatar
      constexpr_clamp · 6ca1c3b6
      Yedidya Feldblum authored
      Summary:
      [Folly] `constexpr_clamp`.
      
      Like `std::clamp` (C++17).
      
      Reviewed By: Orvid
      
      Differential Revision: D6236825
      
      fbshipit-source-id: 0f6c5dc9a955b148021ee6ed3e86201b53ae090c
      6ca1c3b6
    • Lee Howes's avatar
      Make SemiFuture::via throw on nullptr executor. · 36ae3c3e
      Lee Howes authored
      Summary: Make SemiFuture throw if no executor provided to via because in that situation the deferred work will never run.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6233233
      
      fbshipit-source-id: 43b642c46cc0be80b1f13c03bdaf20b8038acec2
      36ae3c3e
    • Yedidya Feldblum's avatar
      Move folly/SafeAssert.h · 2e1b273c
      Yedidya Feldblum authored
      Summary: [Folly] Move `folly/SafeAssert.h` to `folly/lang/`.
      
      Reviewed By: Orvid
      
      Differential Revision: D6230421
      
      fbshipit-source-id: 0086cd6fedd4ce0e7a4d5302a41153ec1a502e74
      2e1b273c
  10. 03 Nov, 2017 4 commits
    • Lee Howes's avatar
      Parameter order · 4780814a
      Lee Howes authored
      Summary: Fix for function parameter order that shows up in opt build on later diff.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D6237125
      
      fbshipit-source-id: fbb7be2c70b32203c658fc239cd74164e01fa1ca
      4780814a
    • Louis Dionne's avatar
      Nitpick: fix typo in name · 2e395f36
      Louis Dionne authored
      Summary: Closes https://github.com/facebook/folly/pull/705
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6234351
      
      Pulled By: Orvid
      
      fbshipit-source-id: e71bb3882c783a47ace4d08f134b2e450aaabb6b
      2e395f36
    • Dan Melnic's avatar
      Expose the zerocopy buf ID, change the AsyncSocket fd constructor to accept... · 15fd86fa
      Dan Melnic authored
      Expose the zerocopy buf ID, change the AsyncSocket fd constructor to accept the id, Buff->Buf, make the cmsghdr methods private
      
      Summary: Expose the zerocopy buf ID, change the AsyncScokey fd constructor to accept the id, Buff->Buf, make the cmsghdr methods private
      
      Reviewed By: djwatson
      
      Differential Revision: D6221324
      
      fbshipit-source-id: d0fc4937adf6cf5790d11e406ffd3ec64c558b9c
      15fd86fa
    • Lee Howes's avatar
      Missing Future/SemiFuture->Value conversion check · 514d9cb9
      Lee Howes authored
      Summary: Conversion check was lost in an earlier refactor. This meant that SemiFuture could be accidentally converted to Future through the value constructor. This should be disabled.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6214526
      
      fbshipit-source-id: 3fc2d026ec6062b38b9500c8adf3eee12c0f2693
      514d9cb9