Fixes for building on FreeBSD.

This commit is contained in:
Roger A. Light 2018-08-15 17:02:56 +01:00
parent e240a692a7
commit 0ec090f31a
4 changed files with 13 additions and 8 deletions

View File

@ -39,6 +39,7 @@ Clients:
Build:
- Fixes for building on NetBSD. Closes #258.
- Fixes for building on FreeBSD.
1.5 - 20180502

View File

@ -29,13 +29,13 @@
#ifdef __APPLE__
# define __DARWIN_C_SOURCE
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__SYMBIAN32__) || defined(__QNX__)
# define _XOPEN_SOURCE 700
# define __BSD_VISIBLE 1
# define HAVE_NETINET_IN_H
#else
# define _DEFAULT_SOURCE 1
# define _POSIX_C_SOURCE 200809L
#endif
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__SYMBIAN32__) || defined(__QNX__)
# define HAVE_NETINET_IN_H
#endif
#endif

View File

@ -15,6 +15,7 @@ Contributors:
*/
#define _GNU_SOURCE
#include "config.h"
#include <assert.h>
#include <errno.h>
@ -68,8 +69,6 @@ Contributors:
#include "time_mosq.h"
#include "util_mosq.h"
#include "config.h"
#ifdef WITH_TLS
int tls_ex_index_mosq = -1;
#endif

View File

@ -17,7 +17,7 @@ Contributors:
#include "config.h"
#ifndef WIN32
#include <unistd.h>
#include <time.h>
#endif
#include "mosquitto_internal.h"
@ -80,6 +80,11 @@ void *mosquitto__thread_main(void *obj)
{
struct mosquitto *mosq = obj;
int state;
#ifndef WIN32
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 10000000;
#endif
if(!mosq) return NULL;
@ -91,7 +96,7 @@ void *mosquitto__thread_main(void *obj)
#ifdef WIN32
Sleep(10);
#else
usleep(10000);
nanosleep(&ts, NULL);
#endif
}else{
break;