001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.tomcat.jni;
019:
020: /** Status
021: *
022: * @author Mladen Turk
023: * @version $Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
024: */
025:
026: public class Status {
027:
028: /**
029: * APR_OS_START_ERROR is where the APR specific error values start.
030: */
031: public static final int APR_OS_START_ERROR = 20000;
032: /**
033: * APR_OS_ERRSPACE_SIZE is the maximum number of errors you can fit
034: * into one of the error/status ranges below -- except for
035: * APR_OS_START_USERERR, which see.
036: */
037: public static final int APR_OS_ERRSPACE_SIZE = 50000;
038: /**
039: * APR_OS_START_STATUS is where the APR specific status codes start.
040: */
041: public static final int APR_OS_START_STATUS = (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE);
042:
043: /**
044: * APR_OS_START_USERERR are reserved for applications that use APR that
045: * layer their own error codes along with APR's. Note that the
046: * error immediately following this one is set ten times farther
047: * away than usual, so that users of apr have a lot of room in
048: * which to declare custom error codes.
049: */
050: public static final int APR_OS_START_USERERR = (APR_OS_START_STATUS + APR_OS_ERRSPACE_SIZE);
051: /**
052: * APR_OS_START_USEERR is obsolete, defined for compatibility only.
053: * Use APR_OS_START_USERERR instead.
054: */
055: public static final int APR_OS_START_USEERR = APR_OS_START_USERERR;
056: /**
057: * APR_OS_START_CANONERR is where APR versions of errno values are defined
058: * on systems which don't have the corresponding errno.
059: */
060: public static final int APR_OS_START_CANONERR = (APR_OS_START_USERERR + (APR_OS_ERRSPACE_SIZE * 10));
061:
062: /**
063: * APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into
064: * apr_status_t values.
065: */
066: public static final int APR_OS_START_EAIERR = (APR_OS_START_CANONERR + APR_OS_ERRSPACE_SIZE);
067: /**
068: * APR_OS_START_SYSERR folds platform-specific system error values into
069: * apr_status_t values.
070: */
071: public static final int APR_OS_START_SYSERR = (APR_OS_START_EAIERR + APR_OS_ERRSPACE_SIZE);
072:
073: /** no error. */
074: public static final int APR_SUCCESS = 0;
075:
076: /**
077: * APR Error Values
078: * <PRE>
079: * <b>APR ERROR VALUES</b>
080: * APR_ENOSTAT APR was unable to perform a stat on the file
081: * APR_ENOPOOL APR was not provided a pool with which to allocate memory
082: * APR_EBADDATE APR was given an invalid date
083: * APR_EINVALSOCK APR was given an invalid socket
084: * APR_ENOPROC APR was not given a process structure
085: * APR_ENOTIME APR was not given a time structure
086: * APR_ENODIR APR was not given a directory structure
087: * APR_ENOLOCK APR was not given a lock structure
088: * APR_ENOPOLL APR was not given a poll structure
089: * APR_ENOSOCKET APR was not given a socket
090: * APR_ENOTHREAD APR was not given a thread structure
091: * APR_ENOTHDKEY APR was not given a thread key structure
092: * APR_ENOSHMAVAIL There is no more shared memory available
093: * APR_EDSOOPEN APR was unable to open the dso object. For more
094: * information call apr_dso_error().
095: * APR_EGENERAL General failure (specific information not available)
096: * APR_EBADIP The specified IP address is invalid
097: * APR_EBADMASK The specified netmask is invalid
098: * APR_ESYMNOTFOUND Could not find the requested symbol
099: * </PRE>
100: *
101: */
102: public static final int APR_ENOSTAT = (APR_OS_START_ERROR + 1);
103: public static final int APR_ENOPOOL = (APR_OS_START_ERROR + 2);
104: public static final int APR_EBADDATE = (APR_OS_START_ERROR + 4);
105: public static final int APR_EINVALSOCK = (APR_OS_START_ERROR + 5);
106: public static final int APR_ENOPROC = (APR_OS_START_ERROR + 6);
107: public static final int APR_ENOTIME = (APR_OS_START_ERROR + 7);
108: public static final int APR_ENODIR = (APR_OS_START_ERROR + 8);
109: public static final int APR_ENOLOCK = (APR_OS_START_ERROR + 9);
110: public static final int APR_ENOPOLL = (APR_OS_START_ERROR + 10);
111: public static final int APR_ENOSOCKET = (APR_OS_START_ERROR + 11);
112: public static final int APR_ENOTHREAD = (APR_OS_START_ERROR + 12);
113: public static final int APR_ENOTHDKEY = (APR_OS_START_ERROR + 13);
114: public static final int APR_EGENERAL = (APR_OS_START_ERROR + 14);
115: public static final int APR_ENOSHMAVAIL = (APR_OS_START_ERROR + 15);
116: public static final int APR_EBADIP = (APR_OS_START_ERROR + 16);
117: public static final int APR_EBADMASK = (APR_OS_START_ERROR + 17);
118: public static final int APR_EDSOOPEN = (APR_OS_START_ERROR + 19);
119: public static final int APR_EABSOLUTE = (APR_OS_START_ERROR + 20);
120: public static final int APR_ERELATIVE = (APR_OS_START_ERROR + 21);
121: public static final int APR_EINCOMPLETE = (APR_OS_START_ERROR + 22);
122: public static final int APR_EABOVEROOT = (APR_OS_START_ERROR + 23);
123: public static final int APR_EBADPATH = (APR_OS_START_ERROR + 24);
124: public static final int APR_EPATHWILD = (APR_OS_START_ERROR + 25);
125: public static final int APR_ESYMNOTFOUND = (APR_OS_START_ERROR + 26);
126: public static final int APR_EPROC_UNKNOWN = (APR_OS_START_ERROR + 27);
127: public static final int APR_ENOTENOUGHENTROPY = (APR_OS_START_ERROR + 28);
128:
129: /** APR Status Values
130: * <PRE>
131: * <b>APR STATUS VALUES</b>
132: * APR_INCHILD Program is currently executing in the child
133: * APR_INPARENT Program is currently executing in the parent
134: * APR_DETACH The thread is detached
135: * APR_NOTDETACH The thread is not detached
136: * APR_CHILD_DONE The child has finished executing
137: * APR_CHILD_NOTDONE The child has not finished executing
138: * APR_TIMEUP The operation did not finish before the timeout
139: * APR_INCOMPLETE The operation was incomplete although some processing
140: * was performed and the results are partially valid
141: * APR_BADCH Getopt found an option not in the option string
142: * APR_BADARG Getopt found an option that is missing an argument
143: * and an argument was specified in the option string
144: * APR_EOF APR has encountered the end of the file
145: * APR_NOTFOUND APR was unable to find the socket in the poll structure
146: * APR_ANONYMOUS APR is using anonymous shared memory
147: * APR_FILEBASED APR is using a file name as the key to the shared memory
148: * APR_KEYBASED APR is using a shared key as the key to the shared memory
149: * APR_EINIT Ininitalizer value. If no option has been found, but
150: * the status variable requires a value, this should be used
151: * APR_ENOTIMPL The APR function has not been implemented on this
152: * platform, either because nobody has gotten to it yet,
153: * or the function is impossible on this platform.
154: * APR_EMISMATCH Two passwords do not match.
155: * APR_EBUSY The given lock was busy.
156: * </PRE>
157: *
158: */
159: public static final int APR_INCHILD = (APR_OS_START_STATUS + 1);
160: public static final int APR_INPARENT = (APR_OS_START_STATUS + 2);
161: public static final int APR_DETACH = (APR_OS_START_STATUS + 3);
162: public static final int APR_NOTDETACH = (APR_OS_START_STATUS + 4);
163: public static final int APR_CHILD_DONE = (APR_OS_START_STATUS + 5);
164: public static final int APR_CHILD_NOTDONE = (APR_OS_START_STATUS + 6);
165: public static final int APR_TIMEUP = (APR_OS_START_STATUS + 7);
166: public static final int APR_INCOMPLETE = (APR_OS_START_STATUS + 8);
167: public static final int APR_BADCH = (APR_OS_START_STATUS + 12);
168: public static final int APR_BADARG = (APR_OS_START_STATUS + 13);
169: public static final int APR_EOF = (APR_OS_START_STATUS + 14);
170: public static final int APR_NOTFOUND = (APR_OS_START_STATUS + 15);
171: public static final int APR_ANONYMOUS = (APR_OS_START_STATUS + 19);
172: public static final int APR_FILEBASED = (APR_OS_START_STATUS + 20);
173: public static final int APR_KEYBASED = (APR_OS_START_STATUS + 21);
174: public static final int APR_EINIT = (APR_OS_START_STATUS + 22);
175: public static final int APR_ENOTIMPL = (APR_OS_START_STATUS + 23);
176: public static final int APR_EMISMATCH = (APR_OS_START_STATUS + 24);
177: public static final int APR_EBUSY = (APR_OS_START_STATUS + 25);
178:
179: public static final int TIMEUP = (APR_OS_START_USERERR + 1);
180: public static final int EAGAIN = (APR_OS_START_USERERR + 2);
181: public static final int EINTR = (APR_OS_START_USERERR + 3);
182: public static final int EINPROGRESS = (APR_OS_START_USERERR + 4);
183: public static final int ETIMEDOUT = (APR_OS_START_USERERR + 5);
184:
185: private static native boolean is(int err, int idx);
186:
187: /**
188: * APR_STATUS_IS Status Value Tests
189: * <br /><b>Warning :</b> For any particular error condition, more than one of these tests
190: * may match. This is because platform-specific error codes may not
191: * always match the semantics of the POSIX codes these tests (and the
192: * corresponding APR error codes) are named after. A notable example
193: * are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
194: * Win32 platforms. The programmer should always be aware of this and
195: * adjust the order of the tests accordingly.
196: *
197: */
198: public static final boolean APR_STATUS_IS_ENOSTAT(int s) {
199: return is(s, 1);
200: }
201:
202: public static final boolean APR_STATUS_IS_ENOPOOL(int s) {
203: return is(s, 2);
204: }
205:
206: /* empty slot: +3 */
207: public static final boolean APR_STATUS_IS_EBADDATE(int s) {
208: return is(s, 4);
209: }
210:
211: public static final boolean APR_STATUS_IS_EINVALSOCK(int s) {
212: return is(s, 5);
213: }
214:
215: public static final boolean APR_STATUS_IS_ENOPROC(int s) {
216: return is(s, 6);
217: }
218:
219: public static final boolean APR_STATUS_IS_ENOTIME(int s) {
220: return is(s, 7);
221: }
222:
223: public static final boolean APR_STATUS_IS_ENODIR(int s) {
224: return is(s, 8);
225: }
226:
227: public static final boolean APR_STATUS_IS_ENOLOCK(int s) {
228: return is(s, 9);
229: }
230:
231: public static final boolean APR_STATUS_IS_ENOPOLL(int s) {
232: return is(s, 10);
233: }
234:
235: public static final boolean APR_STATUS_IS_ENOSOCKET(int s) {
236: return is(s, 11);
237: }
238:
239: public static final boolean APR_STATUS_IS_ENOTHREAD(int s) {
240: return is(s, 12);
241: }
242:
243: public static final boolean APR_STATUS_IS_ENOTHDKEY(int s) {
244: return is(s, 13);
245: }
246:
247: public static final boolean APR_STATUS_IS_EGENERAL(int s) {
248: return is(s, 14);
249: }
250:
251: public static final boolean APR_STATUS_IS_ENOSHMAVAIL(int s) {
252: return is(s, 15);
253: }
254:
255: public static final boolean APR_STATUS_IS_EBADIP(int s) {
256: return is(s, 16);
257: }
258:
259: public static final boolean APR_STATUS_IS_EBADMASK(int s) {
260: return is(s, 17);
261: }
262:
263: /* empty slot: +18 */
264: public static final boolean APR_STATUS_IS_EDSOPEN(int s) {
265: return is(s, 19);
266: }
267:
268: public static final boolean APR_STATUS_IS_EABSOLUTE(int s) {
269: return is(s, 20);
270: }
271:
272: public static final boolean APR_STATUS_IS_ERELATIVE(int s) {
273: return is(s, 21);
274: }
275:
276: public static final boolean APR_STATUS_IS_EINCOMPLETE(int s) {
277: return is(s, 22);
278: }
279:
280: public static final boolean APR_STATUS_IS_EABOVEROOT(int s) {
281: return is(s, 23);
282: }
283:
284: public static final boolean APR_STATUS_IS_EBADPATH(int s) {
285: return is(s, 24);
286: }
287:
288: public static final boolean APR_STATUS_IS_EPATHWILD(int s) {
289: return is(s, 25);
290: }
291:
292: public static final boolean APR_STATUS_IS_ESYMNOTFOUND(int s) {
293: return is(s, 26);
294: }
295:
296: public static final boolean APR_STATUS_IS_EPROC_UNKNOWN(int s) {
297: return is(s, 27);
298: }
299:
300: public static final boolean APR_STATUS_IS_ENOTENOUGHENTROPY(int s) {
301: return is(s, 28);
302: }
303:
304: /*
305: * APR_Error
306: */
307: public static final boolean APR_STATUS_IS_INCHILD(int s) {
308: return is(s, 51);
309: }
310:
311: public static final boolean APR_STATUS_IS_INPARENT(int s) {
312: return is(s, 52);
313: }
314:
315: public static final boolean APR_STATUS_IS_DETACH(int s) {
316: return is(s, 53);
317: }
318:
319: public static final boolean APR_STATUS_IS_NOTDETACH(int s) {
320: return is(s, 54);
321: }
322:
323: public static final boolean APR_STATUS_IS_CHILD_DONE(int s) {
324: return is(s, 55);
325: }
326:
327: public static final boolean APR_STATUS_IS_CHILD_NOTDONE(int s) {
328: return is(s, 56);
329: }
330:
331: public static final boolean APR_STATUS_IS_TIMEUP(int s) {
332: return is(s, 57);
333: }
334:
335: public static final boolean APR_STATUS_IS_INCOMPLETE(int s) {
336: return is(s, 58);
337: }
338:
339: /* empty slot: +9 */
340: /* empty slot: +10 */
341: /* empty slot: +11 */
342: public static final boolean APR_STATUS_IS_BADCH(int s) {
343: return is(s, 62);
344: }
345:
346: public static final boolean APR_STATUS_IS_BADARG(int s) {
347: return is(s, 63);
348: }
349:
350: public static final boolean APR_STATUS_IS_EOF(int s) {
351: return is(s, 64);
352: }
353:
354: public static final boolean APR_STATUS_IS_NOTFOUND(int s) {
355: return is(s, 65);
356: }
357:
358: /* empty slot: +16 */
359: /* empty slot: +17 */
360: /* empty slot: +18 */
361: public static final boolean APR_STATUS_IS_ANONYMOUS(int s) {
362: return is(s, 69);
363: }
364:
365: public static final boolean APR_STATUS_IS_FILEBASED(int s) {
366: return is(s, 70);
367: }
368:
369: public static final boolean APR_STATUS_IS_KEYBASED(int s) {
370: return is(s, 71);
371: }
372:
373: public static final boolean APR_STATUS_IS_EINIT(int s) {
374: return is(s, 72);
375: }
376:
377: public static final boolean APR_STATUS_IS_ENOTIMPL(int s) {
378: return is(s, 73);
379: }
380:
381: public static final boolean APR_STATUS_IS_EMISMATCH(int s) {
382: return is(s, 74);
383: }
384:
385: public static final boolean APR_STATUS_IS_EBUSY(int s) {
386: return is(s, 75);
387: }
388:
389: /* Socket errors */
390: public static final boolean APR_STATUS_IS_EAGAIN(int s) {
391: return is(s, 90);
392: }
393:
394: public static final boolean APR_STATUS_IS_ETIMEDOUT(int s) {
395: return is(s, 91);
396: }
397:
398: public static final boolean APR_STATUS_IS_ECONNABORTED(int s) {
399: return is(s, 92);
400: }
401:
402: public static final boolean APR_STATUS_IS_ECONNRESET(int s) {
403: return is(s, 93);
404: }
405:
406: public static final boolean APR_STATUS_IS_EINPROGRESS(int s) {
407: return is(s, 94);
408: }
409:
410: public static final boolean APR_STATUS_IS_EINTR(int s) {
411: return is(s, 95);
412: }
413:
414: public static final boolean APR_STATUS_IS_ENOTSOCK(int s) {
415: return is(s, 96);
416: }
417:
418: public static final boolean APR_STATUS_IS_EINVAL(int s) {
419: return is(s, 97);
420: }
421:
422: }
|