OpenBSD has below compiler warning due to pthread_t being typedef'd
to struct pthread*.
os/os-openbsd.h: In function 'gettid':
os/os-openbsd.h:71: warning: cast from pointer to integer of different size
--
# uname
OpenBSD
# grep pthread_t /usr/include -rI | grep typedef | head -1
/usr/include/pthread.h:typedef struct pthread *pthread_t;
# cat ./p1.c
#include <stdio.h>
#include <pthread.h>
int main(void) {
pthread_t id = 1234;
printf("%d\n", (int)id);
return 0;
}
# gcc -Wall -g ./p1.c
./p1.c: In function 'main':
./p1.c:4: warning: initialization makes pointer from integer without a cast
./p1.c:5: warning: cast from pointer to integer of different size
# ./a.out
1234
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
static inline int gettid(void)
{
- return (int) pthread_self();
+ return (int)(intptr_t) pthread_self();
}
static inline unsigned long long get_fs_free_size(const char *path)