Index: source/lib/sysdep/os/linux/ldbg.cpp =================================================================== --- source/lib/sysdep/os/linux/ldbg.cpp +++ source/lib/sysdep/os/linux/ldbg.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2010-2019 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -33,6 +33,8 @@ #include "lib/sysdep/sysdep.h" #include "lib/debug.h" +#include + #if OS_ANDROID // Android NDK doesn't support backtrace() @@ -147,7 +149,17 @@ #endif -void debug_SetThreadName(char const* UNUSED(name)) +void debug_SetThreadName(char const* name) { - // Currently unimplemented + char pathname[32]; + pid_t tid = syscall(SYS_gettid); + snprintf(pathname, 32, "/proc/self/task/%u/comm", tid); + + FILE* comm = fopen(pathname, "w"); + if (!comm) + return; + + std::string limited_name(name, 15); + fputs(limited_name.c_str(), comm); + fclose(comm); } Index: source/network/NetServer.cpp =================================================================== --- source/network/NetServer.cpp +++ source/network/NetServer.cpp @@ -218,6 +218,8 @@ #if CONFIG2_MINIUPNPC void CNetServerWorker::SetupUPnP() { + debug_SetThreadName("UPnP"); + // Values we want to set. char psPort[6]; sprintf_s(psPort, ARRAY_SIZE(psPort), "%d", PS_DEFAULT_PORT);