diff options
author | Bartosz Taudul <wolf@nereid.pl> | 2021-12-04 20:58:17 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf@nereid.pl> | 2021-12-05 03:32:33 +0300 |
commit | 6a0d2336133387d48e065f3fe2652017b6ba0d99 (patch) | |
tree | b61d429841196d5ecbe5384555fe7f21ddd2b3d7 | |
parent | 22284d57e7cae1522f4c9f7b20541c83efabc30c (diff) |
Proper mmap failure detection.
-rw-r--r-- | client/TracyRingBuffer.hpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/client/TracyRingBuffer.hpp b/client/TracyRingBuffer.hpp index cb6248c1..b1d426ae 100644 --- a/client/TracyRingBuffer.hpp +++ b/client/TracyRingBuffer.hpp @@ -1,3 +1,5 @@ +#include <errno.h> + namespace tracy { @@ -14,8 +16,9 @@ public: assert( __builtin_popcount( Size ) == 1 ); m_mapSize = Size + pageSize; auto mapAddr = mmap( nullptr, m_mapSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 ); - if( !mapAddr ) + if( mapAddr == MAP_FAILED ) { + TracyDebug( "mmap failed: errno %i (%s)\n", errno, strerror( errno ) ); m_fd = 0; m_metadata = nullptr; close( fd ); |