globus_common
17.5
globus_common_include.h
Go to the documentation of this file.
1
/*
2
* Copyright 1999-2006 University of Chicago
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
23
#if !defined(GLOBUS_COMMON_INCLUDE_H)
24
#define GLOBUS_COMMON_INCLUDE_H 1
25
26
#include "
globus_config.h
"
27
28
#if defined(_WIN32) && !defined(__CYGWIN__)
29
#include <winsock2.h>
30
#include <ws2tcpip.h>
31
#endif
32
33
#ifdef __GNUC__
34
#define GlobusFuncName(func) static const char * _globus_func_name \
35
__attribute__((__unused__)) = #func
36
#else
37
#define GlobusFuncName(func) static const char * _globus_func_name = #func
38
#endif
39
40
extern
const
char
* _globus_func_name;
41
42
#define _GCSL(s) globus_common_i18n_get_string(GLOBUS_COMMON_MODULE,\
43
s)
44
46
#ifndef __USE_POSIX
47
#define __USE_POSIX
48
#endif
49
50
/*
51
* Include system files if we have them
52
*/
53
#include <sys/types.h>
54
#include <sys/stat.h>
55
#if !defined(_WIN32)
56
#include <unistd.h>
57
#endif
58
#include <sys/param.h>
59
#include <fcntl.h>
60
61
#if defined(_WIN32)
62
# include <windows.h>
63
# include <winsock2.h>
64
# include <process.h>
65
# include <io.h>
66
# include <sys/timeb.h>
67
# include <signal.h>
68
# include <malloc.h>
69
#else
70
# include <pwd.h>
71
# include <netdb.h>
72
# include <netinet/in.h>
73
# include <sys/socket.h>
74
# include <sys/uio.h>
75
#endif
76
77
78
#include <sys/time.h>
79
#include <time.h>
80
81
#include <stdint.h>
82
#include <errno.h>
83
#include <stdlib.h>
84
#include <stdio.h>
85
#include <limits.h>
86
#include <assert.h>
87
#include <signal.h>
88
#include <string.h>
89
#include <ctype.h>
90
#include <stdarg.h>
91
92
#include <dirent.h>
93
#include <fcntl.h>
94
95
/******************************************************************************
96
Define macros
97
******************************************************************************/
98
99
/*
100
* Various macro definitions for assertion checking
101
*/
102
#if 0
103
void
globus_dump_stack();
104
#define GLOBUS_DUMP_STACK() globus_dump_stack()
105
#else
106
#define GLOBUS_DUMP_STACK()
107
#endif
108
109
#if defined(BUILD_DEBUG)
110
# define globus_assert(assertion) \
111
do { \
112
if (!(assertion)) \
113
{ \
114
fprintf(stderr, "Assertion " #assertion \
115
" failed in file %s at line %d\n", \
116
__FILE__, __LINE__); \
117
GLOBUS_DUMP_STACK(); \
118
abort(); \
119
} \
120
} while(0)
121
122
# define globus_assert_string(assertion, string) \
123
do { \
124
if (!(assertion)) \
125
{ \
126
fprintf(stderr, "Assertion " #assertion \
127
" failed in file %s at line %d: %s", \
128
__FILE__, __LINE__, string); \
129
GLOBUS_DUMP_STACK(); \
130
abort(); \
131
} \
132
} while(0)
133
#else
/* BUILD_DEBUG */
134
# define globus_assert(assertion)
135
# define globus_assert_string(assertion, string)
136
#endif
/* BUILD_DEBUG */
137
138
#define GLOBUS_MAX(V1,V2) (((V1) > (V2)) ? (V1) : (V2))
139
#define GLOBUS_MIN(V1,V2) (((V1) < (V2)) ? (V1) : (V2))
140
141
#ifndef EXTERN_C_BEGIN
142
#ifdef __cplusplus
143
#define EXTERN_C_BEGIN extern "C" {
144
#define EXTERN_C_END }
145
#else
146
#define EXTERN_C_BEGIN
147
#define EXTERN_C_END
148
#endif
149
#endif
150
151
/* POSIX error code remapping */
152
#ifdef _WIN32
153
#ifndef EWOULDBLOCK
154
#define EWOULDBLOCK EAGAIN
155
#endif
156
#ifndef ETIMEDOUT
157
#define ETIMEDOUT WSAETIMEDOUT
158
#endif
159
#ifndef EINPROGRESS
160
#define EINPROGRESS WSAEINPROGRESS
161
#endif
162
#endif
163
164
#include <inttypes.h>
165
166
/* vsnprintf is already defined to mingw version */
167
#if defined(_WIN32) && !defined(__USE_MINGW_ANSI_STDIO)
168
# define vsnprintf _vsnprintf
169
#endif
170
171
#ifndef MAXHOSTNAMELEN
172
#define MAXHOSTNAMELEN 64
173
#endif
174
175
#include "
globus_types.h
"
176
#endif
/* GLOBUS_COMMON_INCLUDE_H */
177
globus_types.h
Common Primitive Types.
globus_config.h
Globus Platform Configuration.
Generated by
1.8.17