Windows uses LLP64 model so [u]intptr_t is more correct.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
#include <locale.h>
#include <assert.h>
#include <time.h>
+#include <inttypes.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/ipc.h>
unsigned long done_secs = 0;
#define PAGE_ALIGN(buf) \
- (char *) (((unsigned long) (buf) + page_mask) & ~page_mask)
+ (char *) (((uintptr_t) (buf) + page_mask) & ~page_mask)
#define JOB_START_TIMEOUT (5 * 1000)
write_iolog_close(td);
td_set_runstate(td, TD_EXITED);
- return (void *) (unsigned long) td->error;
+ return (void *) (uintptr_t) td->error;
}
td = data + offset * sizeof(struct thread_data);
ret = thread_main(td);
shmdt(data);
- return (int) (unsigned long) ret;
+ return (int) (uintptr_t) ret;
}
/*
static inline unsigned long hash_ptr(void *ptr, unsigned int bits)
{
- return hash_long((unsigned long)ptr, bits);
+ return hash_long((uintptr_t)ptr, bits);
}
/*
#include <stdlib.h>
#include <assert.h>
+#include <inttypes.h>
#include "memalign.h"
};
#define PTR_ALIGN(ptr, mask) \
- (char *) (((unsigned long) ((ptr) + (mask)) & ~(mask)))
+ (char *) (((uintptr_t) ((ptr) + (mask)) & ~(mask)))
void *fio_memalign(size_t alignment, size_t size)
{
if (ptr) {
ret = PTR_ALIGN(ptr, alignment);
f = ret + size;
- f->offset = (unsigned long) ret - (unsigned long) ptr;
+ f->offset = (uintptr_t) ret - (uintptr_t) ptr;
}
return ret;
#define _LINUX_RBTREE_H
#include <stdlib.h>
+#include <inttypes.h>
struct rb_node
{
- unsigned long rb_parent_color;
+ intptr_t rb_parent_color;
#define RB_RED 0
#define RB_BLACK 1
struct rb_node *rb_right;
static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
{
- rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p;
+ rb->rb_parent_color = (rb->rb_parent_color & 3) | (uintptr_t)p;
}
static inline void rb_set_color(struct rb_node *rb, int color)
{
static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
struct rb_node ** rb_link)
{
- node->rb_parent_color = (unsigned long )parent;
+ node->rb_parent_color = (uintptr_t)parent;
node->rb_left = node->rb_right = NULL;
*rb_link = node;
#include <assert.h>
#include <string.h>
#include <unistd.h>
+#include <inttypes.h>
#include <sys/types.h>
#include <limits.h>
#include <fcntl.h>
#ifdef SMALLOC_REDZONE
static void *postred_ptr(struct block_hdr *hdr)
{
- unsigned long ptr;
+ uintptr_t ptr;
- ptr = (unsigned long) hdr + hdr->size - sizeof(unsigned int);
+ ptr = (uintptr_t) hdr + hdr->size - sizeof(unsigned int);
ptr = (ptr + int_mask) & ~int_mask;
return (void *) ptr;