misc: Add ifdefs for linux specific prctl(2)
This commit is contained in:
parent
ffff0b34c4
commit
c21d42e4ce
2 changed files with 14 additions and 2 deletions
|
@ -29,7 +29,6 @@
|
|||
#include <limits.h>
|
||||
#include <time.h>
|
||||
#include <locale.h>
|
||||
#include <sys/prctl.h>
|
||||
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
|
@ -64,6 +63,10 @@
|
|||
#include "plumbing/transcoding.h"
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
/* Command line option struct */
|
||||
typedef struct str_list
|
||||
{
|
||||
|
@ -681,9 +684,13 @@ main(int argc, char **argv)
|
|||
|
||||
/* Make dumpable */
|
||||
if (opt_dump) {
|
||||
#ifdef PLATFORM_LINUX
|
||||
if (chdir("/tmp"))
|
||||
tvhwarn("START", "failed to change cwd to /tmp");
|
||||
prctl(PR_SET_DUMPABLE, 1);
|
||||
#else
|
||||
tvhwarn("START", "Coredumps not implemented on your platform");
|
||||
#endif
|
||||
}
|
||||
|
||||
umask(0);
|
||||
|
|
|
@ -3,10 +3,13 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/types.h> /* See NOTES */
|
||||
#include <sys/socket.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
tvh_open(const char *pathname, int flags, mode_t mode)
|
||||
{
|
||||
|
@ -94,8 +97,10 @@ thread_wrapper ( void *p )
|
|||
{
|
||||
struct thread_state *ts = p;
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
/* Set name */
|
||||
prctl(PR_SET_NAME, ts->name);
|
||||
#endif
|
||||
|
||||
/* Run */
|
||||
tvhdebug("thread", "created thread %ld [%s / %p(%p)]",
|
||||
|
|
Loading…
Add table
Reference in a new issue