POSIX is unclear what state a file descriptor is in after a signal is delivered in the middle of close. On Linux, the file is closed even if it returns -1 with errno=EINTR.
As such, do not use errno at all when closing files.
PiperOrigin-RevId: 462638735
Change-Id: Ie73da1f3c83b1099bef146e1ea32e9a4818597cf
In the PostSynchEvent() function, the pos integer uses an implementation
of snprintf that is fundamentally unsafe: since the return value of
snprintf is the number of characters that would have been written to the
buffer, if an operation reaches the end of the buffer with more than one
character discarded, the return value will be greater than the buffer
size, requiring a check of the buffer's current size.
Signed-off-by: Elijah Conners <business@elijahpepe.com>
In some places, we check if the amount we read is a multiple of some amount we are interested in. However, ReadFromOffset returns -1 when it errors. Certain record sizes can cause ReadFromOffset to cause us to think that we succeeded when we did not.
It also results in confusing messages in logs.
PiperOrigin-RevId: 461798762
Change-Id: I8c9c7f2cea4d1789e95e50833d5405239a47f02e
The Cord::GetCustomAppendBuffer() method provides the same functionality as Cord::GetAppendBuffer(), except that callers can specify a custom block size/limit if the method returns a newly allocated buffer.
In other words: Cord::GetAppendBuffer() defaults to CordBuffer::CreateWithDefaultLimit(), Cord::GetCustomAppendBuffer() defaults to CordBuffer::CreateWithCustomLimit().
PiperOrigin-RevId: 461231989
Change-Id: I5c03f31139d9b068feee1bea76d59e1c5e30ef07
Add a hook to permit checking whether an address is in bounds for the stack.
PiperOrigin-RevId: 460997074
Change-Id: Ib3b4d0cf656e614aa083457abb079c40ef8db0ff
using decl 'Pointee' is unused
missing #include <utility> for 'std::move'
missing #include <memory> for 'std::unique_ptr'
PiperOrigin-RevId: 460980847
Change-Id: I5ebfca39d6b93ef396b32d1b91a5d8748d43e018
Clang recently added this warning which flags inconsistencies between
array parameters in function declarations.
See https://crbug.com/1343303
PiperOrigin-RevId: 460725261
Change-Id: I57b1e99f13698c947e948c6024e3f6f4642ea189
There are many reports that sigaltstack() on Apple platforms stops
backtrace() from tracing an original stack, e.g.
* d39ead4105
* https://reviews.llvm.org/D28265
If we disable an alternate stack for signal handler, we won't be able to
catch stack overflow errors, but backrace() will work again.
This test indicates it has a 90% chance of timing out at its current 60 second limit.
Stats over 1000 runs: max = 102.5s, min = 40.4s, avg = 71.1s, dev = 11.2s
Note that if you run this test locally from a workstation without flags, it'll take maybe 3 to 5 seconds. However, the test is run with config of android_arm, which seems to drastically change the execution time.
PiperOrigin-RevId: 459503103
Change-Id: I7b7aaa2db7880370f47d1a83d295a3234f738a18
Adds policy checks the raise the minimum C++ version to C++14
and the minimum GCC version to GCC 5
Updates the docs to indicate the C++14 minimum.
PiperOrigin-RevId: 459401288
Change-Id: I18878f0e13001c57e97e26ad7c9a9c9c12c39265
This seems to have caused some regressions by causing a flaky failure in some
cases. Revert the change to enable investigation.
PiperOrigin-RevId: 459331687
Change-Id: Iaa4e4bfcb3013a75a2cd72768d980ac5e450f70c
The alternate signal stack may be sufficiently beyond the esimated frame size
(100k). If we run into the case that the frame is not in the correct direction
assume that the frames may be non-contiguous due to an alternate signal stack
layout. In such a case, if we find that there is an alternate stack configured,
ignore the discontiuity (assuming that it is a removable point-wise
discontinuity) and continue the stack unwinding. This permits us to capture
stack traces in more cases.
PiperOrigin-RevId: 458327775
Change-Id: Ia8b461847401492f72a23ba26601c72e0109402c
This allows symbolization to work if different parts of a binary's text are mapped differently, e.g. if they're mlock()ed or mapped onto huge pages.
PiperOrigin-RevId: 456600880
Change-Id: I069264f94cf834df9201968275a00828f5eb077e
This ensures that emmintrin.h is included with clang-cl. Otherwise, errors like
this occur:
.../absl/container/internal/raw_hash_set.h(536,8): error: unknown type name '__m128i'
inline __m128i _mm_cmpgt_epi8_fixed(__m128i a, __m128i b) {
This aligns the include ifdef guards and the guards that use the provided APIs.
The includes are also reordered, so they appear after the config header which
provides the internal macro values.
PiperOrigin-RevId: 456530271
Change-Id: I86dfd0022fd06fe7aa132138ec4d1bd14a86ba84
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1200
`backtrace` and `execinfo.h` can be provided by libexecinfo on uclibc and musl resulting in the following build failure with any user of abseil-cpp (such as collectd):
```
/home/buildroot/autobuild/instance-0/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/10.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: /home/buildroot/autobuild/instance-0/output-1/host/bin/../sparc-buildroot-linux-uclibc/sysroot/usr/lib/libabsl_stacktrace.so: undefined reference to `backtrace'
```
[...]
```
libgrpc++ . . . . . . no (libgrpc++ not found)
```
[...]
```
configure: error: "Some plugins are missing dependencies - see the summary above for details"
```
Fixes:
- http://autobuild.buildroot.org/results/6a0484412f020e763ce3ad5bda48f09c78645bff
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Merge dac52cd20e into 93ad4284ac
Merging this change closes#1200
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1200 from ffontaine:master dac52cd20e
PiperOrigin-RevId: 456323163
Change-Id: I3d2206761524d36e2b227c571e2e513f6840ff75
As part of this update, GoogleTest is now using the Abseil flags
implementation, and the flags usage_test needs to be modified to pass.
If building with bazel and --define=absl=1 to force GoogleTest to use
Abseil, a WORKSPACE dependency on the abseil branch of the RE2 project
is now required.
PiperOrigin-RevId: 455512245
Change-Id: I2025df0c86006fac97a80713524c9d0aae8b358e
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1197
Fix the following musl build failure on mips:
```
In file included from /nvmedata/autobuild/instance-15/output-1/build/libabseil-cpp-20211102.0/absl/base/internal/low_level_alloc.cc:26:
/nvmedata/autobuild/instance-15/output-1/build/libabseil-cpp-20211102.0/absl/base/internal/direct_mmap.h:49:10: fatal error: sgidefs.h: No such file or directory
49 | #include <sgidefs.h>
| ^~~~~~~~~~~
```
Fixes:
- http://autobuild.buildroot.org/results/3fa027e602bacb22316fb5d9b233baa0b0f0e845
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Merge c9b5b5c547 into a184bab83f
Merging this change closes#1197
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1197 from ffontaine:master c9b5b5c547
PiperOrigin-RevId: 455467767
Change-Id: I1905f7d70e914288bc1524a52adce3476a779fd8
Using GoogleTest at 0320f517fd920866d918e564105d68fd4362040a breaks Windows DLLs.
PiperOrigin-RevId: 455452411
Change-Id: Iff89a01351c01487786a22701efedf25860fadf9
As part of this update, GoogleTest is now using the Abseil flags
implementation, and the flags usage_test needs to be modified to pass.
If building with bazel and --define=absl=1 to force GoogleTest to use
Abseil, a WORKSPACE dependency on the abseil branch of the RE2 project
is now required.
PiperOrigin-RevId: 455257879
Change-Id: Id1548ce7d6a95b747b72a4f255d31ced98e36006