diff --git a/client.c b/client.c index 754f349b..d605c13f 100644 --- a/client.c +++ b/client.c @@ -10,7 +10,11 @@ #include #include +#if __linux__ #include +#elif __FreeBSD__ +#include +#endif #define LOG_MODULE "foot-client" #define LOG_ENABLE_DBG 0 diff --git a/main.c b/main.c index f47fa036..c4e4b599 100644 --- a/main.c +++ b/main.c @@ -10,7 +10,11 @@ #include #include +#if __linux__ #include +#elif __FreeBSD__ +#include +#endif #include #include diff --git a/osc.c b/osc.c index d28fd057..6ae913e2 100644 --- a/osc.c +++ b/osc.c @@ -327,7 +327,11 @@ osc_set_pwd(struct terminal *term, char *string) if (hostname_end == NULL) return; +#if __linux__ char this_host[HOST_NAME_MAX]; +#elif __FreeBSD__ + char this_host[sysconf(_SC_HOST_NAME_MAX)]; +#endif if (gethostname(this_host, sizeof(this_host)) < 0) this_host[0] = '\0'; diff --git a/render.c b/render.c index 2af605c8..296d5734 100644 --- a/render.c +++ b/render.c @@ -807,8 +807,13 @@ render_worker_thread(void *_ctx) char proc_title[16]; snprintf(proc_title, sizeof(proc_title), "foot:render:%d", my_id); +#if __linux__ if (prctl(PR_SET_NAME, proc_title, 0, 0, 0) < 0) LOG_ERRNO("render worker %d: failed to set process title", my_id); +#elif __FreeBSD__ + setproctitle(proc_title); +#endif + sem_t *start = &term->render.workers.start; sem_t *done = &term->render.workers.done; diff --git a/server.c b/server.c index 75990ecd..cda0bdfd 100644 --- a/server.c +++ b/server.c @@ -8,7 +8,11 @@ #include #include +#if __linux__ #include +#elif __FreeBSD__ +#include +#endif #include diff --git a/shm.c b/shm.c index 0fcc830d..ee880301 100644 --- a/shm.c +++ b/shm.c @@ -10,8 +10,10 @@ #include #include #include +#if __linux__ #include #include +#endif #include #include diff --git a/terminal.c b/terminal.c index 1c00e5ae..2d6564b1 100644 --- a/terminal.c +++ b/terminal.c @@ -1,6 +1,11 @@ #include "terminal.h" +#if __linux__ #include +#elif __FreeBSD__ +#include +#include +#endif #include #include #include