forked from cory/tildefriends
Builds for Haiku.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4584 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__)
|
||||
#include <signal.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/resource.h>
|
||||
@ -331,7 +331,7 @@ static void _tf_run_task_thread(void* data)
|
||||
#if !TARGET_OS_IPHONE
|
||||
static void _shed_privileges()
|
||||
{
|
||||
#if !defined(_WIN32)
|
||||
#if !defined(_WIN32) && !defined(__HAIKU__)
|
||||
struct rlimit zeroLimit;
|
||||
zeroLimit.rlim_cur = 0;
|
||||
zeroLimit.rlim_max = 0;
|
||||
@ -484,7 +484,7 @@ static int _tf_command_sandbox(const char* file, int argc, char* argv[])
|
||||
return 2;
|
||||
}
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__)
|
||||
prctl(PR_SET_PDEATHSIG, SIGHUP);
|
||||
#endif
|
||||
tf_task_t* task = tf_task_create();
|
||||
@ -607,7 +607,7 @@ static void _startup(int argc, char* argv[])
|
||||
_backtrace_error,
|
||||
NULL);
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__)
|
||||
prctl(PR_SET_PDEATHSIG, SIGKILL);
|
||||
#endif
|
||||
tf_mem_replace_uv_allocator();
|
||||
|
@ -436,6 +436,10 @@ void tf_free(void* ptr)
|
||||
|
||||
char* tf_strdup(const char* string)
|
||||
{
|
||||
if (!string)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
size_t len = strlen(string);
|
||||
char* buffer = tf_malloc(len + 1);
|
||||
if ( buffer)
|
||||
|
@ -282,7 +282,7 @@ static char* _tf_ssb_import_read_current_file_from_zip(unzFile zip, size_t* size
|
||||
|
||||
static void _tf_ssb_import_recursive_add_files_from_zip(tf_ssb_t* ssb, unzFile zip, JSContext* context, JSValue files, const char* root)
|
||||
{
|
||||
if (unzGoToFirstFile(zip) == UNZ_OK)
|
||||
if (root && unzGoToFirstFile(zip) == UNZ_OK)
|
||||
{
|
||||
do
|
||||
{
|
||||
@ -355,7 +355,7 @@ static void _tf_ssb_import_app_json_from_zip(tf_ssb_t* ssb, unzFile zip, JSConte
|
||||
void tf_ssb_import_from_zip(tf_ssb_t* ssb, const char* zip_path, const char* user, const char* path)
|
||||
{
|
||||
unzFile zip = unzOpen(zip_path);
|
||||
if (zip)
|
||||
if (zip && path)
|
||||
{
|
||||
tf_printf("Importing from %s.\n", zip_path);
|
||||
if (unzGoToFirstFile(zip) == UNZ_OK)
|
||||
|
@ -685,13 +685,16 @@ void tf_ssb_test_bench(const tf_test_options_t* options)
|
||||
uv_run(&loop, UV_RUN_DEFAULT);
|
||||
|
||||
char* trace_data = tf_trace_export(trace);
|
||||
FILE* file = fopen("out/trace.json", "wb");
|
||||
if (file)
|
||||
if (trace_data)
|
||||
{
|
||||
fwrite(trace_data, 1, strlen(trace_data), file);
|
||||
fclose(file);
|
||||
FILE* file = fopen("out/trace.json", "wb");
|
||||
if (file)
|
||||
{
|
||||
fwrite(trace_data, 1, strlen(trace_data), file);
|
||||
fclose(file);
|
||||
}
|
||||
tf_free(trace_data);
|
||||
}
|
||||
tf_free(trace_data);
|
||||
|
||||
tf_ssb_destroy(ssb1);
|
||||
tf_ssb_destroy(ssb0);
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#include <unwind.h>
|
||||
#elif !defined(_WIN32)
|
||||
#elif !defined(_WIN32) && !defined(__HAIKU__)
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
@ -497,9 +497,9 @@ static int _tf_util_backtrace_callback(void* data, uintptr_t pc, const char* fil
|
||||
static void _tf_util_backtrace_error(void* data, const char* message, int error)
|
||||
{
|
||||
char** stack = data;
|
||||
int length = strlen(message);
|
||||
if (message)
|
||||
{
|
||||
int length = strlen(message);
|
||||
int current = *stack ? strlen(*stack) : 0;
|
||||
*stack = tf_resize_vec(*stack, current + length + 1);
|
||||
memcpy(*stack + current, message, length + 1);
|
||||
@ -587,6 +587,8 @@ int tf_util_backtrace(void** buffer, int count)
|
||||
android_backtrace_t state = { .current = buffer, .end = buffer + count };
|
||||
_Unwind_Backtrace(_android_unwind_callback, &state);
|
||||
return state.current - buffer;
|
||||
#elif defined(__HAIKU__)
|
||||
return 0;
|
||||
#else
|
||||
return backtrace(buffer, count);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user