1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _FB_FILEBENCH_H 27 #define _FB_FILEBENCH_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #include "config.h" 32 33 #include <stdio.h> 34 #include <string.h> 35 36 #include "vars.h" 37 #include "misc.h" 38 #include "flowop.h" 39 #include "ipc.h" 40 41 #ifdef HAVE_STDINT_H 42 #include <stdint.h> 43 #endif 44 45 46 #ifdef __STDC__ 47 #include <stdarg.h> 48 #define __V(x) x 49 #ifndef __P 50 #define __P(x) x 51 #endif 52 #else 53 #include <varargs.h> 54 #define __V(x) (va_alist) va_dcl 55 #define __P(x) () 56 #define const 57 #endif 58 59 #include <sys/times.h> 60 61 #ifdef HAVE_SYS_INT_LIMITS_H 62 #include <sys/int_limits.h> 63 #endif /* HAVE_SYS_INT_LIMITS_H */ 64 65 #ifdef __cplusplus 66 extern "C" { 67 #endif 68 69 #ifndef TRUE 70 #define TRUE 1 71 #endif 72 73 #ifndef FALSE 74 #define FALSE 0 75 #endif 76 77 extern pid_t my_pid; /* this process' process id */ 78 extern procflow_t *my_procflow; /* if slave process, procflow pointer */ 79 extern int errno; 80 extern char *execname; 81 extern int noproc; 82 83 void filebench_init(); 84 void filebench_log __V((int level, const char *fmt, ...)); 85 void filebench_shutdown(int error); 86 87 #ifndef HAVE_UINT64_MAX 88 #define UINT64_MAX (((off64_t)1UL<<63UL) - 1UL) 89 #endif 90 91 #define FILEBENCH_RANDMAX64 UINT64_MAX 92 #define FILEBENCH_RANDMAX32 UINT32_MAX 93 94 #if defined(_LP64) || (__WORDSIZE == 64) 95 #define filebench_randomno filebench_randomno64 96 #define FILEBENCH_RANDMAX FILEBENCH_RANDMAX64 97 #else 98 #define filebench_randomno filebench_randomno32 99 #define FILEBENCH_RANDMAX FILEBENCH_RANDMAX32 100 #endif 101 102 #define KB (1024LL) 103 #define MB (KB * KB) 104 #define GB (KB * MB) 105 106 #define MMAP_SIZE (1024UL * 1024UL * 1024UL) 107 108 #ifndef MIN 109 #define MIN(x, y) ((x) < (y) ? (x) : (y)) 110 #endif 111 112 #define FILEBENCH_VERSION "1.2.3" 113 #define FILEBENCHDIR "/usr/benchmarks/filebench" 114 #define FILEBENCH_PROMPT "filebench> " 115 #define MAX_LINE_LEN 1024 116 #define MAX_CMD_HIST 128 117 #define SHUTDOWN_WAIT_SECONDS 5 /* time to wait for proc / thrd to quit */ 118 119 #define FILEBENCH_DONE 1 120 #define FILEBENCH_OK 0 121 #define FILEBENCH_ERROR -1 122 #define FILEBENCH_NORSC -2 123 124 /* For MacOSX */ 125 #ifndef HAVE_OFF64_T 126 #define mmap64 mmap 127 #define off64_t off_t 128 #define open64 open 129 #define stat64 stat 130 #define pread64 pread 131 #define pwrite64 pwrite 132 #define lseek64 lseek 133 #define fstat64 fstat 134 #endif 135 136 #ifdef __cplusplus 137 } 138 #endif 139 140 #endif /* _FB_FILEBENCH_H */ 141