diff options
author | Robert Norris <rw_norris@hotmail.com> | 2017-02-14 21:30:25 +0000 |
---|---|---|
committer | Fred Wright <fw@fwright.net> | 2017-02-17 14:46:05 -0800 |
commit | 92e30abaa3f7fb298d05ebe207c16f7096d0c15a (patch) | |
tree | d55dc7876efef57847e635afb80efd0274cfa3fb /os_compat.c | |
parent | b8890ecae932892fd8e6fc45a3f003c937d3f82f (diff) | |
download | gpsd-92e30abaa3f7fb298d05ebe207c16f7096d0c15a.tar.gz |
Windows libgps support
Add Windows versions for network functions and disable unused features.
Add detection of various headers and functions that aren't available in
Windows. Note that netlib_localsocket() has no functional implementation
on Windows, but it isn't to be used on that platform and it's not part of
libgps anyway.
Using send() rather than write() seems to work on Windows.
For Windows need to ensure networking is initialised on opening of sockets
(and then correspondingly shutdown upon closing).
Note that within gpsd.h the termios structures and serial related functions
are removed from the Windows build. These are only accessed in serial.c by
gpsd, so since the Windows build is only generating libgps there is
currently no need to modify serial.c.
And for os_compat.h, daemon() is simply disabled under Windows as it's not
used within libgps.
TESTED:
Confirmed compiles under a cross compiler.
Manual build and run of test_libgps on Windows which successfully connects
to a host running GPSD
Manual build DLL version and link with a Windows version of a program
(Viking) that then successfully connects and monitors positions from GPSD
Otherwise no effect on current supported systems.
'scons build-all check' - passes.
Signed-off-by: Fred Wright <fw@fwright.net>
Diffstat (limited to 'os_compat.c')
-rw-r--r-- | os_compat.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/os_compat.c b/os_compat.c index b110f4ba..dafbb7a4 100644 --- a/os_compat.c +++ b/os_compat.c @@ -45,7 +45,8 @@ int clock_gettime(clockid_t clk_id, struct timespec *ts) /* End of clock_gettime section */ #ifndef HAVE_DAEMON - +#ifndef HAVE_WINSOCK2_H +/* No daemon() provided for Windows as not currently needed */ /* Simulate Linux/BSD daemon() on platforms that don't have it */ #include <stdlib.h> @@ -90,7 +91,7 @@ int os_daemon(int nochdir, int noclose) /* coverity[leaked_handle] Intentional handle duplication */ return 0; } - +#endif /* HAVE_WINSOCK2_H */ #else /* HAVE_DAEMON */ #ifdef __linux__ |