--- iozone.c.orig 2023-05-01 13:29:49 +++ iozone.c 2023-05-11 00:14:15 @@ -105,28 +105,13 @@ extern int h_errno; /* imported for errors */ syscall(__NR_sched_setaffinity, (pid_t)pid, (size_t)size, (void *)cpuset) #endif -#if defined(HAVE_ANSIC_C) && defined(linux) +#if defined(HAVE_ANSIC_C) && (defined(linux) || defined(IOZ_macosx)) #include #include #endif -#ifdef HAVE_PROTO -#include "proto.h" -#else -int atoi(); -int close(); -int unlink(); -int main(); -#if !defined(linux) -int wait(); -#endif -int fsync(); -void srand48(); -long lrand48(); -void create_list(); void init_by_array64(unsigned long long *, unsigned long long ); unsigned long long genrand64_int64(void); -#endif #include @@ -351,7 +336,7 @@ THISVERSION, #include #endif -#if defined(linux) +#if defined(linux) || defined(IOZ_macosx) #include #include #include @@ -397,6 +382,8 @@ typedef long long off64_t; #endif #endif #endif + +void create_list(long long *list_off, long long reclen, off64_t numrecs64); #ifdef __AIX__ #include @@ -1022,8 +1009,8 @@ void auto_test(); /* perform automatic test series * /*int pit_gettimeofday( struct timeval *, struct timezone *, char *, char *);*/ static int openSckt( const char *, const char *, unsigned int ); static void pit( int, struct timeval *); -void auto_test(); /* perform automatic test series */ -static double time_so_far(); /* time since start of program */ +void auto_test(void); /* perform automatic test series */ +static double time_so_far(void); /* time since start of program */ static void update_burst_sleep(int, long long, double *); #ifndef NO_THREADS static void count_burst(double* burst_acc_time_sec, long long stream_id); @@ -1039,9 +1026,7 @@ void auto_test(void); #else sighandler_t signal_handler(void); /* clean up if user interrupts us */ #endif -void auto_test(void); void throughput_test(void); -static double time_so_far(void); void fetchit(char *,long long); long long verify_buffer(volatile char *,long long, off64_t, long long, unsigned long long, char ); void purgeit(char *,long long); @@ -1271,42 +1256,28 @@ ssize_t pread64(); ssize_t pwrite64(); ssize_t pread64(); #endif -#if !defined(linux) -char *getenv(); -char *inet_ntoa(); -int system(); -#endif -#ifdef ASYNC_IO -size_t async_write(); -void async_release(); -int async_read(); -int async_read_no_copy(); -size_t async_write_no_copy(); -void end_async(); -void async_init(); -#else -int async_read(); -int async_read_no_copy(); -size_t async_write(); -size_t async_write_no_copy(); -void async_release(); -#endif -void do_float(); -int create_xls(); -void close_xls(); -void do_label(); +struct cache; +int async_read(struct cache *, long long , char *, off64_t, long long, long long, off64_t, long long); +size_t async_write(struct cache *,long long, char *, long long, off64_t, long long); +void async_release(struct cache *gc); +int async_read_no_copy(struct cache *, long long, char **, off64_t, long long, long long, off64_t, long long); +size_t async_write_no_copy(struct cache *gc,long long fd,char *buffer,long long size,long long offset,long long depth,char *free_addr); +void end_async(struct cache *mygc); +void async_init(struct cache **,int, int); +void do_float(int,double,int,int); +int create_xls(char *); +void close_xls(int); +void do_label(int,char *,int,int); int mylockf(int, int, int); int mylockr(int,int, int, off64_t, off64_t); -int rand(void); -void srand(unsigned int); int get_client_info(void); -void exit(int); void find_remote_shell(char *); void find_external_mon(char *,char *); void start_monitor(char *); void stop_monitor(char *); -void takeoff_cache(); -void del_cache(); +struct cache_ent; +void takeoff_cache(struct cache *, struct cache_ent *); +void del_cache(struct cache *); void fill_area(long long *, long long *, long long); void fill_buffer(char *,long long ,long long ,char, long long ); void store_value(off64_t); @@ -1345,7 +1316,6 @@ void init_file_sizes(); void traj_vers(void); void r_traj_size(void); long long w_traj_size(void); -void init_file_sizes(); off64_t get_next_file_size(off64_t); void add_file_size(off64_t); void init_file_sizes( off64_t, off64_t); @@ -1832,9 +1802,6 @@ void stop_child_send(); * Sort of... Full prototypes break non-ansi C compilers. No protos is * a bit sloppy, so the compromise is this. */ -void stop_child_send(); -void stop_child_send(); -void child_send(); void compressible_rand_16_int(int *); void new_touch_dedup(char *, int); @@ -1847,9 +1814,13 @@ main(argc,argv) int negatives, positives; int -main(argc,argv) +#ifdef HAVE_ANSIC_C +main(int argc, char **argv) +#else +main(argc,argv) int argc; char **argv; +#endif { long long fileindx,i,tval; @@ -9153,6 +9124,7 @@ long long *data1,*data2; } } } +#ifdef ASYNC_IO if(async_flag) { if(no_copy_flag) @@ -9160,6 +9132,7 @@ long long *data1,*data2; end_async(gc); gc=0; } +#endif buffer1=0; if(hist_summary) { @@ -9634,6 +9607,7 @@ long long *data1, *data2; } } } +#ifdef ASYNC_IO if(async_flag) { if(no_copy_flag) @@ -9641,6 +9615,7 @@ long long *data1, *data2; end_async(gc); gc=0; } +#endif if(rlocking) { lock_offset=I_LSEEK(fd,0,SEEK_CUR); @@ -10097,6 +10072,7 @@ long long *data1,*data2; } } } +#ifdef ASYNC_IO if(async_flag) { if(no_copy_flag) @@ -10104,6 +10080,7 @@ long long *data1,*data2; end_async(gc); gc=0; } +#endif if(rlocking) { mylockr((int) fd, (int) 0, (int)1, @@ -10701,8 +10678,10 @@ printf("Read_Stride\n"); } else { +#ifdef ASYNC_IO if(async_flag) async_init(&gc,fd,direct_flag); +#endif if(async_flag) { if(no_copy_flag) @@ -10749,6 +10728,7 @@ printf("Read_Stride\n"); } } } +#ifdef ASYNC_IO if(async_flag) { if(no_copy_flag) @@ -10756,6 +10736,7 @@ printf("Read_Stride\n"); end_async(gc); gc=0; } +#endif /* This is a bit tricky. The goal is to read with a stride through the file. The problem is that you need to touch all of the file @@ -15485,6 +15466,7 @@ thread_read_test(x) } } } +#ifdef ASYNC_IO if(async_flag) { if(no_copy_flag) @@ -15492,6 +15474,7 @@ thread_read_test(x) end_async(gc); gc=0; } +#endif read_so_far+=reclen/1024; r_traj_bytes_completed+=reclen; r_traj_ops_completed++; @@ -16050,6 +16033,7 @@ thread_pread_test(x) } } } +#ifdef ASYNC_IO if(async_flag) { if(no_copy_flag) @@ -16057,6 +16041,7 @@ thread_pread_test(x) end_async(gc); gc=0; } +#endif read_so_far+=reclen/1024; r_traj_bytes_completed+=reclen; r_traj_ops_completed++; @@ -16665,6 +16650,7 @@ thread_rread_test(x) } } } +#ifdef ASYNC_IO if(async_flag) { if(no_copy_flag) @@ -16672,6 +16658,7 @@ thread_rread_test(x) end_async(gc); gc=0; } +#endif re_read_so_far+=reclen/1024; r_traj_bytes_completed+=reclen; r_traj_ops_completed++; @@ -17244,6 +17231,7 @@ thread_reverse_read_test(x) lock_offset, reclen); } current_position+=reclen; +#ifdef ASYNC_IO if(async_flag) { if(no_copy_flag) @@ -17251,6 +17239,7 @@ thread_reverse_read_test(x) end_async(gc); gc=0; } +#endif t_offset = (off64_t)reclen*2; if (!(h_flag || k_flag || mmapflag)) { @@ -17778,6 +17767,7 @@ thread_stride_read_test(x) } } } +#ifdef ASYNC_IO if(async_flag) { if(no_copy_flag) @@ -17785,6 +17775,7 @@ thread_stride_read_test(x) end_async(gc); gc=0; } +#endif if(current_position + (stride * reclen) >= (numrecs64 * reclen)-reclen) { current_position=0; @@ -18528,6 +18519,7 @@ void *x; } } } +#ifdef ASYNC_IO if(async_flag) { if(no_copy_flag) @@ -18535,6 +18527,7 @@ void *x; end_async(gc); gc=0; } +#endif ranread_so_far+=reclen/1024; if(*stop_flag) { @@ -20081,37 +20074,37 @@ async_read() #ifndef ASYNC_IO int -async_read() +async_read(struct cache *a, long long b, char *c, off64_t d, long long e, long long f, off64_t g, long long h) { printf("Your system does not support async I/O\n"); exit(169); } size_t -async_write_no_copy() +async_write_no_copy(struct cache *gc,long long fd,char *buffer,long long size,long long offset,long long depth,char *free_addr) { printf("Your system does not support async I/O\n"); exit(170); } size_t -async_write() +async_write(struct cache *a,long long b, char *c, long long d, off64_t e, long long f) { printf("Your system does not support async I/O\n"); exit(171); } void -async_init() +async_init(struct cache **a, int b, int c) { printf("Your system does not support async I/O\n"); exit(172); } int -async_read_no_copy() +async_read_no_copy(struct cache *a, long long b, char **c, off64_t d, long long e, long long f, off64_t g, long long h) { printf("Your system does not support async I/O\n"); exit(172); } void -async_release() +async_release(struct cache *gc) { printf("Your system does not support async I/O\n"); exit(173);