This compiles on macos for x86_64, at least.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4485 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-10-04 23:20:57 +00:00
parent 6302565942
commit 31af27529e
5 changed files with 69 additions and 17 deletions

View File

@ -44,6 +44,12 @@ JSValue _crypt_gensalt(JSContext* context, JSValueConst this_val, int argc, JSVa
char buffer[16];
#if defined(_WIN32)
ssize_t bytes = SystemFunction036(buffer, sizeof(buffer)) ? sizeof(buffer) : 0;
#elif defined(__APPLE__)
ssize_t bytes = 0;
if (getentropy(buffer, sizeof(buffer)) == 0)
{
bytes = sizeof(buffer);
}
#else
ssize_t bytes = getrandom(buffer, sizeof(buffer), 0);
#endif

View File

@ -16,10 +16,13 @@
#include <stdlib.h>
#include <string.h>
#if !defined(_WIN32) && !defined(__MACH__)
#if !defined(_WIN32) && !defined(__APPLE__)
#include <signal.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#endif
#if !defined(_WIN32)
#include <unistd.h>
#endif
@ -471,7 +474,7 @@ static int _tf_command_sandbox(const char* file, int argc, char* argv[])
return 2;
}
#if !defined(_WIN32) && !defined(__MACH__)
#if !defined(_WIN32) && !defined(__APPLE__)
prctl(PR_SET_PDEATHSIG, SIGHUP);
#endif
tf_task_t* task = tf_task_create();
@ -591,7 +594,7 @@ int main(int argc, char* argv[])
_backtrace_error,
NULL);
#if !defined(_WIN32)
#if !defined(_WIN32) && !defined(__APPLE__)
prctl(PR_SET_PDEATHSIG, SIGKILL);
#endif
tf_mem_replace_uv_allocator();

View File

@ -207,7 +207,7 @@ tf_mem_allocation_t* tf_mem_summarize_allocations(int* out_count)
return result;
}
#if defined(__GNUC__)
#if defined(__GNUC__) && !defined(__APPLE__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
#endif
@ -306,7 +306,7 @@ static void* _tf_realloc(int64_t* total, void* ptr, size_t size)
return NULL;
}
}
#if defined(__GNUC__)
#if defined(__GNUC__) && !defined(__APPLE__)
#pragma GCC diagnostic pop
#endif
@ -334,7 +334,7 @@ static void* _tf_uv_realloc(void* ptr, size_t size)
return _tf_realloc(&s_uv_malloc_size, ptr, size);
}
#if defined(__GNUC__)
#if defined(__GNUC__) && !defined(__APPLE__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
#endif
@ -372,7 +372,7 @@ static void* _tf_uv_calloc(size_t nmemb, size_t size)
return NULL;
}
}
#if defined(__GNUC__)
#if defined(__GNUC__) && !defined(__APPLE__)
#pragma GCC diagnostic pop
#endif

View File

@ -25,14 +25,17 @@
#include <openssl/crypto.h>
#ifndef _WIN32
#include <assert.h>
#include <string.h>
#include <stdio.h>
#if !defined(_WIN32)
#include <unistd.h>
#endif
#include <assert.h>
#if !defined(__APPLE__)
#include <malloc.h>
#include <string.h>
#include <stdio.h>
#endif
#if !defined(_countof)
#define _countof(a) ((int)(sizeof((a)) / sizeof(*(a))))