| 1 | /* |
| 2 | * SPDX-License-Identifier: LGPL-2.1-only |
| 3 | * |
| 4 | * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca> |
| 5 | * Copyright (C) 2011 Julien Desfossez <julien.desfossez@polymtl.ca> |
| 6 | * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 7 | */ |
| 8 | |
| 9 | #ifndef _LTTNG_UST_ERROR_H |
| 10 | #define _LTTNG_UST_ERROR_H |
| 11 | |
| 12 | #include <limits.h> |
| 13 | #include <unistd.h> |
| 14 | #include <lttng/ust-abi.h> |
| 15 | |
| 16 | #ifdef __cplusplus |
| 17 | extern "C" { |
| 18 | #endif |
| 19 | |
| 20 | /* |
| 21 | * ustcomm error code. |
| 22 | */ |
| 23 | enum lttng_ust_error_code { |
| 24 | LTTNG_UST_OK = 0, /* Ok */ |
| 25 | LTTNG_UST_ERR = 1024, /* Unknown Error */ |
| 26 | LTTNG_UST_ERR_NOENT = 1025, /* No entry */ |
| 27 | LTTNG_UST_ERR_EXIST = 1026, /* Object exists */ |
| 28 | LTTNG_UST_ERR_INVAL = 1027, /* Invalid argument */ |
| 29 | LTTNG_UST_ERR_PERM = 1028, /* Permission denied */ |
| 30 | LTTNG_UST_ERR_NOSYS = 1029, /* Not implemented */ |
| 31 | LTTNG_UST_ERR_EXITING = 1030, /* Process is exiting */ |
| 32 | |
| 33 | LTTNG_UST_ERR_INVAL_MAGIC = 1031, /* Invalid magic number */ |
| 34 | LTTNG_UST_ERR_INVAL_SOCKET_TYPE = 1032, /* Invalid socket type */ |
| 35 | LTTNG_UST_ERR_UNSUP_MAJOR = 1033, /* Unsupported major version */ |
| 36 | LTTNG_UST_ERR_PEERCRED = 1034, /* Cannot get unix socket peer credentials */ |
| 37 | LTTNG_UST_ERR_PEERCRED_PID = 1035, /* Peer credentials PID is invalid. Socket appears to belong to a distinct, non-nested pid namespace. */ |
| 38 | |
| 39 | /* MUST be last element */ |
| 40 | LTTNG_UST_ERR_NR, /* Last element */ |
| 41 | }; |
| 42 | |
| 43 | /* |
| 44 | * lttng_ust_strerror |
| 45 | * @code: must be a negative value of enum lttng_ust_error_code (or 0). |
| 46 | * |
| 47 | * Returns a ptr to a string representing a human readable error code from the |
| 48 | * ustcomm_return_code enum. |
| 49 | */ |
| 50 | const char *lttng_ust_strerror(int code); |
| 51 | |
| 52 | #ifdef __cplusplus |
| 53 | } |
| 54 | #endif |
| 55 | |
| 56 | #endif /* _LTTNG_UST_ERROR_H */ |