From 5822049cf164e167125dd425cb302fe4d8d56814 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期五, 05 二月 2021 18:41:00 +0800
Subject: [PATCH] update
---
src/bus_error.cpp | 43 ++++++++++++++++++++++++++++++++-----------
1 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/src/bus_error.cpp b/src/bus_error.cpp
index c2dd63a..5752cfd 100644
--- a/src/bus_error.cpp
+++ b/src/bus_error.cpp
@@ -13,9 +13,14 @@
static char *_bus_errlist[_bus_nerr] = {
"\0",
- "timeout",
+ "Timed out",
"The other end is not inline",
- "Key already in use"
+ "Key already in use",
+ "Network fault",
+ "Send to self error",
+ "Receive from wrong end",
+ "Service stoped",
+ "Exceed resource limit"
};
@@ -43,7 +48,6 @@
{
int s;
char *buf;
-
/* Make first caller allocate key for thread-specific data */
s = pthread_once(&once, createKey);
@@ -64,14 +68,31 @@
err_exit(s, "pthread_setspecific");
}
- if (err < 0 || err >= _bus_nerr || _bus_errlist[err] == NULL)
- {
- snprintf(buf, MAX_ERROR_LEN, "Unknown error %d", err);
- }
- else
- {
- strncpy(buf, _bus_errlist[err], MAX_ERROR_LEN - 1);
- buf[MAX_ERROR_LEN - 1] = '\0'; /* Ensure null termination */
+
+ if(err < EBUS_BASE) {
+ // libc閿欒
+ if (err < 0 || err >= _sys_nerr || _sys_errlist[err] == NULL)
+ {
+ snprintf(buf, MAX_ERROR_LEN, "Unknown error %d", err);
+ }
+ else
+ {
+ strncpy(buf, _sys_errlist[err], MAX_ERROR_LEN - 1);
+ buf[MAX_ERROR_LEN - 1] = '\0'; /* Ensure null termination */
+ }
+ } else {
+ //鑷畾涔夐敊璇�
+ err -= EBUS_BASE;
+ if (err < 0 || err >= _bus_nerr || _bus_errlist[err] == NULL)
+ {
+ snprintf(buf, MAX_ERROR_LEN, "Unknown error %d", err);
+ }
+ else
+ {
+ strncpy(buf, _bus_errlist[err], MAX_ERROR_LEN - 1);
+ buf[MAX_ERROR_LEN - 1] = '\0'; /* Ensure null termination */
+ }
+
}
return buf;
--
Gitblit v1.8.0