Add libc errno translation layer to UST error code
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 13 lines · * David Goulet ([email protected]) wrote:
Also add four new possible code being EEXIST, EINVAL, ENOSYS and EPERM.
Signed-off-by David Goulet <[email protected]>--- include/lttng/ust-error.h | 6 +++++- liblttng-ust/lttng-ust-comm.c | 26 +++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-)include/lttng/ust-error.h +0
-0
include/lttng/ust-error.h line 43
Quoted 9 lines
include/lttng/ust-error.h +5
-1@@ -36,7 +36,11 @@enum lttng_ust_error_code {LTTNG_UST_OK =0 ,/* Ok */ LTTNG_UST_ERR =1024 ,/* Unknown Error */ -LTTNG_UST_ERR_NOENT ,/* No entry */ +LTTNG_UST_ERR_NOENT =1025 ,/* No entry */ +LTTNG_UST_ERR_EXIST =1026 ,/* Object exists */ +LTTNG_UST_ERR_INVAL =1027 ,/* Invalid argument */ +LTTNG_UST_ERR_PERM =1028 ,/* Permission denied */ +LTTNG_UST_ERR_NOSYS =1029 ,/* Not implemented */
you forgot the liblttng-ust-comm/liblttng-ust-comm.c array (mapping from values to strings).
Thanks,
Mathieu
Quoted 48 lines
include/lttng/ust-error.h +0
-0/* MUST be last element */ LTTNG_UST_ERR_NR, /* Last element */liblttng-ust/lttng-ust-comm.c +23
-3@@ -376,9 +376,29 @@ end:* we already have a more precise error message to * report. */ -if (ret > -LTTNG_UST_ERR ) - lur.ret_code = -LTTNG_UST_ERR ; -else +if (ret > -LTTNG_UST_ERR ) { +/* Translate code to UST error. */ +switch (ret) { +case -EEXIST : + lur.ret_code = -LTTNG_UST_ERR_EXIST ; +break ; +case -EINVAL : + lur.ret_code = -LTTNG_UST_ERR_INVAL ; +break ; +case -ENOENT : + lur.ret_code = -LTTNG_UST_ERR_NOENT ; +break ; +case -EPERM : + lur.ret_code = -LTTNG_UST_ERR_PERM ; +break ; +case -ENOSYS : + lur.ret_code = -LTTNG_UST_ERR_NOSYS ; +break ; +default : + lur.ret_code = -LTTNG_UST_ERR ; +break ; + } + }else lur.ret_code = ret; }if (ret >=0 ) {Signature · 7 lines
1.7.10.4 _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 4 lines
Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com