diff --git a/engine/Engine.cpp b/engine/Engine.cpp index 53883cf3..a1c55e23 100644 --- a/engine/Engine.cpp +++ b/engine/Engine.cpp @@ -70,6 +70,10 @@ typedef void* HMODULE; #include #include +#ifdef HAVE_PRCTL +#include +#endif + #include namespace TelEngine { @@ -1862,6 +1866,11 @@ int Engine::main(int argc, const char** argv, const char** env, RunMode mode, bo #ifdef RLIMIT_CORE while (s_coredump) { +#ifdef HAVE_PRCTL +#ifdef PR_SET_DUMPABLE + prctl(PR_SET_DUMPABLE,1,0,0,0); +#endif +#endif struct rlimit lim; if (!::getrlimit(RLIMIT_CORE,&lim)) { errno = 0; diff --git a/engine/Thread.cpp b/engine/Thread.cpp index 54fdadd9..db4eb766 100644 --- a/engine/Thread.cpp +++ b/engine/Thread.cpp @@ -36,6 +36,10 @@ static int pthread_attr_setinheritsched(pthread_attr_t *,int) { return 0; } #endif #endif +#ifdef HAVE_PRCTL +#include +#endif + #ifndef PTHREAD_STACK_MIN #define PTHREAD_STACK_MIN 16384 #else @@ -302,6 +306,13 @@ void ThreadPrivate::run() ::pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,0); #endif ::pthread_detach(::pthread_self()); +#endif /* _WINDOWS */ + +#ifdef HAVE_PRCTL +#ifdef PR_SET_NAME + if (m_name) + prctl(PR_SET_NAME,(unsigned long)m_name,0,0,0); +#endif #endif // FIXME: possible race if public object is destroyed during thread startup