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 * Portions Copyright 2008 Denis Cheng 26 */ 27 28 #ifndef _FB_FILEBENCH_H 29 #define _FB_FILEBENCH_H 30 31 #include "config.h" 32 33 #include <stdio.h> 34 #include <string.h> 35 #include <errno.h> 36 37 #ifndef HAVE_BOOLEAN_T 38 typedef enum { B_FALSE, B_TRUE } boolean_t; 39 #endif 40 41 #ifndef HAVE_U_LONGLONG_T 42 typedef unsigned long long u_longlong_t; 43 #endif 44 45 #ifndef TRUE 46 #define TRUE 1 47 #endif 48 49 #ifndef FALSE 50 #define FALSE 0 51 #endif 52 53 #include "procflow.h" 54 #include "misc.h" 55 #include "ipc.h" 56 57 #ifdef HAVE_STDINT_H 58 #include <stdint.h> 59 #endif 60 61 62 #ifdef __STDC__ 63 #include <stdarg.h> 64 #define __V(x) x 65 #ifndef __P 66 #define __P(x) x 67 #endif 68 #else 69 #include <varargs.h> 70 #define __V(x) (va_alist) va_dcl 71 #define __P(x) () 72 #define const 73 #endif 74 75 #include <sys/times.h> 76 77 #ifdef HAVE_SYS_INT_LIMITS_H 78 #include <sys/int_limits.h> 79 #endif /* HAVE_SYS_INT_LIMITS_H */ 80 81 #ifdef __cplusplus 82 extern "C" { 83 #endif 84 85 extern pid_t my_pid; /* this process' process id */ 86 extern procflow_t *my_procflow; /* if slave process, procflow pointer */ 87 extern int errno; 88 extern char *execname; 89 extern int noproc; 90 91 void filebench_init(); 92 void filebench_log __V((int level, const char *fmt, ...)); 93 void filebench_shutdown(int error); 94 95 #ifndef HAVE_UINT64_MAX 96 #define UINT64_MAX (((off64_t)1UL<<63UL) - 1UL) 97 #endif 98 99 #define FILEBENCH_RANDMAX64 UINT64_MAX 100 #define FILEBENCH_RANDMAX32 UINT32_MAX 101 102 #if defined(_LP64) || (__WORDSIZE == 64) 103 #define filebench_randomno filebench_randomno64 104 #define FILEBENCH_RANDMAX FILEBENCH_RANDMAX64 105 #else 106 #define filebench_randomno filebench_randomno32 107 #define FILEBENCH_RANDMAX FILEBENCH_RANDMAX32 108 #endif 109 110 #define KB (1024LL) 111 #define MB (KB * KB) 112 #define GB (KB * MB) 113 114 #define MMAP_SIZE (1024UL * 1024UL * 1024UL) 115 116 #ifndef MIN 117 #define MIN(x, y) ((x) < (y) ? (x) : (y)) 118 #endif 119 120 #define FILEBENCH_VERSION "1.4.1" 121 #define FILEBENCHDIR "/usr/benchmarks/filebench" 122 #define FILEBENCH_PROMPT "filebench> " 123 #define MAX_LINE_LEN 1024 124 #define MAX_CMD_HIST 128 125 #define SHUTDOWN_WAIT_SECONDS 5 /* time to wait for proc / thrd to quit */ 126 127 #define FILEBENCH_DONE 1 128 #define FILEBENCH_OK 0 129 #define FILEBENCH_ERROR -1 130 #define FILEBENCH_NORSC -2 131 132 /* For MacOSX */ 133 #ifndef HAVE_OFF64_T 134 #define mmap64 mmap 135 #define off64_t off_t 136 #define open64 open 137 #define stat64 stat 138 #define pread64 pread 139 #define pwrite64 pwrite 140 #define lseek64 lseek 141 #define fstat64 fstat 142 #endif 143 144 #ifdef __cplusplus 145 } 146 #endif 147 148 #endif /* _FB_FILEBENCH_H */ 149