| 1 | /* |
| 2 | * No include guards here: this header is included by a public header to |
| 3 | * get the `__BT_FUNC_STATUS_*` definitions locally, and then |
| 4 | * <babeltrace2/undef-func-status.h> is included at the end of the |
| 5 | * header to undefine all those definitions. |
| 6 | * |
| 7 | * If we forget to include <babeltrace2/undef-func-status.h> at the end |
| 8 | * of a public header, we want to get the "redefined" compiler warning |
| 9 | * to catch it. |
| 10 | */ |
| 11 | |
| 12 | /* |
| 13 | * Copyright (c) 2019 Philippe Proulx <pproulx@efficios.com> |
| 14 | * |
| 15 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 16 | * of this software and associated documentation files (the "Software"), to deal |
| 17 | * in the Software without restriction, including without limitation the rights |
| 18 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 19 | * copies of the Software, and to permit persons to whom the Software is |
| 20 | * furnished to do so, subject to the following conditions: |
| 21 | * |
| 22 | * The above copyright notice and this permission notice shall be included in |
| 23 | * all copies or substantial portions of the Software. |
| 24 | * |
| 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 30 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 31 | * SOFTWARE. |
| 32 | */ |
| 33 | |
| 34 | /* |
| 35 | * This is just extra protection, in case the user tries to include |
| 36 | * <babeltrace2/func-status.h> in user code: this is a redminder that |
| 37 | * this header is reserved for internal use. |
| 38 | * |
| 39 | * The correct way for a public header to include this is: |
| 40 | * |
| 41 | * #define __BT_FUNC_STATUS_ENABLE |
| 42 | * #include <babeltrace2/func-status.h> |
| 43 | * #undef __BT_FUNC_STATUS_ENABLE |
| 44 | */ |
| 45 | #ifndef __BT_FUNC_STATUS_ENABLE |
| 46 | # error Do NOT include <babeltrace2/func-status.h> in user code. |
| 47 | #endif |
| 48 | |
| 49 | /* |
| 50 | * This is NOT part of the API. |
| 51 | * |
| 52 | * Do NOT use a `__BT_FUNC_STATUS_*` value in user code: this inhibits |
| 53 | * precious type checking. |
| 54 | */ |
| 55 | |
| 56 | /* Value is too large for the given data type */ |
| 57 | #define __BT_FUNC_STATUS_OVERFLOW -75 |
| 58 | |
| 59 | /* Invalid query parameters */ |
| 60 | #define __BT_FUNC_STATUS_INVALID_PARAMS -24 |
| 61 | |
| 62 | /* Invalid query object */ |
| 63 | #define __BT_FUNC_STATUS_INVALID_OBJECT -23 |
| 64 | |
| 65 | /* Memory allocation error */ |
| 66 | #define __BT_FUNC_STATUS_MEMORY_ERROR -12 |
| 67 | |
| 68 | /* Plugin loading error */ |
| 69 | #define __BT_FUNC_STATUS_LOADING_ERROR -2 |
| 70 | |
| 71 | /* General error */ |
| 72 | #define __BT_FUNC_STATUS_ERROR -1 |
| 73 | |
| 74 | /* Saul Goodman */ |
| 75 | #define __BT_FUNC_STATUS_OK 0 |
| 76 | |
| 77 | /* End of iteration/consumption */ |
| 78 | #define __BT_FUNC_STATUS_END 1 |
| 79 | |
| 80 | /* Something can't be found */ |
| 81 | #define __BT_FUNC_STATUS_NOT_FOUND 2 |
| 82 | |
| 83 | /* Try operation again later */ |
| 84 | #define __BT_FUNC_STATUS_AGAIN 11 |
| 85 | |
| 86 | /* Unsupported operation */ |
| 87 | #define __BT_FUNC_STATUS_UNSUPPORTED 95 |
| 88 | |
| 89 | /* Object is canceled */ |
| 90 | #define __BT_FUNC_STATUS_CANCELED 125 |