mirror of
https://github.com/wolfpld/tracy
synced 2025-05-01 13:13:53 +00:00
Proper mmap failure detection.
This commit is contained in:
parent
22284d57e7
commit
6a0d233613
@ -1,3 +1,5 @@
|
|||||||
|
#include <errno.h>
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -14,8 +16,9 @@ public:
|
|||||||
assert( __builtin_popcount( Size ) == 1 );
|
assert( __builtin_popcount( Size ) == 1 );
|
||||||
m_mapSize = Size + pageSize;
|
m_mapSize = Size + pageSize;
|
||||||
auto mapAddr = mmap( nullptr, m_mapSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 );
|
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_fd = 0;
|
||||||
m_metadata = nullptr;
|
m_metadata = nullptr;
|
||||||
close( fd );
|
close( fd );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user