[XRay][compiler-rt] Update use of internal_mmap
authorDean Michael Berris <dberris@google.com>
Fri, 21 Sep 2018 16:34:42 +0000 (16:34 +0000)
committerDean Michael Berris <dberris@google.com>
Fri, 21 Sep 2018 16:34:42 +0000 (16:34 +0000)
commit0cb22386e08a754dae724f96fbc9e38273edafba
tree63a93857743b17cbec855405dfd85855ddbbf1e8
parentf8ecb22dcb2c8efdfcd351940a842469f339dedc
[XRay][compiler-rt] Update use of internal_mmap

Summary:
The implementation of `internal_mmap(...)` deviates from the contract of
`mmap(...)` -- i.e. error returns are actually the equivalent of `errno`
results. We update how XRay uses `internal_mmap(...)` to better handle
these error conditions.

In the process, we change the default pointers we're using from `char*`
to `uint8_t*` to prevent potential usage of the pointers in the string
library functions that expect to operate on `char*`.

We also take the chance to "promote" sizes of individual `internal_mmap`
requests to at least page size bytes, consistent with the expectations
of calls to `mmap`.

Reviewers: cryptoad, mboerger

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52361

llvm-svn: 342745
compiler-rt/lib/xray/xray_allocator.h
compiler-rt/lib/xray/xray_buffer_queue.h
compiler-rt/lib/xray/xray_fdr_logging.cc
compiler-rt/lib/xray/xray_profile_collector.cc