summaryrefslogtreecommitdiff
path: root/os_compat.c
Commit message (Collapse)AuthorAgeFilesLines
* os_compat: OSX daemon() warning fix.Fred Wright2019-03-211-2/+27
| | | | | | | | | | | | | | | | | | | | | | | OSX considers the daemon() call deprecated. This is mainly because real OSX daemons are expected to run as launchd children, but since some programs here daemonize for convenience, and since self-daemonization is sometimes useful for testing, we can't really get rid of it. Previous work consolidated daemon() calls into os_compat, reducing the number of warnings, and this change gets rid of them altogether. There doesn't seem to be any easy way to avoid the warnings except by avoiding the normal declaration of daemon(), which is what we do here by duplicating it locally. If daemon() ever actually disappears, it could be reintroduced via the usual double-fork approach. TESTED: Ran "build-all check" as well as testing daemonization on a Mac Pro 10.9 and 10.14, MacBook Pro 10.9, PowerBook 10.5, and VMs for OSX 10.5-10.13, Ubuntu 14.04, CentOS 7, Fedora 25, FreeBSD 10.3, OpenBSD 5.6 (64- and 32-bit), and NetBSD 6.1.5.
* os_compat: Fix some comments.Fred Wright2019-03-211-1/+5
|
* LICENSE: Update licenses for consistency. No functional changes.Gary E. Miller2018-11-191-3/+3
|
* SPDXify the licerse references.Eric S. Raymond2018-03-081-1/+1
|
* Fix daemon() handling on hurd/kfreebsd.Bernd Zeimetz2018-01-011-1/+1
| | | | | Debian Bug #879963 Thanks to Pino Toscano for the patch.
* OS syslog compatibility fallback.Robert Norris2017-03-051-0/+30
| | | | | | | | | | | | | | | | Mainly for Windows systems which doesn't have syslog(). Implement simple fallback to print to stderr, rather than a more complicated use of Windows Event Log. Also basic fallbacks for openlog() and closelog() which don't really do anything. TESTED: Functions build on Windows cross build 'scons build-all check' passes on Linux Signed-off-by: Fred Wright <fw@fwright.net>
* Changes error code from dummy os_daemon().Fred Wright2017-03-041-1/+1
| | | | | | | | | EPERM is closer to the truth than EINVAL in the case where daemonization isn't available at all. Some sort of generic "unsupported" error would be even better, but doesn't exist. TESTED: No. This is only expected to apply to Windows.
* Cleans up os_daemon() in Windows case.Fred Wright2017-02-191-3/+15
| | | | | | | | | | | | | This provides an always-failing os_daemon() for platforms (e.g., Windows) that can't provide a real daemon() call. This is more consistent than simply omitting the function. It also bases the condition on the lack of fork(), rather than the presence of winsock2.h. TESTED: Ran "scons build-all check" on OSX, Linux, FreeBSD, OpenBSD, and NetBSD. Verified that HAVE_FORK is set in all cases.
* Windows libgps supportRobert Norris2017-02-171-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Centralizes daemon() calls.Fred Wright2017-01-221-3/+23
| | | | | | | | | | | | | | | | This defines a new function os_daemon() (in os_compat.c), which is either the old replacement daemon() renamed, or a wrapper around the actual daemon() call. This allows any issues related to daemon() (which exist on some platforms) to be dealt with in one place. No such changes are present yet, so platforms giving warnings for the use of daemon() continue to do so, but now only in the compilation of os_compat.c. Unfortunately, the current build procedure typically compiles os_compat.c multiple times, so the warnings still appear multiple times. TESTED: Ran "scons build-all check" on OSX 10.9, OSX 10.12, Ubuntu 14, and FreeBSD 10.3.
* Initial creation of os_compat.h.Fred Wright2017-01-221-3/+1
| | | | | | | | | | | | | | | | | This creates a header for os_compat.c, and moves the related prototypes into it from gpsd_config.h (as created by SConstruct), after adding references to it to gpsd.h (via gpsd.h-tail) and a few other sources that need it but don't include gpsd.h. It also removes includes of <time.h> in the places where they were only needed for the code now removed from gpsd_config.h. TESTED: Ran "scons build-all check" on OSX 10.9 (with strlcat/strlcpy but no clock_gettime), OSX 10.12 (with strlcat/strlcpy and clock_gettime), and Ubuntu 14 (with clock_gettime but no strlcat/strlcpy). Also verified that fallback versions were not being included where unnecessary.
* Cleans up some ordering in os_compat.c.Fred Wright2017-01-221-11/+16
| | | | | | | | | | | | | | | | | | | This rearranges the order of some conditionals and includes, in order to avoid some gratuitous includes where unnecessary. Due to the fact that some actual definitions for the clock_gettime fallback are embedded directly in gpsd_config.h, it's necessary to include <time.h> prior to including it. This will be fixed once the relevant definitions are moved to the upcoming os_compat.h. This also replaces the "UNUSED" in clock_gettime with a void cast, eliminating the need for compiler.h. TESTED: Ran "scons build-all check" on OSX 10.9, OSX 10.12 (which has real clock_gettime) and Ubuntu 14. Also verified that the clock_gettime fallback is present in OSX 10.9, but absent in OSX 10.12 and in Ubuntu 14.
* Initial edit and use of new os_compat.c.Fred Wright2017-01-221-9/+23
| | | | | | | | | | | | | | This change: 1) Makes a few comment-only edits to os_compat.c. 2) Updates the build procedure to use os_compat.c in libgps and in the Python extensions. 3) Deletes the now-obsolete clock_gettime.c, daemon.c, and strl.c. TESTED: Ran "scons build-all check" on OSX 10.9 and Ubuntu 14.
* Initial checkin of new os_compat.c source.Fred Wright2017-01-221-0/+230
This file combines the code from clock_gettime.c, daemon.c, and strl.c into a single "OS compatibility" module. This initial version is just a verbatim concatenation of those three sources, which is not yet used. Editing it for initial use is left to a separate commit for easier tracking of the edits. Since there's no "git cat" operation, the history of the code in this file is not directly available in relation to this file, but can be found in the histories of its three component sources (even after their upcoming deletions). TESTED: Inapplicable.