Builds for OpenBSD!

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4620 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-11-08 03:36:08 +00:00
parent 6cdf207dcd
commit 52aa6eed0d
6 changed files with 46 additions and 7 deletions

View File

@ -18,10 +18,13 @@
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__)
#include <signal.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#endif
#if defined(__linux__)
#include <sys/prctl.h>
#endif
#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif
@ -362,7 +365,7 @@ static void _shed_privileges()
perror("setrlimit(RLIMIT_NPROC, {0, 0})");
exit(-1);
}
#if !defined(__MACH__)
#if !defined(__MACH__) && !defined(__OpenBSD__)
if (setrlimit(RLIMIT_LOCKS, &zeroLimit) != 0)
{
perror("setrlimit(RLIMIT_LOCKS, {0, 0})");
@ -484,7 +487,7 @@ static int _tf_command_sandbox(const char* file, int argc, char* argv[])
return 2;
}
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__)
#if defined(__linux__)
prctl(PR_SET_PDEATHSIG, SIGHUP);
#endif
tf_task_t* task = tf_task_create();
@ -607,7 +610,7 @@ static void _startup(int argc, char* argv[])
_backtrace_error,
NULL);
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__)
#if defined(__linux__)
prctl(PR_SET_PDEATHSIG, SIGKILL);
#endif
tf_mem_replace_uv_allocator();

View File

@ -394,17 +394,29 @@ size_t tf_mem_get_uv_malloc_size()
return s_uv_malloc_size;
}
#if defined(__OpenBSD__)
void* _tf_tls_alloc(size_t size)
#else
void* _tf_tls_alloc(size_t size, const char* file, int line)
#endif
{
return _tf_alloc(&s_tls_malloc_size, size);
}
#if defined(__OpenBSD__)
void* _tf_tls_realloc(void* ptr, size_t size)
#else
void* _tf_tls_realloc(void* ptr, size_t size, const char* file, int line)
#endif
{
return _tf_realloc(&s_tls_malloc_size, ptr, size);
}
#if defined(__OpenBSD__)
void _tf_tls_free(void* ptr)
#else
void _tf_tls_free(void* ptr, const char* file, int line)
#endif
{
_tf_free(&s_tls_malloc_size, ptr);
}

View File

@ -33,7 +33,7 @@
#include <unistd.h>
#endif
#if !defined(__APPLE__)
#if !defined(__APPLE__) && !defined(__OpenBSD__)
#include <malloc.h>
#endif

View File

@ -16,6 +16,10 @@
#define WEXITSTATUS(x) (x)
#endif
#if defined(__OpenBSD__)
#include <sys/wait.h>
#endif
#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif