summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomohiro Kusumi <[email protected]>2019-04-10 12:49:03 +0900
committerBrian Behlendorf <[email protected]>2019-04-09 20:49:03 -0700
commit5ae4e4481eede259a64260ab1b09f86ff46c8f8d (patch)
tree36220e4ba762e8b31cc33919066e2cdb3d24f8ae
parent9a65234c8bbfe4e394d32172439ae0266ac59c8d (diff)
Don't assume pthread_t is uint_t for portability
POSIX doesn't define pthread_t as uint_t. It could be a pointer. This code causes below compile error on a platform using pointer for pthread_t. -- kernel.c:815:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] (void) printf("%u ", (uint_t)pthread_self()); Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Igor Kozhukhov <[email protected]> Signed-off-by: Tomohiro Kusumi <[email protected]> Closes #8558
-rw-r--r--lib/libzpool/kernel.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c
index f22ad56b5..0f39e0d72 100644
--- a/lib/libzpool/kernel.c
+++ b/lib/libzpool/kernel.c
@@ -813,7 +813,8 @@ __dprintf(boolean_t dprint, const char *file, const char *func,
if (dprintf_find_string("pid"))
(void) printf("%d ", getpid());
if (dprintf_find_string("tid"))
- (void) printf("%u ", (uint_t)pthread_self());
+ (void) printf("%ju ",
+ (uintmax_t)(uintptr_t)pthread_self());
if (dprintf_find_string("cpu"))
(void) printf("%u ", getcpuid());
if (dprintf_find_string("time"))