[dbench @ cvs-1:tridge-20041212152632-lk9gt1u7mb0bq40o]
[tridge/dbench.git] / dbench.h
1 /* 
2    dbench version 2
3    Copyright (C) Andrew Tridgell 1999
4    
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2 of the License, or
8    (at your option) any later version.
9    
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14    
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include "config.h"
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <signal.h>
24 #include <unistd.h>
25 #include <string.h>
26 #include <ctype.h>
27 #include <dirent.h>
28 #include <sys/stat.h>
29 #include <sys/time.h>
30 #include <sys/wait.h>
31 #include <sys/types.h>
32 #include <sys/socket.h>
33 #include <fcntl.h>
34 #include <time.h>
35 #include <sys/ipc.h>
36 #include <sys/shm.h>
37 #include <sys/mman.h>
38
39 #ifdef HAVE_SYS_VFS_H
40 #include <sys/vfs.h>
41 #endif
42
43 #ifdef HAVE_SYS_STATVFS_H
44 #include <sys/statvfs.h>
45 #endif
46
47 #include <sys/param.h>
48 #include <sys/mount.h>
49           
50 #include <utime.h>
51 #include <errno.h>
52 #include <strings.h>
53 #ifdef HAVE_STDINT_H
54 #include <stdint.h>
55 #endif
56 #include <netinet/in.h>
57 #include <netinet/tcp.h>
58 #include <netdb.h>
59
60 #if HAVE_ATTR_XATTR_H
61 #include <attr/xattr.h>
62 #elif HAVE_SYS_XATTR_H
63 #include <sys/xattr.h>
64 #elif HAVE_SYS_ATTRIBUTES_H
65 #include <sys/attributes.h>
66 #endif
67
68 #ifdef HAVE_SYS_EXTATTR_H
69 #include <sys/extattr.h>
70 #endif
71
72 #ifdef HAVE_SYS_UIO_H
73 #include <sys/uio.h>
74 #endif
75
76 #ifndef MSG_WAITALL
77 #define MSG_WAITALL 0x100
78 #endif
79
80 #define PRINT_FREQ 1
81
82 #ifndef MIN
83 #define MIN(x,y) ((x)<(y)?(x):(y))
84 #endif
85
86 #define TCP_PORT 7003
87 #define TCP_OPTIONS "TCP_NODELAY SO_REUSEADDR"
88
89 #define BOOL int
90 #define True 1
91 #define False 0
92 #define uint32 unsigned
93
94 struct child_struct {
95         int id;
96         int nprocs;
97         int status;
98         int failed;
99         int line;
100         int done;
101         int cleanup;
102         const char *directory;
103         double bytes;
104         double bytes_done_warmup;
105 };
106
107
108 /* CreateDisposition field. */
109 #define FILE_SUPERSEDE 0
110 #define FILE_OPEN 1
111 #define FILE_CREATE 2
112 #define FILE_OPEN_IF 3
113 #define FILE_OVERWRITE 4
114 #define FILE_OVERWRITE_IF 5
115
116 /* CreateOptions field. */
117 #define FILE_DIRECTORY_FILE       0x0001
118 #define FILE_WRITE_THROUGH        0x0002
119 #define FILE_SEQUENTIAL_ONLY      0x0004
120 #define FILE_NON_DIRECTORY_FILE   0x0040
121 #define FILE_NO_EA_KNOWLEDGE      0x0200
122 #define FILE_EIGHT_DOT_THREE_ONLY 0x0400
123 #define FILE_RANDOM_ACCESS        0x0800
124 #define FILE_DELETE_ON_CLOSE      0x1000
125
126 #ifndef O_DIRECTORY
127 #define O_DIRECTORY    0200000
128 #endif
129
130 #include "proto.h"
131