15184Sek110237 /* 25184Sek110237 * CDDL HEADER START 35184Sek110237 * 45184Sek110237 * The contents of this file are subject to the terms of the 55184Sek110237 * Common Development and Distribution License (the "License"). 65184Sek110237 * You may not use this file except in compliance with the License. 75184Sek110237 * 85184Sek110237 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 95184Sek110237 * or http://www.opensolaris.org/os/licensing. 105184Sek110237 * See the License for the specific language governing permissions 115184Sek110237 * and limitations under the License. 125184Sek110237 * 135184Sek110237 * When distributing Covered Code, include this CDDL HEADER in each 145184Sek110237 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 155184Sek110237 * If applicable, add the following below this CDDL HEADER, with the 165184Sek110237 * fields enclosed by brackets "[]" replaced with your own identifying 175184Sek110237 * information: Portions Copyright [yyyy] [name of copyright owner] 185184Sek110237 * 195184Sek110237 * CDDL HEADER END 205184Sek110237 */ 215184Sek110237 /* 228615SAndrew.W.Wilson@sun.com * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 235184Sek110237 * Use is subject to license terms. 246613Sek110237 * 256613Sek110237 * Portions Copyright 2008 Denis Cheng 265184Sek110237 */ 275184Sek110237 285184Sek110237 #ifndef _FB_FILEBENCH_H 295184Sek110237 #define _FB_FILEBENCH_H 305184Sek110237 315184Sek110237 #include "config.h" 325184Sek110237 335184Sek110237 #include <stdio.h> 345184Sek110237 #include <string.h> 356613Sek110237 #include <errno.h> 365184Sek110237 376613Sek110237 #ifndef HAVE_BOOLEAN_T 386613Sek110237 typedef enum { B_FALSE, B_TRUE } boolean_t; 396613Sek110237 #endif 406613Sek110237 416613Sek110237 #ifndef HAVE_U_LONGLONG_T 426613Sek110237 typedef unsigned long long u_longlong_t; 436613Sek110237 #endif 446613Sek110237 457556SAndrew.W.Wilson@sun.com #ifndef TRUE 467556SAndrew.W.Wilson@sun.com #define TRUE 1 477556SAndrew.W.Wilson@sun.com #endif 487556SAndrew.W.Wilson@sun.com 497556SAndrew.W.Wilson@sun.com #ifndef FALSE 507556SAndrew.W.Wilson@sun.com #define FALSE 0 517556SAndrew.W.Wilson@sun.com #endif 527556SAndrew.W.Wilson@sun.com 536613Sek110237 #include "procflow.h" 545184Sek110237 #include "misc.h" 555184Sek110237 #include "ipc.h" 565184Sek110237 575184Sek110237 #ifdef HAVE_STDINT_H 585184Sek110237 #include <stdint.h> 595184Sek110237 #endif 605184Sek110237 615184Sek110237 625184Sek110237 #ifdef __STDC__ 635184Sek110237 #include <stdarg.h> 645184Sek110237 #define __V(x) x 655184Sek110237 #ifndef __P 665184Sek110237 #define __P(x) x 675184Sek110237 #endif 685184Sek110237 #else 695184Sek110237 #include <varargs.h> 705184Sek110237 #define __V(x) (va_alist) va_dcl 715184Sek110237 #define __P(x) () 725184Sek110237 #define const 735184Sek110237 #endif 745184Sek110237 755184Sek110237 #include <sys/times.h> 765184Sek110237 775184Sek110237 #ifdef HAVE_SYS_INT_LIMITS_H 785184Sek110237 #include <sys/int_limits.h> 795184Sek110237 #endif /* HAVE_SYS_INT_LIMITS_H */ 805184Sek110237 815184Sek110237 #ifdef __cplusplus 825184Sek110237 extern "C" { 835184Sek110237 #endif 845184Sek110237 856084Saw148015 extern pid_t my_pid; /* this process' process id */ 866084Saw148015 extern procflow_t *my_procflow; /* if slave process, procflow pointer */ 875184Sek110237 extern int errno; 885184Sek110237 extern char *execname; 895184Sek110237 extern int noproc; 905184Sek110237 915184Sek110237 void filebench_init(); 925184Sek110237 void filebench_log __V((int level, const char *fmt, ...)); 935184Sek110237 void filebench_shutdown(int error); 948615SAndrew.W.Wilson@sun.com void filebench_plugin_funcvecinit(void); 955184Sek110237 965184Sek110237 #ifndef HAVE_UINT64_MAX 975184Sek110237 #define UINT64_MAX (((off64_t)1UL<<63UL) - 1UL) 985184Sek110237 #endif 995184Sek110237 1005184Sek110237 #define FILEBENCH_RANDMAX64 UINT64_MAX 1015184Sek110237 #define FILEBENCH_RANDMAX32 UINT32_MAX 1025184Sek110237 1035184Sek110237 #if defined(_LP64) || (__WORDSIZE == 64) 1045184Sek110237 #define filebench_randomno filebench_randomno64 1055184Sek110237 #define FILEBENCH_RANDMAX FILEBENCH_RANDMAX64 1065184Sek110237 #else 1075184Sek110237 #define filebench_randomno filebench_randomno32 1085184Sek110237 #define FILEBENCH_RANDMAX FILEBENCH_RANDMAX32 1095184Sek110237 #endif 1105184Sek110237 1115184Sek110237 #define KB (1024LL) 1125184Sek110237 #define MB (KB * KB) 1135184Sek110237 #define GB (KB * MB) 1145184Sek110237 1155184Sek110237 #define MMAP_SIZE (1024UL * 1024UL * 1024UL) 1165184Sek110237 1175184Sek110237 #ifndef MIN 1185184Sek110237 #define MIN(x, y) ((x) < (y) ? (x) : (y)) 1195184Sek110237 #endif 1205184Sek110237 121*8762SAndrew.W.Wilson@sun.com #define FILEBENCH_VERSION "1.4.4" 1225184Sek110237 #define FILEBENCHDIR "/usr/benchmarks/filebench" 1235184Sek110237 #define FILEBENCH_PROMPT "filebench> " 1245184Sek110237 #define MAX_LINE_LEN 1024 1255184Sek110237 #define MAX_CMD_HIST 128 126*8762SAndrew.W.Wilson@sun.com #define SHUTDOWN_WAIT_SECONDS 3 /* time to wait for proc / thrd to quit */ 1276084Saw148015 1286084Saw148015 #define FILEBENCH_DONE 1 1296084Saw148015 #define FILEBENCH_OK 0 1306084Saw148015 #define FILEBENCH_ERROR -1 1316084Saw148015 #define FILEBENCH_NORSC -2 1325184Sek110237 1335184Sek110237 /* For MacOSX */ 1345184Sek110237 #ifndef HAVE_OFF64_T 1355184Sek110237 #define mmap64 mmap 1365184Sek110237 #define off64_t off_t 1375184Sek110237 #define open64 open 1385184Sek110237 #define stat64 stat 1395184Sek110237 #define pread64 pread 1405184Sek110237 #define pwrite64 pwrite 1415184Sek110237 #define lseek64 lseek 1425184Sek110237 #define fstat64 fstat 1435184Sek110237 #endif 1445184Sek110237 1455184Sek110237 #ifdef __cplusplus 1465184Sek110237 } 1475184Sek110237 #endif 1485184Sek110237 1495184Sek110237 #endif /* _FB_FILEBENCH_H */ 150