Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 114 lines (90 sloc) 2.531 kb
045594e7 »
2008-03-05 add missing files
1 /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /**
3 * this file defines types that are used in multiple places, yet don't belong to
4 * any one particular module.
5 */
6
7 #if !defined(_generic_h_)
8 #define _generic_h_
9
f045fd8a »
2008-05-01 flat memory allocator
10 /* this needs to go on top. */
045594e7 »
2008-03-05 add missing files
11 #ifdef HAVE_CONFIG_H
12 #include "config.h"
13 #endif
14
f045fd8a »
2008-05-01 flat memory allocator
15 /**
16 * Start including stuff to get type definitions. Some will depend on config.h.
17 */
045594e7 »
2008-03-05 add missing files
18
19 /* Get a consistent bool type */
20 #if HAVE_STDBOOL_H
21 # include <stdbool.h>
22 #else
23 typedef enum {false = 0, true = 1} bool;
24 #endif
25
26 #if HAVE_STDINT_H
27 # include <stdint.h>
28 #else
29 typedef unsigned char uint8_t;
30 #endif
31
7a1f4fa7 »
2008-05-06 fixes to flat allocator, merge from trunk
32 #if HAVE_SYS_TYPES_H
33 # include <sys/types.h>
34 #else
35 typedef unsigned char u_char;
36 #endif
37
f045fd8a »
2008-05-01 flat memory allocator
38 /* some POSIX systems need the following definition
39 * to get mlockall flags out of sys/mman.h. */
40 #ifndef _P1003_1B_VISIBLE
41 #define _P1003_1B_VISIBLE
42 #endif
43 #include <sys/mman.h>
44
45 /**
46 * Declare simple types (enums, typedefs of native types).
47 */
48
045594e7 »
2008-03-05 add missing files
49 #if __WORDSIZE == 64
50 #define PRINTF_INT64_MODIFIER "l"
51 #else
52 #define PRINTF_INT64_MODIFIER "ll"
53 #endif
54
f045fd8a »
2008-05-01 flat memory allocator
55 /** Time relative to server start. Smaller than time_t on 64-bit systems. */
56 typedef unsigned int rel_time_t;
57
58
59 /**
60 * Start including stuff to get other header files.
61 */
62
63 #ifdef HAVE_MALLOC_H
64 /* OpenBSD has a malloc.h, but warns to use stdlib.h instead */
65 #ifndef __OpenBSD__
66 #include <malloc.h>
67 #endif
68 #endif
69
70 /* unistd.h is here */
71 #if HAVE_UNISTD_H
72 # include <unistd.h>
73 #endif
74
75 #ifdef HAVE_STRING_H
76 #include <string.h>
77 #endif
78
7a1f4fa7 »
2008-05-06 fixes to flat allocator, merge from trunk
79 /*
f045fd8a »
2008-05-01 flat memory allocator
80 * IOV_MAX comes from stdio.h. Make sure we include it before we try to define
7a1f4fa7 »
2008-05-06 fixes to flat allocator, merge from trunk
81 * it ourselves.
045594e7 »
2008-03-05 add missing files
82 */
83 /* need this to get IOV_MAX on some platforms. */
84 #ifndef __need_IOV_MAX
85 #define __need_IOV_MAX
86 #endif
87
88 #include <stdio.h>
f045fd8a »
2008-05-01 flat memory allocator
89 #include <limits.h>
045594e7 »
2008-03-05 add missing files
90
91 /* FreeBSD 4.x doesn't have IOV_MAX exposed. */
92 #ifndef IOV_MAX
93 #if defined(__FreeBSD__)
94 # define IOV_MAX 1024
95 #endif
96 #endif
97
7a1f4fa7 »
2008-05-06 fixes to flat allocator, merge from trunk
98 #include <stdarg.h>
99
5d88e647 »
2008-06-16 connection buffer sharing
100 /* create an always_assert macro for tests that are so cheap that they should
101 * always be performed, regardless of NDEBUG */
102 #if defined(NDEBUG)
103 #define always_assert(condition) if (! (condition)) { fprintf(stderr, "%s\n", #condition); abort(); }
104 #else
105 #define always_assert assert
106 #endif /* #if defined(NDEBUG) */
107
c0dbcafa »
2008-09-18 connection buffers are per-thread to avoid lock contention
108 #define DECL_MT_FUNC(ret_type, func_name, args) extern ret_type do_ ## func_name args; extern ret_type func_name args;
5d88e647 »
2008-06-16 connection buffer sharing
109
7a1f4fa7 »
2008-05-06 fixes to flat allocator, merge from trunk
110 // bump a counter up by one. return 0 if the counter has overflowed, nonzero otherwise.
111 #define BUMP(cntr) ((++(cntr)) != 0)
112
045594e7 »
2008-03-05 add missing files
113 #endif /* #if !defined(_generic_h_) */
Something went wrong with that request. Please try again.