Skip to content

Commit

Permalink
Clean up some compilation warnings, and allow FreeBSD 11.1 (and up) t…
Browse files Browse the repository at this point in the history
…o use

the clock_nanosleep() that is written/maintained for Linux.
  • Loading branch information
cross committed Jul 3, 2017
1 parent 31047bd commit 83c8c61
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ACLOCAL_AMFLAGS = -I m4
JANSSON_CPPFLAGS= -I$(top_builddir)/compat/jansson-2.9/src -I$(top_srcdir)/compat/jansson-2.9/src

if WANT_USBUTILS
USBUTILS_CPPFLAGS = `pkg-config libusb-1.0 --libs --cflags`
USBUTILS_CPPFLAGS = `pkg-config libusb-1.0 --cflags`
else
USBUTILS_CPPFLAGS =
endif
Expand Down
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ if test "x$has_winpthread" != xtrue; then
PTHREAD_LIBS=-lpthread
fi

# Does the system have a POSIX clock_nanosleep (which can be given a
# CLOCK_MONOTONIC argument, can I check for that here too)?
AC_CHECK_FUNCS(clock_nanosleep)

# Drivers that are designed to be run on dedicated hardware should set standalone to yes
# All drivers should prepend an x to the drivercount

Expand Down
2 changes: 1 addition & 1 deletion driver-hashfast.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ static void hfa_check_options(struct hashfast_info *info)
if (!opt_hfa_options)
return;

if (!info->op_name)
if (info->op_name[0] == '\0')
return;

maxlen = strlen(info->op_name);
Expand Down
7 changes: 5 additions & 2 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
#endif
#include <sched.h>

#if (defined(__FreeBSD__) || defined(__OpenBSD__))
# include <pthread_np.h>
#endif

#include "miner.h"
#include "elist.h"
#include "compat.h"
Expand Down Expand Up @@ -1444,8 +1448,7 @@ void cgtimer_sub(cgtimer_t *a, cgtimer_t *b, cgtimer_t *res)
}
#endif /* WIN32 */

#if defined(CLOCK_MONOTONIC) && !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(WIN32) /* Essentially just linux */
//#ifdef CLOCK_MONOTONIC /* Essentially just linux */
#if defined(CLOCK_MONOTONIC) && HAVE_CLOCK_NANOSLEEP /* Mostly just linux */
void cgtimer_time(cgtimer_t *ts_start)
{
clock_gettime(CLOCK_MONOTONIC, ts_start);
Expand Down

0 comments on commit 83c8c61

Please sign in to comment.