Home | History | Annotate | Download | only in tinyutils
      1 /*
      2  * Copyright (C) 2007 The Android Open Source Project
      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 
     17 #ifndef ANDROID_ERRORS_H
     18 #define ANDROID_ERRORS_H
     19 
     20 #include <sys/types.h>
     21 #include <errno.h>
     22 
     23 namespace android {
     24 
     25 // use this type to return error codes
     26 typedef int32_t     status_t;
     27 
     28 /*
     29  * Error codes.
     30  * All error codes are negative values.
     31  */
     32 
     33 enum {
     34     OK                = 0,    // Everything's swell.
     35     NO_ERROR          = 0,    // No errors.
     36 
     37     UNKNOWN_ERROR       = 0x80000000,
     38 
     39     NO_MEMORY           = -ENOMEM,
     40     INVALID_OPERATION   = -ENOSYS,
     41     BAD_VALUE           = -EINVAL,
     42     BAD_TYPE            = 0x80000001,
     43     NAME_NOT_FOUND      = -ENOENT,
     44     PERMISSION_DENIED   = -EPERM,
     45     NO_INIT             = -ENODEV,
     46     ALREADY_EXISTS      = -EEXIST,
     47     DEAD_OBJECT         = -EPIPE,
     48     FAILED_TRANSACTION  = 0x80000002,
     49     JPARKS_BROKE_IT     = -EPIPE,
     50     BAD_INDEX           = -EOVERFLOW,
     51     NOT_ENOUGH_DATA     = -ENODATA,
     52     WOULD_BLOCK         = -EWOULDBLOCK,
     53     TIMED_OUT           = -ETIME,
     54     UNKNOWN_TRANSACTION = -EBADMSG,
     55 };
     56 
     57 
     58 }; // namespace android
     59 
     60 // ---------------------------------------------------------------------------
     61 
     62 #endif // ANDROID_ERRORS_H
     63