diff --git a/cbt.h b/cbt.h index 2816d9c..c1f5ff1 100644 --- a/cbt.h +++ b/cbt.h @@ -156,7 +156,9 @@ void cbt_binary_free(struct cbt_binary bin); #include #include #include -#ifndef __APPLE__ +#ifdef __APPLE__ +#include +#else #include #endif #include @@ -236,7 +238,11 @@ void cbt__init(int argc, char **argv, const char *source_file) { cbt_log(CBT_LOG_INFO, "Found C Compiler: %s", cbt_cc); +#ifdef __APPLE__ + CBT_FAIL(proc_pidpath(getpid(), cbt_location, PATH_MAX) != 0); +#else CBT_FAIL(readlink("/proc/self/exe", cbt_location, PATH_MAX) == -1); +#endif cbt_log(CBT_LOG_INFO, "Location: %s", cbt_location); char *cbt_cache_dir = strdup(cbt_location); @@ -514,12 +520,14 @@ int cbt_proc_wait(struct cbt_proc proc) { return -1000; } +#if 1 && !defined(__APPLE__) static void cbt__line_processor_sig_handler(int signal) { (void)signal; } +#endif void *cbt__line_processor(void *arg) { (void)arg; - struct timespec timeout = {.tv_sec = 0, .tv_nsec = 100}; +#if 1 && !defined(__APPLE__) sigset_t sigmask; sigemptyset(&sigmask); sigaddset(&sigmask, SIGUSR1); @@ -530,11 +538,13 @@ void *cbt__line_processor(void *arg) { sa.sa_flags = SA_RESTART; CBT_FAIL(sigaction(SIGUSR1, &sa, NULL) == -1); +#endif while (cbt_running) { pthread_mutex_lock(&_cbt__autoproc_mut); -#if 0 && !defined(__APPLE__) +#if 1 && !defined(__APPLE__) + struct timespec timeout = {.tv_sec = 0, .tv_nsec = 100}; int res = ppoll(cbt__autoproc_fdset.items, cbt__autoproc_fdset.size, &timeout, &sigmask); #else