summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ConfigureChecks.cmake2
-rw-r--r--config.h.cmake2
-rw-r--r--src/socket_wrapper.c16
3 files changed, 16 insertions, 4 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 5b4813b..995f8ce 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -192,4 +192,6 @@ if (NOT WIN32)
test_big_endian(WORDS_BIGENDIAN)
endif (NOT WIN32)
+check_type_size(pid_t SIZEOF_PID_T)
+
set(SWRAP_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "swrap required system libraries")
diff --git a/config.h.cmake b/config.h.cmake
index 81a6c85..4f912bd 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -29,6 +29,8 @@
#cmakedefine HAVE_GETTIMEOFDAY_TZ 1
#cmakedefine HAVE_GETTIMEOFDAY_TZ_VOID 1
+/*************************** DATA TYPES***************************/
+#cmakedefine SIZEOF_PID_T @SIZEOF_PID_T@
/**************************** OPTIONS ****************************/
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index a7d3c1b..addcc17 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -95,6 +95,14 @@ enum swrap_dbglvl_e {
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
+#if SIZEOF_PID_T == 8
+# define SPRIpid PRIu64
+#elif SIZEOF_UID_T == 4
+# define SPRIpid PRIu32
+#else
+# define SPRIpid "%d" /* Sane default for most platforms */
+#endif /* SIZEOF_UID_T */
+
#ifndef ZERO_STRUCT
#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
#endif
@@ -241,22 +249,22 @@ static void swrap_log(enum swrap_dbglvl_e dbglvl, const char *format, ...)
switch (dbglvl) {
case SWRAP_LOG_ERROR:
fprintf(stderr,
- "SWRAP_ERROR(%d): %s\n",
+ "SWRAP_ERROR("SPRIpid"): %s\n",
getpid(), buffer);
break;
case SWRAP_LOG_WARN:
fprintf(stderr,
- "SWRAP_WARN(%d): %s\n",
+ "SWRAP_WARN("SPRIpid"): %s\n",
getpid(), buffer);
break;
case SWRAP_LOG_DEBUG:
fprintf(stderr,
- "SWRAP_DEBUG(%d): %s\n",
+ "SWRAP_DEBUG("SPRIpid"): %s\n",
getpid(), buffer);
break;
case SWRAP_LOG_TRACE:
fprintf(stderr,
- "SWRAP_TRACE(%d): %s\n",
+ "SWRAP_TRACE("SPRIpid"): %s\n",
getpid(), buffer);
break;
}