mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Proper mmap failure detection.
This commit is contained in:
parent
22284d57e7
commit
6a0d233613
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user