Integrate C++11 branch into 5_1-new
This commit is contained in:
@@ -34,7 +34,7 @@ static void safe_print( int fd, ... )
|
||||
for(;;)
|
||||
{
|
||||
const char *p = va_arg( ap, const char * );
|
||||
if( p == NULL )
|
||||
if( p == nullptr )
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -88,13 +88,13 @@ static void NORETURN spawn_child_process( int from_parent )
|
||||
strncpy( magic, CHILD_MAGIC_PARAMETER, sizeof(magic) );
|
||||
|
||||
/* Use execve; it's the lowest-level of the exec calls. The others may allocate. */
|
||||
char *argv[3] = { path, magic, NULL };
|
||||
char *envp[1] = { NULL };
|
||||
char *argv[3] = { path, magic, nullptr };
|
||||
char *envp[1] = { nullptr };
|
||||
execve( path, argv, envp );
|
||||
|
||||
/* If we got here, the exec failed. We can't call strerror. */
|
||||
// safe_print(fileno(stderr), "Crash handler execl(", path, ") failed: ", strerror(errno), "\n", NULL);
|
||||
safe_print( fileno(stderr), "Crash handler execl(", path, ") failed: ", itoa( errno ), "\n", NULL );
|
||||
// safe_print(fileno(stderr), "Crash handler execl(", path, ") failed: ", strerror(errno), "\n", nullptr);
|
||||
safe_print( fileno(stderr), "Crash handler execl(", path, ") failed: ", itoa( errno ), "\n", nullptr );
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
@@ -116,13 +116,13 @@ static bool parent_write( int to_child, const void *p, size_t size )
|
||||
int ret = retried_write( to_child, p, size );
|
||||
if( ret == -1 )
|
||||
{
|
||||
safe_print( fileno(stderr), "Unexpected write() result (", strerror(errno), ")\n", NULL );
|
||||
safe_print( fileno(stderr), "Unexpected write() result (", strerror(errno), ")\n", nullptr );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( size_t(ret) != size )
|
||||
{
|
||||
safe_print( fileno(stderr), "Unexpected write() result (", itoa(ret), ")\n", NULL );
|
||||
safe_print( fileno(stderr), "Unexpected write() result (", itoa(ret), ")\n", nullptr );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ static void parent_process( int to_child, const CrashData *crash )
|
||||
/* 4. Write RecentLogs. */
|
||||
int cnt = 0;
|
||||
const char *ps[1024];
|
||||
while( cnt < 1024 && (ps[cnt] = RageLog::GetRecentLog( cnt )) != NULL )
|
||||
while( cnt < 1024 && (ps[cnt] = RageLog::GetRecentLog( cnt )) != nullptr )
|
||||
++cnt;
|
||||
|
||||
parent_write(to_child, &cnt, sizeof(cnt));
|
||||
@@ -211,9 +211,9 @@ static void parent_process( int to_child, const CrashData *crash )
|
||||
|
||||
static void RunCrashHandler( const CrashData *crash )
|
||||
{
|
||||
if( g_pCrashHandlerArgv0 == NULL )
|
||||
if( g_pCrashHandlerArgv0 == nullptr )
|
||||
{
|
||||
safe_print( fileno(stderr), "Crash handler failed: CrashHandlerHandleArgs was not called\n", NULL );
|
||||
safe_print( fileno(stderr), "Crash handler failed: CrashHandlerHandleArgs was not called\n", nullptr );
|
||||
_exit( 1 );
|
||||
}
|
||||
|
||||
@@ -221,9 +221,9 @@ static void RunCrashHandler( const CrashData *crash )
|
||||
struct sigaction sa;
|
||||
memset( &sa, 0, sizeof(sa) );
|
||||
sa.sa_handler = SIG_IGN;
|
||||
if( sigaction( SIGPIPE, &sa, NULL ) != 0 )
|
||||
if( sigaction( SIGPIPE, &sa, nullptr ) != 0 )
|
||||
{
|
||||
safe_print( fileno(stderr), "sigaction() failed: %s", strerror(errno), NULL );
|
||||
safe_print( fileno(stderr), "sigaction() failed: %s", strerror(errno), nullptr );
|
||||
/* non-fatal */
|
||||
}
|
||||
|
||||
@@ -237,22 +237,22 @@ static void RunCrashHandler( const CrashData *crash )
|
||||
switch( crash->type )
|
||||
{
|
||||
case CrashData::SIGNAL:
|
||||
safe_print( fileno(stderr), "Fatal signal (", SignalName(crash->signal), ")", NULL );
|
||||
safe_print( fileno(stderr), "Fatal signal (", SignalName(crash->signal), ")", nullptr );
|
||||
break;
|
||||
|
||||
case CrashData::FORCE_CRASH:
|
||||
safe_print( fileno(stderr), "Crash handler failed: \"", crash->reason, "\"", NULL );
|
||||
safe_print( fileno(stderr), "Crash handler failed: \"", crash->reason, "\"", nullptr );
|
||||
break;
|
||||
|
||||
default:
|
||||
safe_print( fileno(stderr), "Unexpected RunCrashHandler call (", itoa(crash->type), ")", NULL );
|
||||
safe_print( fileno(stderr), "Unexpected RunCrashHandler call (", itoa(crash->type), ")", nullptr );
|
||||
break;
|
||||
}
|
||||
|
||||
if( active == 1 )
|
||||
safe_print( fileno(stderr), " while still in the crash handler\n", NULL);
|
||||
safe_print( fileno(stderr), " while still in the crash handler\n", nullptr);
|
||||
else if( active == 2 )
|
||||
safe_print( fileno(stderr), " while in the crash handler child\n", NULL);
|
||||
safe_print( fileno(stderr), " while in the crash handler child\n", nullptr);
|
||||
|
||||
_exit( 1 );
|
||||
}
|
||||
@@ -267,14 +267,14 @@ static void RunCrashHandler( const CrashData *crash )
|
||||
int fds[2];
|
||||
if( pipe(fds) != 0 )
|
||||
{
|
||||
safe_print( fileno(stderr), "Crash handler pipe() failed: ", strerror(errno), "\n", NULL );
|
||||
safe_print( fileno(stderr), "Crash handler pipe() failed: ", strerror(errno), "\n", nullptr );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
pid_t childpid = fork();
|
||||
if( childpid == -1 )
|
||||
{
|
||||
safe_print( fileno(stderr), "Crash handler fork() failed: ", strerror(errno), "\n", NULL );
|
||||
safe_print( fileno(stderr), "Crash handler fork() failed: ", strerror(errno), "\n", nullptr );
|
||||
_exit( 1 );
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ static void RunCrashHandler( const CrashData *crash )
|
||||
RageThread::ResumeAllThreads();
|
||||
|
||||
if( WIFSIGNALED(status) )
|
||||
safe_print( fileno(stderr), "Crash handler child exited with signal ", itoa(WTERMSIG(status)), "\n", NULL );
|
||||
safe_print( fileno(stderr), "Crash handler child exited with signal ", itoa(WTERMSIG(status)), "\n", nullptr );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ void CrashHandler::ForceCrash( const char *reason )
|
||||
strncpy( crash.reason, reason, sizeof(crash.reason) );
|
||||
crash.reason[ sizeof(crash.reason)-1 ] = 0;
|
||||
|
||||
GetBacktrace( crash.BacktracePointers[0], BACKTRACE_MAX_SIZE, NULL );
|
||||
GetBacktrace( crash.BacktracePointers[0], BACKTRACE_MAX_SIZE, nullptr );
|
||||
|
||||
RunCrashHandler( &crash );
|
||||
}
|
||||
@@ -352,7 +352,7 @@ void CrashHandler::ForceDeadlock( RString reason, uint64_t iID )
|
||||
|
||||
crash.type = CrashData::FORCE_CRASH;
|
||||
|
||||
GetBacktrace( crash.BacktracePointers[0], BACKTRACE_MAX_SIZE, NULL );
|
||||
GetBacktrace( crash.BacktracePointers[0], BACKTRACE_MAX_SIZE, nullptr );
|
||||
|
||||
if( iID == GetInvalidThreadId() )
|
||||
{
|
||||
@@ -384,7 +384,7 @@ void CrashHandler::CrashSignalHandler( int signal, siginfo_t *si, const ucontext
|
||||
static volatile bool bInCrashSignalHandler = false;
|
||||
if( bInCrashSignalHandler )
|
||||
{
|
||||
safe_print( 2, "Fatal: crash from within the crash signal handler\n", NULL );
|
||||
safe_print( 2, "Fatal: crash from within the crash signal handler\n", nullptr );
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user