Debian Codegraph @

test/dapltest/mdep/solaris/dapl_mdep_user.h

raw
1 /*
2 * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
3 *
4 * This Software is licensed under one of the following licenses:
5 *
6 * 1) under the terms of the "Common Public License 1.0" a copy of which is
7 * in the file LICENSE.txt in the root directory. The license is also
8 * available from the Open Source Initiative, see
9 * http://www.opensource.org/licenses/cpl.php.
10 *
11 * 2) under the terms of the "The BSD License" a copy of which is in the file
12 * LICENSE2.txt in the root directory. The license is also available from
13 * the Open Source Initiative, see
14 * http://www.opensource.org/licenses/bsd-license.php.
15 *
16 * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
17 * copy of which is in the file LICENSE3.txt in the root directory. The
18 * license is also available from the Open Source Initiative, see
19 * http://www.opensource.org/licenses/gpl-license.php.
20 *
21 * Licensee has the right to choose one of the above licenses.
22 *
23 * Redistributions of source code must retain the above copyright
24 * notice and one of the license notices.
25 *
26 * Redistributions in binary form must reproduce both the above copyright
27 * notice, one of the license notices in the documentation
28 * and/or other materials provided with the distribution.
29 */
30
31 #ifndef __DAPL_MDEP_H__
32 #define __DAPL_MDEP_H__
33
34 /* include files */
35
36 #include <ctype.h>
37
38 # include <sys/int_types.h>
39 # include <netdb.h>
40 # include <unistd.h>
41 # include <pthread.h>
42 # include <stdio.h>
43 # include <string.h>
44
45 /* Default Device Name */
46 #define DT_MdepDeviceName "ia0a"
47
48 /* Boolean */
49 typedef int bool;
50
51 #define true (1)
52 #define false (0)
53
54 #ifndef __BASE_FILE__
55 #define __BASE_FILE__ __FILE__
56 #endif
57
58 #ifndef _INLINE_
59 #error "Must Define _INLINE_
60 #endif
61
62 /* Mdep function defines */
63
64 #define DT_Mdep_spew(N, _X_) \
65 do { \
66 if (DT_dapltest_debug >= (N)) \
67 { \
68 DT_Mdep_printf _X_; \
69 } \
70 } while (0)
71
72 #define DT_Mdep_debug(_X_) DT_Mdep_spew(1, _X_)
73
74 #define DT_Mdep_printf printf
75 #define DT_Mdep_flush() fflush(NULL)
76
77 /*
78 * Release processor to reschedule
79 */
80 #define DT_Mdep_yield pthread_yield
81
82 /*
83 * Locks
84 */
85
86 typedef pthread_mutex_t DT_Mdep_LockType;
87
88 /* Wait object used for inter thread communication */
89
90 typedef struct
91 {
92 bool signaled;
93 pthread_cond_t cv;
94 pthread_mutex_t lock;
95 } DT_WAIT_OBJECT;
96
97 /*
98 * Thread types
99 */
100 typedef pthread_t DT_Mdep_ThreadHandleType;
101 typedef void (*DT_Mdep_ThreadFunction) (void *param);
102 typedef void * DT_Mdep_Thread_Start_Routine_Return_Type;
103 #define DT_MDEP_DEFAULT_STACK_SIZE 65536
104
105 typedef struct
106 {
107 void (*function) (void *);
108 void *param;
109 DT_Mdep_ThreadHandleType thread_handle;
110 unsigned int stacksize;
111 pthread_attr_t attr; /* Thread attributes */
112 } Thread;
113
114 /*
115 * System information
116 *
117 */
118
119 typedef struct
120 {
121 unsigned long int system;
122 unsigned long int user;
123 unsigned long int idle;
124 } DT_CpuStat;
125
126 /*
127 * Timing
128 */
129
130 # error "Must Define DT_Mdep_TimeStamp"
131
132 static _INLINE_ DT_Mdep_TimeStamp
133 DT_Mdep_GetTimeStamp ( void )
134 {
135 #error "Must implement DT_Mdep_TimeStamp"
136 }
137
138 /*
139 * Define long format types to be used in *printf format strings. We
140 * use the C string constant concatenation ability to define 64 bit
141 * formats, which unfortunatly are non standard in the C compiler
142 * world. E.g. %llx for gcc, %I64x for Windows
143 */
144
145 #error "Must Define F64d"
146 #error "Must Define F64u"
147 #error "Must Define F64x"
148 #error "Must Define F64X"
149
150 /*
151 * Define notion of a LONG LONG 0
152 */
153 #define LZERO 0
154
155 #endif