diff options
-rw-r--r-- | SConstruct | 28 | ||||
-rw-r--r-- | getsid.c | 16 | ||||
-rw-r--r-- | libgps_shm.c | 6 | ||||
-rw-r--r-- | shmexport.c | 6 |
4 files changed, 51 insertions, 5 deletions
@@ -588,6 +588,18 @@ else: bluezlibs = [] env["bluez"] = False + #in_port_t is not defined on Android + if not config.CheckType("in_port_t","#include <netinet/in.h>"): + announce("Did not find in_port_t typedef, assuming unsigned short int") + confdefs.append("typedef unsigned short int in_port_t;\n") + + #SUN_LEN is not defined on Android + if not config.CheckDeclaration("SUN_LEN", "#include <sys/un.h>") and not config.CheckDeclaration("SUN_LEN", "#include <linux/un.h>"): + announce("SUN_LEN is not system-defined, using local definition") + confdefs.append("#ifndef SUN_LEN\n") + confdefs.append("#define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) + strlen((ptr)->sun_path))\n") + confdefs.append("#endif /* SUN_LEN */\n") + if config.CheckHeader(["bits/sockaddr.h", "linux/can.h"]): confdefs.append("#define HAVE_LINUX_CAN_H 1\n") announce("You have kernel CANbus available.") @@ -628,7 +640,7 @@ else: # check function after libraries, because some function require library # for example clock_gettime() require librt on Linux - for f in ("daemon", "strlcpy", "strlcat", "clock_gettime"): + for f in ("daemon", "strlcpy", "strlcat", "clock_gettime","getsid"): if config.CheckFunc(f): confdefs.append("#define HAVE_%s 1\n" % f.upper()) else: @@ -687,6 +699,7 @@ else: # ifdef __cplusplus extern "C" { # endif +#include <string.h> size_t strlcat(/*@out@*/char *dst, /*@in@*/const char *src, size_t size); # ifdef __cplusplus } @@ -696,11 +709,23 @@ size_t strlcat(/*@out@*/char *dst, /*@in@*/const char *src, size_t size); # ifdef __cplusplus extern "C" { # endif +#include <string.h> size_t strlcpy(/*@out@*/char *dst, /*@in@*/const char *src, size_t size); # ifdef __cplusplus } # endif #endif +#ifndef HAVE_GETSID +# ifdef __cplusplus +extern "C" { +# endif +#include <unistd.h> +pid_t getsid(pid_t pid); +# ifdef __cplusplus +} +# endif +#endif + #define GPSD_CONFIG_H ''') @@ -785,6 +810,7 @@ libgps_sources = [ "rtcm3_json.c", "shared_json.c", "strl.c", + "getsid.c", ] if env['libgpsmm']: diff --git a/getsid.c b/getsid.c new file mode 100644 index 00000000..b6d5313f --- /dev/null +++ b/getsid.c @@ -0,0 +1,16 @@ +/* + * This file is Copyright (c) 2010 by the GPSD project + * BSD terms apply: see the file COPYING in the distribution root for details. + */ +#include "gpsd_config.h" + +#ifndef HAVE_GETSID +#include <unistd.h> +#include <sys/syscall.h> + +/* This implementation is required for Android */ + +pid_t getsid(pid_t pid) { + return syscall(__NR_getsid, pid); +} +#endif /* HAVE_GETSID */ diff --git a/libgps_shm.c b/libgps_shm.c index 5f79aee2..c489af09 100644 --- a/libgps_shm.c +++ b/libgps_shm.c @@ -14,6 +14,10 @@ PERMISSIONS BSD terms apply: see the file COPYING in the distribution root for details. ***************************************************************************/ +#include "gpsd_config.h" + +#ifdef SHM_EXPORT_ENABLE + #include <stddef.h> #include <string.h> #include <errno.h> @@ -25,8 +29,6 @@ PERMISSIONS #include "gpsd.h" #include "libgps.h" -#ifdef SHM_EXPORT_ENABLE - /*@-matchfields@*/ struct privdata_t { diff --git a/shmexport.c b/shmexport.c index 3b764b57..f8645941 100644 --- a/shmexport.c +++ b/shmexport.c @@ -14,6 +14,10 @@ PERMISSIONS BSD terms apply: see the file COPYING in the distribution root for details. ***************************************************************************/ +#include "gpsd_config.h" + +#ifdef SHM_EXPORT_ENABLE + #include <stddef.h> #include <string.h> #include <errno.h> @@ -24,8 +28,6 @@ PERMISSIONS #include "gpsd.h" #include "libgps.h" /* for SHM_PSEUDO_FD */ -#ifdef SHM_EXPORT_ENABLE - /*@ -mustfreeonly -nullstate -mayaliasunique @*/ bool shm_acquire(struct gps_context_t *context) |