Fixes for building on FreeBSD.
This commit is contained in:
parent
e240a692a7
commit
0ec090f31a
@ -39,6 +39,7 @@ Clients:
|
||||
|
||||
Build:
|
||||
- Fixes for building on NetBSD. Closes #258.
|
||||
- Fixes for building on FreeBSD.
|
||||
|
||||
|
||||
1.5 - 20180502
|
||||
|
8
config.h
8
config.h
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user