a13d9c1c4228828fe042f311d5bd48994b5fb275
[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 #include <sys/vfs.h>
39 #include <utime.h>
40 #include <errno.h>
41 #include <strings.h>
42 #include <stdint.h>
43 #include <netinet/in.h>
44 #include <netinet/tcp.h>
45 #include <netdb.h>
46
47 #if HAVE_ATTR_XATTR_H
48 #include <attr/xattr.h>
49 #elif HAVE_SYS_XATTR_H
50 #include <sys/xattr.h>
51 #elif HAVE_SYS_ATTRIBUTES_H
52 #include <sys/attributes.h>
53 #endif
54
55 #ifndef MSG_WAITALL
56 #define MSG_WAITALL 0x100
57 #endif
58
59 #define PRINT_FREQ 1
60
61 #define MIN(x,y) ((x)<(y)?(x):(y))
62
63 #define TCP_PORT 7003
64 #define TCP_OPTIONS "TCP_NODELAY SO_REUSEADDR"
65
66 #define BOOL int
67 #define True 1
68 #define False 0
69 #define uint32 unsigned
70
71 struct child_struct {
72         int id;
73         int nprocs;
74         int status;
75         int failed;
76         int line;
77         int done;
78         int cleanup;
79         const char *directory;
80         double bytes;
81         double bytes_done_warmup;
82 };
83
84
85 /* CreateDisposition field. */
86 #define FILE_SUPERSEDE 0
87 #define FILE_OPEN 1
88 #define FILE_CREATE 2
89 #define FILE_OPEN_IF 3
90 #define FILE_OVERWRITE 4
91 #define FILE_OVERWRITE_IF 5
92
93 /* CreateOptions field. */
94 #define FILE_DIRECTORY_FILE       0x0001
95 #define FILE_WRITE_THROUGH        0x0002
96 #define FILE_SEQUENTIAL_ONLY      0x0004
97 #define FILE_NON_DIRECTORY_FILE   0x0040
98 #define FILE_NO_EA_KNOWLEDGE      0x0200
99 #define FILE_EIGHT_DOT_THREE_ONLY 0x0400
100 #define FILE_RANDOM_ACCESS        0x0800
101 #define FILE_DELETE_ON_CLOSE      0x1000
102
103 #ifndef O_DIRECTORY
104 #define O_DIRECTORY    0200000
105 #endif
106
107 #include "proto.h"
108