| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 * contributor license agreements. See the NOTICE file distributed with | |
| 4 * this work for additional information regarding copyright ownership. | |
| 5 * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 * (the "License"); you may not use this file except in compliance with | |
| 7 * the License. You may obtain a copy of the License at | |
| 8 * | |
| 9 * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 * | |
| 11 * Unless required by applicable law or agreed to in writing, software | |
| 12 * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 * See the License for the specific language governing permissions and | |
| 15 * limitations under the License. | |
| 16 */ | |
| 17 | |
| 18 package org.apache.tomcat.jni; | |
| 19 | |
| 20 /** Status | |
| 21 * | |
| 22 * @author Mladen Turk | |
| 23 */ | |
| 24 public class Status { | |
| 25 | |
| 26 /** | |
| 27 * APR_OS_START_ERROR is where the APR specific error values start. | |
| 28 */ | |
| 29 public static final int APR_OS_START_ERROR = 20000; | |
| 30 /** | |
| 31 * APR_OS_ERRSPACE_SIZE is the maximum number of errors you can fit | |
| 32 * into one of the error/status ranges below -- except for | |
| 33 * APR_OS_START_USERERR, which see. | |
| 34 */ | |
| 35 public static final int APR_OS_ERRSPACE_SIZE = 50000; | |
| 36 /** | |
| 37 * APR_OS_START_STATUS is where the APR specific status codes start. | |
| 38 */ | |
| 39 public static final int APR_OS_START_STATUS = (APR_OS_START_ERROR + APR_OS
_ERRSPACE_SIZE); | |
| 40 | |
| 41 /** | |
| 42 * APR_OS_START_USERERR are reserved for applications that use APR that | |
| 43 * layer their own error codes along with APR's. Note that the | |
| 44 * error immediately following this one is set ten times farther | |
| 45 * away than usual, so that users of apr have a lot of room in | |
| 46 * which to declare custom error codes. | |
| 47 */ | |
| 48 public static final int APR_OS_START_USERERR = (APR_OS_START_STATUS + APR_O
S_ERRSPACE_SIZE); | |
| 49 /** | |
| 50 * APR_OS_START_USEERR is obsolete, defined for compatibility only. | |
| 51 * Use APR_OS_START_USERERR instead. | |
| 52 */ | |
| 53 public static final int APR_OS_START_USEERR = APR_OS_START_USERERR; | |
| 54 /** | |
| 55 * APR_OS_START_CANONERR is where APR versions of errno values are defined | |
| 56 * on systems which don't have the corresponding errno. | |
| 57 */ | |
| 58 public static final int APR_OS_START_CANONERR = (APR_OS_START_USERERR + (AP
R_OS_ERRSPACE_SIZE * 10)); | |
| 59 | |
| 60 /** | |
| 61 * APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into | |
| 62 * apr_status_t values. | |
| 63 */ | |
| 64 public static final int APR_OS_START_EAIERR = (APR_OS_START_CANONERR + APR_
OS_ERRSPACE_SIZE); | |
| 65 /** | |
| 66 * APR_OS_START_SYSERR folds platform-specific system error values into | |
| 67 * apr_status_t values. | |
| 68 */ | |
| 69 public static final int APR_OS_START_SYSERR = (APR_OS_START_EAIERR + APR_OS
_ERRSPACE_SIZE); | |
| 70 | |
| 71 /** no error. */ | |
| 72 public static final int APR_SUCCESS = 0; | |
| 73 | |
| 74 /** | |
| 75 * APR Error Values | |
| 76 * <PRE> | |
| 77 * <b>APR ERROR VALUES</b> | |
| 78 * APR_ENOSTAT APR was unable to perform a stat on the file | |
| 79 * APR_ENOPOOL APR was not provided a pool with which to allocate memor
y | |
| 80 * APR_EBADDATE APR was given an invalid date | |
| 81 * APR_EINVALSOCK APR was given an invalid socket | |
| 82 * APR_ENOPROC APR was not given a process structure | |
| 83 * APR_ENOTIME APR was not given a time structure | |
| 84 * APR_ENODIR APR was not given a directory structure | |
| 85 * APR_ENOLOCK APR was not given a lock structure | |
| 86 * APR_ENOPOLL APR was not given a poll structure | |
| 87 * APR_ENOSOCKET APR was not given a socket | |
| 88 * APR_ENOTHREAD APR was not given a thread structure | |
| 89 * APR_ENOTHDKEY APR was not given a thread key structure | |
| 90 * APR_ENOSHMAVAIL There is no more shared memory available | |
| 91 * APR_EDSOOPEN APR was unable to open the dso object. For more | |
| 92 * information call apr_dso_error(). | |
| 93 * APR_EGENERAL General failure (specific information not available) | |
| 94 * APR_EBADIP The specified IP address is invalid | |
| 95 * APR_EBADMASK The specified netmask is invalid | |
| 96 * APR_ESYMNOTFOUND Could not find the requested symbol | |
| 97 * </PRE> | |
| 98 * | |
| 99 */ | |
| 100 public static final int APR_ENOSTAT = (APR_OS_START_ERROR + 1); | |
| 101 public static final int APR_ENOPOOL = (APR_OS_START_ERROR + 2); | |
| 102 public static final int APR_EBADDATE = (APR_OS_START_ERROR + 4); | |
| 103 public static final int APR_EINVALSOCK = (APR_OS_START_ERROR + 5); | |
| 104 public static final int APR_ENOPROC = (APR_OS_START_ERROR + 6); | |
| 105 public static final int APR_ENOTIME = (APR_OS_START_ERROR + 7); | |
| 106 public static final int APR_ENODIR = (APR_OS_START_ERROR + 8); | |
| 107 public static final int APR_ENOLOCK = (APR_OS_START_ERROR + 9); | |
| 108 public static final int APR_ENOPOLL = (APR_OS_START_ERROR + 10); | |
| 109 public static final int APR_ENOSOCKET = (APR_OS_START_ERROR + 11); | |
| 110 public static final int APR_ENOTHREAD = (APR_OS_START_ERROR + 12); | |
| 111 public static final int APR_ENOTHDKEY = (APR_OS_START_ERROR + 13); | |
| 112 public static final int APR_EGENERAL = (APR_OS_START_ERROR + 14); | |
| 113 public static final int APR_ENOSHMAVAIL = (APR_OS_START_ERROR + 15); | |
| 114 public static final int APR_EBADIP = (APR_OS_START_ERROR + 16); | |
| 115 public static final int APR_EBADMASK = (APR_OS_START_ERROR + 17); | |
| 116 public static final int APR_EDSOOPEN = (APR_OS_START_ERROR + 19); | |
| 117 public static final int APR_EABSOLUTE = (APR_OS_START_ERROR + 20); | |
| 118 public static final int APR_ERELATIVE = (APR_OS_START_ERROR + 21); | |
| 119 public static final int APR_EINCOMPLETE = (APR_OS_START_ERROR + 22); | |
| 120 public static final int APR_EABOVEROOT = (APR_OS_START_ERROR + 23); | |
| 121 public static final int APR_EBADPATH = (APR_OS_START_ERROR + 24); | |
| 122 public static final int APR_EPATHWILD = (APR_OS_START_ERROR + 25); | |
| 123 public static final int APR_ESYMNOTFOUND = (APR_OS_START_ERROR + 26); | |
| 124 public static final int APR_EPROC_UNKNOWN = (APR_OS_START_ERROR + 27); | |
| 125 public static final int APR_ENOTENOUGHENTROPY = (APR_OS_START_ERROR + 28); | |
| 126 | |
| 127 /** APR Status Values | |
| 128 * <PRE> | |
| 129 * <b>APR STATUS VALUES</b> | |
| 130 * APR_INCHILD Program is currently executing in the child | |
| 131 * APR_INPARENT Program is currently executing in the parent | |
| 132 * APR_DETACH The thread is detached | |
| 133 * APR_NOTDETACH The thread is not detached | |
| 134 * APR_CHILD_DONE The child has finished executing | |
| 135 * APR_CHILD_NOTDONE The child has not finished executing | |
| 136 * APR_TIMEUP The operation did not finish before the timeout | |
| 137 * APR_INCOMPLETE The operation was incomplete although some processing | |
| 138 * was performed and the results are partially valid | |
| 139 * APR_BADCH Getopt found an option not in the option string | |
| 140 * APR_BADARG Getopt found an option that is missing an argument | |
| 141 * and an argument was specified in the option string | |
| 142 * APR_EOF APR has encountered the end of the file | |
| 143 * APR_NOTFOUND APR was unable to find the socket in the poll structur
e | |
| 144 * APR_ANONYMOUS APR is using anonymous shared memory | |
| 145 * APR_FILEBASED APR is using a file name as the key to the shared memo
ry | |
| 146 * APR_KEYBASED APR is using a shared key as the key to the shared mem
ory | |
| 147 * APR_EINIT Ininitalizer value. If no option has been found, but | |
| 148 * the status variable requires a value, this should be u
sed | |
| 149 * APR_ENOTIMPL The APR function has not been implemented on this | |
| 150 * platform, either because nobody has gotten to it yet, | |
| 151 * or the function is impossible on this platform. | |
| 152 * APR_EMISMATCH Two passwords do not match. | |
| 153 * APR_EBUSY The given lock was busy. | |
| 154 * </PRE> | |
| 155 * | |
| 156 */ | |
| 157 public static final int APR_INCHILD = (APR_OS_START_STATUS + 1); | |
| 158 public static final int APR_INPARENT = (APR_OS_START_STATUS + 2); | |
| 159 public static final int APR_DETACH = (APR_OS_START_STATUS + 3); | |
| 160 public static final int APR_NOTDETACH = (APR_OS_START_STATUS + 4); | |
| 161 public static final int APR_CHILD_DONE = (APR_OS_START_STATUS + 5); | |
| 162 public static final int APR_CHILD_NOTDONE = (APR_OS_START_STATUS + 6); | |
| 163 public static final int APR_TIMEUP = (APR_OS_START_STATUS + 7); | |
| 164 public static final int APR_INCOMPLETE = (APR_OS_START_STATUS + 8); | |
| 165 public static final int APR_BADCH = (APR_OS_START_STATUS + 12); | |
| 166 public static final int APR_BADARG = (APR_OS_START_STATUS + 13); | |
| 167 public static final int APR_EOF = (APR_OS_START_STATUS + 14); | |
| 168 public static final int APR_NOTFOUND = (APR_OS_START_STATUS + 15); | |
| 169 public static final int APR_ANONYMOUS = (APR_OS_START_STATUS + 19); | |
| 170 public static final int APR_FILEBASED = (APR_OS_START_STATUS + 20); | |
| 171 public static final int APR_KEYBASED = (APR_OS_START_STATUS + 21); | |
| 172 public static final int APR_EINIT = (APR_OS_START_STATUS + 22); | |
| 173 public static final int APR_ENOTIMPL = (APR_OS_START_STATUS + 23); | |
| 174 public static final int APR_EMISMATCH = (APR_OS_START_STATUS + 24); | |
| 175 public static final int APR_EBUSY = (APR_OS_START_STATUS + 25); | |
| 176 | |
| 177 public static final int TIMEUP = (APR_OS_START_USERERR + 1); | |
| 178 public static final int EAGAIN = (APR_OS_START_USERERR + 2); | |
| 179 public static final int EINTR = (APR_OS_START_USERERR + 3); | |
| 180 public static final int EINPROGRESS = (APR_OS_START_USERERR + 4); | |
| 181 public static final int ETIMEDOUT = (APR_OS_START_USERERR + 5); | |
| 182 | |
| 183 private static native boolean is(int err, int idx); | |
| 184 /** | |
| 185 * APR_STATUS_IS Status Value Tests | |
| 186 * <br><b>Warning :</b> For any particular error condition, more than one of
these tests | |
| 187 * may match. This is because platform-specific error codes may not | |
| 188 * always match the semantics of the POSIX codes these tests (and the | |
| 189 * corresponding APR error codes) are named after. A notable example | |
| 190 * are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on | |
| 191 * Win32 platforms. The programmer should always be aware of this and | |
| 192 * adjust the order of the tests accordingly. | |
| 193 * | |
| 194 */ | |
| 195 public static final boolean APR_STATUS_IS_ENOSTAT(int s) { return is(s, 1
); } | |
| 196 public static final boolean APR_STATUS_IS_ENOPOOL(int s) { return is(s, 2
); } | |
| 197 /* empty slot: +3 */ | |
| 198 public static final boolean APR_STATUS_IS_EBADDATE(int s) { return is(s, 4
); } | |
| 199 public static final boolean APR_STATUS_IS_EINVALSOCK(int s) { return is(s, 5
); } | |
| 200 public static final boolean APR_STATUS_IS_ENOPROC(int s) { return is(s, 6
); } | |
| 201 public static final boolean APR_STATUS_IS_ENOTIME(int s) { return is(s, 7
); } | |
| 202 public static final boolean APR_STATUS_IS_ENODIR(int s) { return is(s, 8
); } | |
| 203 public static final boolean APR_STATUS_IS_ENOLOCK(int s) { return is(s, 9
); } | |
| 204 public static final boolean APR_STATUS_IS_ENOPOLL(int s) { return is(s, 1
0); } | |
| 205 public static final boolean APR_STATUS_IS_ENOSOCKET(int s) { return is(s, 1
1); } | |
| 206 public static final boolean APR_STATUS_IS_ENOTHREAD(int s) { return is(s, 1
2); } | |
| 207 public static final boolean APR_STATUS_IS_ENOTHDKEY(int s) { return is(s, 1
3); } | |
| 208 public static final boolean APR_STATUS_IS_EGENERAL(int s) { return is(s, 1
4); } | |
| 209 public static final boolean APR_STATUS_IS_ENOSHMAVAIL(int s){ return is(s, 1
5); } | |
| 210 public static final boolean APR_STATUS_IS_EBADIP(int s) { return is(s, 1
6); } | |
| 211 public static final boolean APR_STATUS_IS_EBADMASK(int s) { return is(s, 1
7); } | |
| 212 /* empty slot: +18 */ | |
| 213 public static final boolean APR_STATUS_IS_EDSOPEN(int s) { return is(s, 1
9); } | |
| 214 public static final boolean APR_STATUS_IS_EABSOLUTE(int s) { return is(s, 2
0); } | |
| 215 public static final boolean APR_STATUS_IS_ERELATIVE(int s) { return is(s, 2
1); } | |
| 216 public static final boolean APR_STATUS_IS_EINCOMPLETE(int s){ return is(s, 2
2); } | |
| 217 public static final boolean APR_STATUS_IS_EABOVEROOT(int s) { return is(s, 2
3); } | |
| 218 public static final boolean APR_STATUS_IS_EBADPATH(int s) { return is(s, 2
4); } | |
| 219 public static final boolean APR_STATUS_IS_EPATHWILD(int s) { return is(s, 2
5); } | |
| 220 public static final boolean APR_STATUS_IS_ESYMNOTFOUND(int s) { return
is(s, 26); } | |
| 221 public static final boolean APR_STATUS_IS_EPROC_UNKNOWN(int s) { return
is(s, 27); } | |
| 222 public static final boolean APR_STATUS_IS_ENOTENOUGHENTROPY(int s) { return
is(s, 28); } | |
| 223 | |
| 224 /* | |
| 225 * APR_Error | |
| 226 */ | |
| 227 public static final boolean APR_STATUS_IS_INCHILD(int s) { return is(s, 5
1); } | |
| 228 public static final boolean APR_STATUS_IS_INPARENT(int s) { return is(s, 5
2); } | |
| 229 public static final boolean APR_STATUS_IS_DETACH(int s) { return is(s, 5
3); } | |
| 230 public static final boolean APR_STATUS_IS_NOTDETACH(int s) { return is(s, 5
4); } | |
| 231 public static final boolean APR_STATUS_IS_CHILD_DONE(int s) { return is(s, 5
5); } | |
| 232 public static final boolean APR_STATUS_IS_CHILD_NOTDONE(int s) { return is(
s, 56); } | |
| 233 public static final boolean APR_STATUS_IS_TIMEUP(int s) { return is(s, 5
7); } | |
| 234 public static final boolean APR_STATUS_IS_INCOMPLETE(int s) { return is(s, 5
8); } | |
| 235 /* empty slot: +9 */ | |
| 236 /* empty slot: +10 */ | |
| 237 /* empty slot: +11 */ | |
| 238 public static final boolean APR_STATUS_IS_BADCH(int s) { return is(s, 6
2); } | |
| 239 public static final boolean APR_STATUS_IS_BADARG(int s) { return is(s, 6
3); } | |
| 240 public static final boolean APR_STATUS_IS_EOF(int s) { return is(s, 6
4); } | |
| 241 public static final boolean APR_STATUS_IS_NOTFOUND(int s) { return is(s, 6
5); } | |
| 242 /* empty slot: +16 */ | |
| 243 /* empty slot: +17 */ | |
| 244 /* empty slot: +18 */ | |
| 245 public static final boolean APR_STATUS_IS_ANONYMOUS(int s) { return is(s, 6
9); } | |
| 246 public static final boolean APR_STATUS_IS_FILEBASED(int s) { return is(s, 7
0); } | |
| 247 public static final boolean APR_STATUS_IS_KEYBASED(int s) { return is(s, 7
1); } | |
| 248 public static final boolean APR_STATUS_IS_EINIT(int s) { return is(s, 7
2); } | |
| 249 public static final boolean APR_STATUS_IS_ENOTIMPL(int s) { return is(s, 7
3); } | |
| 250 public static final boolean APR_STATUS_IS_EMISMATCH(int s) { return is(s, 7
4); } | |
| 251 public static final boolean APR_STATUS_IS_EBUSY(int s) { return is(s, 7
5); } | |
| 252 | |
| 253 /* Socket errors */ | |
| 254 public static final boolean APR_STATUS_IS_EAGAIN(int s) { return is(s, 9
0); } | |
| 255 public static final boolean APR_STATUS_IS_ETIMEDOUT(int s) { return is(s, 9
1); } | |
| 256 public static final boolean APR_STATUS_IS_ECONNABORTED(int s) { return is(s,
92); } | |
| 257 public static final boolean APR_STATUS_IS_ECONNRESET(int s) { return is(s,
93); } | |
| 258 public static final boolean APR_STATUS_IS_EINPROGRESS(int s) { return is(s,
94); } | |
| 259 public static final boolean APR_STATUS_IS_EINTR(int s) { return is(s, 9
5); } | |
| 260 public static final boolean APR_STATUS_IS_ENOTSOCK(int s) { return is(s, 9
6); } | |
| 261 public static final boolean APR_STATUS_IS_EINVAL(int s) { return is(s, 9
7); } | |
| 262 | |
| 263 } | |
| OLD | NEW |