Fixed headers for FreeBSD

This commit is contained in:
Alexander Sieg 2020-04-12 14:50:59 +02:00
parent 6bac1bd257
commit 6d17515646
7 changed files with 28 additions and 0 deletions

View file

@ -10,7 +10,11 @@
#include <errno.h>
#include <sys/socket.h>
#if __linux__
#include <linux/un.h>
#elif __FreeBSD__
#include <sys/un.h>
#endif
#define LOG_MODULE "foot-client"
#define LOG_ENABLE_DBG 0

4
main.c
View file

@ -10,7 +10,11 @@
#include <unistd.h>
#include <sys/types.h>
#if __linux__
#include <sys/sysinfo.h>
#elif __FreeBSD__
#include <sys/stat.h>
#endif
#include <fcntl.h>
#include <fcft/fcft.h>

4
osc.c
View file

@ -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';

View file

@ -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;

View file

@ -8,7 +8,11 @@
#include <sys/socket.h>
#include <sys/epoll.h>
#if __linux__
#include <linux/un.h>
#elif __FreeBSD__
#include <sys/un.h>
#endif
#include <tllist.h>

2
shm.c
View file

@ -10,8 +10,10 @@
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/time.h>
#if __linux__
#include <linux/mman.h>
#include <linux/memfd.h>
#endif
#include <fcntl.h>
#include <pixman.h>

View file

@ -1,6 +1,11 @@
#include "terminal.h"
#if __linux__
#include <malloc.h>
#elif __FreeBSD__
#include <stdlib.h>
#include <signal.h>
#endif
#include <string.h>
#include <unistd.h>
#include <assert.h>