posix: add explicit includes for FreeBSD

This commit is contained in:
Matthias Ringwald 2023-11-01 14:31:00 +01:00
parent 471bae6fca
commit 10bc401a5a
2 changed files with 19 additions and 12 deletions

View File

@ -46,6 +46,15 @@
#include "btstack_network.h"
#include "btstack_config.h"
#include "btstack_debug.h"
#include "btstack_run_loop.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <arpa/inet.h>
#include <errno.h>
@ -65,19 +74,11 @@
#include <netinet/in.h>
#endif
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef __linux
#include <linux/if.h>
#include <linux/if_tun.h>
#endif
#include "btstack.h"
static int tap_fd = -1;
static uint8_t network_buffer[BNEP_MTU_MIN];
static size_t network_buffer_len = 0;
@ -180,7 +181,7 @@ int btstack_network_up(bd_addr_t network_address){
}
strcpy(tap_dev_name, ifr.ifr_name);
#endif
#ifdef __APPLE__
#if defined(__APPLE__) || defined(__FreeBSD__)
strcpy(tap_dev_name, tap_dev_name_template);
#endif

View File

@ -53,19 +53,25 @@
// enable POSIX functions (needed for -std=c99)
#define _POSIX_C_SOURCE 200809
#ifdef __FreeBSD__
// FreeBSD does not set __BSD_VISIBLE or __XSI_VISIBLE if _POSIX_C_SOURCE is defined
#define __BSD_VISIBLE 1
#define __XSI_VISIBLE 1
#endif
#include "hci_dump_posix_fs.h"
#include "btstack_debug.h"
#include "btstack_util.h"
#include "hci_cmd.h"
#include <sys/time.h> // for timestamps
#include <sys/stat.h> // file modes
#include <time.h>
#include <stdio.h> // printf
#include <fcntl.h> // open
#include <unistd.h> // write
#include <errno.h> // errno
#include <sys/time.h> // for timestamps
#include <sys/stat.h> // file modes
static int dump_file = -1;
static int dump_format;