]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Don't assume pthread_t is uint_t for portability
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Wed, 10 Apr 2019 03:49:03 +0000 (12:49 +0900)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 10 Apr 2019 03:49:03 +0000 (20:49 -0700)
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 <behlendorf1@llnl.gov>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Closes #8558

lib/libzpool/kernel.c

index f22ad56b5335565aefda18942419f33d74a3d368..0f39e0d72bca763f653e8b1c113ed7a5106ffe73 100644 (file)
@@ -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"))