Mercurial > notdcc
comparison dcclib/clnt_unthreaded.c @ 0:c7f6b056b673
First import of vendor version
author | Peter Gervai <grin@grin.hu> |
---|---|
date | Tue, 10 Mar 2009 13:49:58 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c7f6b056b673 |
---|---|
1 /* Distributed Checksum Clearinghouse | |
2 * | |
3 * unthreaded version of client locking | |
4 * | |
5 * Copyright (c) 2008 by Rhyolite Software, LLC | |
6 * | |
7 * This agreement is not applicable to any entity which sells anti-spam | |
8 * solutions to others or provides an anti-spam solution as part of a | |
9 * security solution sold to other entities, or to a private network | |
10 * which employs the DCC or uses data provided by operation of the DCC | |
11 * but does not provide corresponding data to other users. | |
12 * | |
13 * Permission to use, copy, modify, and distribute this software without | |
14 * changes for any purpose with or without fee is hereby granted, provided | |
15 * that the above copyright notice and this permission notice appear in all | |
16 * copies and any distributed versions or copies are either unchanged | |
17 * or not called anything similar to "DCC" or "Distributed Checksum | |
18 * Clearinghouse". | |
19 * | |
20 * Parties not eligible to receive a license under this agreement can | |
21 * obtain a commercial license to use DCC by contacting Rhyolite Software | |
22 * at sales@rhyolite.com. | |
23 * | |
24 * A commercial license would be for Distributed Checksum and Reputation | |
25 * Clearinghouse software. That software includes additional features. This | |
26 * free license for Distributed ChecksumClearinghouse Software does not in any | |
27 * way grant permision to use Distributed Checksum and Reputation Clearinghouse | |
28 * software | |
29 * | |
30 * THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE, LLC DISCLAIMS ALL | |
31 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES | |
32 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE, LLC | |
33 * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES | |
34 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
35 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |
36 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
37 * SOFTWARE. | |
38 * | |
39 * Rhyolite Software DCC 1.3.103-1.47 $Revision$ | |
40 */ | |
41 | |
42 #include "dcc_ck.h" | |
43 | |
44 | |
45 /* many POSIX thread implementations have unexpected side effects on | |
46 * ordinary system calls, so don't use the threaded version unless | |
47 * necessary */ | |
48 | |
49 u_char grey_on; | |
50 u_char grey_query_only; | |
51 | |
52 DCC_WF cmn_wf, cmn_tmp_wf; | |
53 | |
54 | |
55 static u_char ctxts_locked; | |
56 | |
57 | |
58 void | |
59 dcc_ctxts_lock(void) | |
60 { | |
61 #ifdef DCC_DEBUG_CLNT_LOCK | |
62 if (ctxts_locked) | |
63 dcc_logbad(EX_SOFTWARE, "already have ctxts lock"); | |
64 #endif | |
65 ++ctxts_locked; | |
66 } | |
67 | |
68 | |
69 | |
70 void | |
71 dcc_ctxts_unlock(void) | |
72 { | |
73 assert_ctxts_locked(); | |
74 --ctxts_locked; | |
75 } | |
76 | |
77 | |
78 | |
79 #ifdef DCC_DEBUG_CLNT_LOCK | |
80 void | |
81 assert_ctxts_locked(void) | |
82 { | |
83 if (!ctxts_locked) | |
84 dcc_logbad(EX_SOFTWARE, "don't have ctxts lock"); | |
85 } | |
86 | |
87 | |
88 | |
89 void | |
90 assert_ctxts_unlocked(void) | |
91 { | |
92 if (ctxts_locked) | |
93 dcc_logbad(EX_SOFTWARE, "have ctxts lock"); | |
94 } | |
95 #endif | |
96 | |
97 | |
98 | |
99 void | |
100 dcc_syslog_lock(void) | |
101 { | |
102 } | |
103 | |
104 | |
105 | |
106 void | |
107 dcc_syslog_unlock(void) | |
108 { | |
109 } | |
110 | |
111 | |
112 | |
113 u_char dcc_host_locked = 1; | |
114 | |
115 /* This function is mentioned in dccifd/dccif-test/dccif-test.c | |
116 * and so cannot change lightly. */ | |
117 void | |
118 dcc_host_lock(void) | |
119 { | |
120 } | |
121 | |
122 | |
123 | |
124 /* This function is mentioned in dccifd/dccif-test/dccif-test.c | |
125 * and so cannot change lightly. */ | |
126 void | |
127 dcc_host_unlock(void) | |
128 { | |
129 } | |
130 | |
131 | |
132 | |
133 #ifdef DCC_DEBUG_HEAP | |
134 void | |
135 dcc_malloc_lock(void) | |
136 { | |
137 } | |
138 | |
139 | |
140 void | |
141 dcc_malloc_unlock(void) | |
142 { | |
143 } | |
144 #endif /* DCC_DEBUG_HEAP */ | |
145 | |
146 | |
147 | |
148 #ifndef HAVE_LOCALTIME_R | |
149 void | |
150 dcc_localtime_lock(void) | |
151 { | |
152 } | |
153 | |
154 | |
155 | |
156 void | |
157 dcc_localtime_unlock(void) | |
158 { | |
159 } | |
160 #endif /* HAVE_LOCALTIME_R */ | |
161 | |
162 | |
163 | |
164 void | |
165 dcc_clnt_unthread_init(void) | |
166 { | |
167 #ifdef DCC_WIN32 | |
168 win32_init(); | |
169 #endif | |
170 } | |
171 | |
172 | |
173 u_char | |
174 dcc_clnt_wake_resolve(void) | |
175 { | |
176 return 0; | |
177 } | |
178 | |
179 | |
180 | |
181 #ifdef DCC_DEBUG_CLNT_LOCK | |
182 void | |
183 assert_cwf_locked(void) | |
184 { | |
185 } | |
186 #endif | |
187 | |
188 | |
189 | |
190 u_char | |
191 helper_lock_init(void) | |
192 { | |
193 return 0; | |
194 } | |
195 | |
196 | |
197 | |
198 void | |
199 helper_lock(void) | |
200 { | |
201 } | |
202 | |
203 | |
204 | |
205 void | |
206 helper_unlock(void) | |
207 { | |
208 } | |
209 | |
210 | |
211 | |
212 const REPLY_TPLT * | |
213 dnsbl_parse_reply(const char *pat UATTRIB) | |
214 { | |
215 return 0; | |
216 } |