1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements.  See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License.  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 
17 /*
18  * Note:
19  * This is the netware-specific autoconf-like config file
20  * which unix creates at ./configure time.
21  */
22 
23 #ifdef NETWARE
24 
25 #ifndef APR_PRIVATE_H
26 #define APR_PRIVATE_H
27 
28 /* Pick up publicly advertised headers and symbols before the
29  * APR internal private headers and symbols
30  */
31 #include <apr.h>
32 
33 /* Pick up privately consumed headers */
34 #include <ndkvers.h>
35 
36 /* Include alloca.h to get compiler-dependent defines */
37 #include <alloca.h>
38 
39 #include <sys/types.h>
40 #include <stddef.h>
41 #include <stdio.h>
42 #include <stdlib.h>
43 #include <time.h>
44 #include <library.h>
45 #include <netware.h>
46 
47 /* Use this section to define all of the HAVE_FOO_H
48  * that are required to build properly.
49  */
50 #define HAVE_DLFCN_H    1
51 #define HAVE_LIMITS_H   1
52 #define HAVE_SIGNAL_H   1
53 #define HAVE_STDDEF_H   1
54 #define HAVE_STDLIB_H   1
55 #ifndef USE_WINSOCK
56 #define HAVE_SYS_SELECT_H 1
57 #define HAVE_WRITEV       1
58 #endif
59 #define HAVE_SYS_STAT_H 1
60 #define HAVE_SYS_MMAN_H 1
61 #define HAVE_FCNTL_H    1
62 #define HAVE_ICONV_H    1
63 #define HAVE_UTIME_H    1
64 
65 #define HAVE_STRICMP    1
66 #define HAVE_STRNICMP   1
67 #define HAVE_STRDUP     1
68 #define HAVE_STRSTR     1
69 #define HAVE_MEMCHR     1
70 #define HAVE_CALLOC     1
71 #define HAVE_UTIME      1
72 
73 #define HAVE_GETENV     1
74 #define HAVE_SETENV     1
75 #define HAVE_UNSETENV   1
76 
77 #define HAVE_WRITEV     1
78 
79 #define HAVE_GETPASS_R  1
80 /*
81  * Hack around older NDKs which have only the getpassword() function,
82  * a threadsafe, API-equivalent of getpass_r().
83  */
84 #if (CURRENT_NDK_THRESHOLD < 709060000)
85 #define getpass_r       getpassword
86 #endif
87 
88 /*#define DSO_USE_DLFCN */
89 
90 #ifdef NW_BUILD_IPV6
91 #define HAVE_GETADDRINFO 1
92 #define HAVE_GETNAMEINFO 1
93 #endif
94 
95 /* 1 is used for SIGABRT on netware */
96 /* 2 is used for SIGFPE on netware */
97 /* 3 is used for SIGILL on netware */
98 /* 4 is used for SIGINT on netware */
99 /* 5 is used for SIGSEGV on netware */
100 /* 6 is used for SIGTERM on netware */
101 /* 7 is used for SIGPOLL on netware */
102 
103 #if (CURRENT_NDK_THRESHOLD < 306030000)
104 #define SIGKILL         11
105 #define SIGALRM         13
106 #define SIGCHLD         14
107 #define SIGCONT         15
108 #define SIGHUP          16
109 #define SIGPIPE         17
110 #define SIGQUIT         18
111 #define SIGSTOP         19
112 #define SIGTSTP         20
113 #define SIGTTIN         21
114 #define SIGTTOU         22
115 #define SIGUSR1         23
116 #define SIGUSR2         24
117 #endif
118 
119 #define SIGTRAP         25
120 #define SIGIOT          26
121 #define SIGSTKFLT       28
122 #define SIGURG          29
123 #define SIGXCPU         30
124 #define SIGXFSZ         31
125 #define SIGVTALRM       32
126 #define SIGPROF         33
127 #define SIGWINCH        34
128 #define SIGIO           35
129 
130 #if (CURRENT_NDK_THRESHOLD < 406230000)
131 #undef  SA_NOCLDSTOP
132 #define SA_NOCLDSTOP    0x00000001
133 #endif
134 #ifndef SIGBUS
135 #define SIGBUS          SIGSEGV
136 #endif
137 
138 #define _getch          getcharacter
139 
140 #define SIZEOF_SHORT    2
141 #define SIZEOF_INT      4
142 #define SIZEOF_LONGLONG 8
143 #define SIZEOF_CHAR     1
144 #define SIZEOF_SSIZE_T  SIZEOF_INT
145 
146 void netware_pool_proc_cleanup();
147 
148 /* NLM registration routines for managing which NLMs
149     are using the library. */
150 int register_NLM(void *NLMHandle);
151 int unregister_NLM(void *NLMHandle);
152 
153 /* Application global data management */
154 extern int  gLibId;
155 extern void *gLibHandle;
156 
157 typedef struct app_data {
158     int     initialized;
159     void*   gPool;
160     void*   gs_aHooksToSort;
161     void*   gs_phOptionalHooks;
162     void*   gs_phOptionalFunctions;
163     void*   gs_nlmhandle;
164     rtag_t  gs_startup_rtag;
165     rtag_t  gs_socket_rtag;
166     rtag_t  gs_lookup_rtag;
167     rtag_t  gs_event_rtag;
168     rtag_t  gs_pcp_rtag;
169     void*   gs_ldap_xref_lock;
170     void*   gs_xref_head;
171 } APP_DATA;
172 
173 int setGlobalPool(void *data);
174 void* getGlobalPool();
175 int setStatCache(void *data);
176 void* getStatCache();
177 
178 /* Redefine malloc to use the library malloc call so
179     that all of the memory resources will be owned
180     and can be shared by the library. */
181 #undef malloc
182 #define malloc(x) library_malloc(gLibHandle,x)
183 #ifndef __MWERKS__
184 #define _alloca         alloca
185 #endif
186 
187 /* 64-bit integer conversion function */
188 #define APR_INT64_STRFN strtoll
189 
190 #if APR_HAS_LARGE_FILES
191 #define APR_OFF_T_STRFN strtoll
192 #else
193 #define APR_OFF_T_STRFN strtol
194 #endif
195 
196 /* used to check DWORD overflow for 64bit compiles */
197 #define APR_DWORD_MAX   0xFFFFFFFFUL
198 
199 /*
200  * Include common private declarations.
201  */
202 #include "../apr_private_common.h"
203 
204 #endif  /*APR_PRIVATE_H*/
205 #endif  /*NETWARE*/
206