Make use of prctl() if available.
git-svn-id: http://yate.null.ro/svn/yate/trunk@2729 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
3033dbb105
commit
c0eec08096
|
@ -70,6 +70,10 @@ typedef void* HMODULE;
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef HAVE_PRCTL
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
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;
|
||||
|
|
|
@ -36,6 +36,10 @@ static int pthread_attr_setinheritsched(pthread_attr_t *,int) { return 0; }
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PRCTL
|
||||
#include <sys/prctl.h>
|
||||
#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
|
||||
|
|
Loading…
Reference in New Issue