diff options
author | Fred Wright <fw@fwright.net> | 2017-01-21 00:53:50 -0800 |
---|---|---|
committer | Fred Wright <fw@fwright.net> | 2017-01-22 14:02:55 -0800 |
commit | 390b32f32c166ff8e5a04390cca75247993be73c (patch) | |
tree | 5e6cf5a8ffc9c791d887e2c52b8f526191668af3 /os_compat.c | |
parent | 0dd7064300b7339c5a47843804f63b4395127080 (diff) | |
download | gpsd-390b32f32c166ff8e5a04390cca75247993be73c.tar.gz |
Initial edit and use of new os_compat.c.
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.
Diffstat (limited to 'os_compat.c')
-rw-r--r-- | os_compat.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/os_compat.c b/os_compat.c index f7c23839..95b38579 100644 --- a/os_compat.c +++ b/os_compat.c @@ -1,10 +1,20 @@ /* - * Simulate ANSI/POSIX conformance on platforms that don't have it - * - * This file is Copyright (c) 2010 by the GPSD project + * This file is Copyright (c) 2017 by the GPSD project * BSD terms apply: see the file COPYING in the distribution root for details. + * + * This file contains functions to deal with compatibility issues across OSes. + * + * The initial version of this file is a near-verbatim concatenation of the + * following three source files: + * clock_gettime.c + * daemon.c + * strl.c + * History of this code prior to the creation of this file can be found + * in the histories of those files. */ +/* Simulate ANSI/POSIX clock_gettime() on platforms that don't have it */ + #include <time.h> #include <sys/time.h> @@ -31,7 +41,10 @@ int clock_gettime(clockid_t clk_id UNUSED, struct timespec *ts) } #endif /* HAVE_CLOCK_GETTIME */ -/* end */ +/* End of clock_gettime section */ + +/* Simulate Linux/BSD daemon() on platforms that don't have it */ + #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> @@ -79,11 +92,10 @@ int daemon(int nochdir, int noclose) #endif /* HAVE_DAEMON */ -// end -/* - * This file is Copyright (c) 2010 by the GPSD project - * BSD terms apply: see the file COPYING in the distribution root for details. - */ +/* End of daemon section */ + +/* Provide BSD strlcat()/strlcpy() on platforms that don't have it */ + #include <string.h> #include <time.h> /* for time_t */ #include "gpsd_config.h" @@ -228,3 +240,5 @@ size_t strlcpy(char *dst, const char *src, size_t siz) } #endif /* __UNUSED__ */ #endif /* HAVE_STRLCPY */ + +/* End of strlcat()/strlcpy() section */ |