Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ ifeq (Darwin,$(shell uname -s))
LDFLAGS:=-framework CoreServices
endif

# FreeBSD inotify for file watching.

ifeq (FreeBSD,$(shell uname -s))
LIBS+=-linotify
endif

# Bison flags.

# --version prints info to stdout if the -W flags are accepted, else stderr.
Expand Down
7 changes: 5 additions & 2 deletions src/filewatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
#include <vector>
#include <filewatcher.hpp>

#ifdef __linux__
#if defined( __linux__) || defined(__FreeBSD__)

#ifdef __linux__
# include <linux/limits.h>
#endif
# include <limits.h>
# include <sys/inotify.h>
# include <sys/poll.h>
# include <cstring>
Expand Down Expand Up @@ -87,7 +90,7 @@ std::string FileWatcherImpl::WaitFile(unsigned a_timeout_ms)

fds[0].fd = m_fd;
fds[0].events = POLLIN;
nfds = poll(fds, LENGTH(fds), a_timeout_ms);
nfds = poll(fds, LENGTH(fds), (int) a_timeout_ms);
if (nfds < 0) {
std::cerr << "poll: " << strerror(errno) << ".\n";
throw std::runtime_error(__func__);
Expand Down