fix libunwind coredump under arm os
This commit is contained in:
2
deps/3rd/oceanbase.el7.aarch64.deps
vendored
2
deps/3rd/oceanbase.el7.aarch64.deps
vendored
@ -7,7 +7,7 @@ repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/7/aarch64/
|
|||||||
devdeps-gtest-1.8.0-3.el7.aarch64.rpm
|
devdeps-gtest-1.8.0-3.el7.aarch64.rpm
|
||||||
devdeps-isa-l-static-2.22.0-3.el7.aarch64.rpm
|
devdeps-isa-l-static-2.22.0-3.el7.aarch64.rpm
|
||||||
devdeps-libcurl-static-7.29.0-3.el7.aarch64.rpm
|
devdeps-libcurl-static-7.29.0-3.el7.aarch64.rpm
|
||||||
devdeps-libunwind-static-1.5.0-3.el7.aarch64.rpm
|
devdeps-libunwind-static-1.6.2-11.el7.aarch64.rpm
|
||||||
devdeps-mariadb-connector-c-3.1.12-3.el7.aarch64.rpm
|
devdeps-mariadb-connector-c-3.1.12-3.el7.aarch64.rpm
|
||||||
devdeps-openssl-static-1.0.1e-3.el7.aarch64.rpm
|
devdeps-openssl-static-1.0.1e-3.el7.aarch64.rpm
|
||||||
devdeps-libaio-0.3.112-3.el7.aarch64.rpm
|
devdeps-libaio-0.3.112-3.el7.aarch64.rpm
|
||||||
|
|||||||
2
deps/3rd/oceanbase.el7.x86_64.deps
vendored
2
deps/3rd/oceanbase.el7.x86_64.deps
vendored
@ -7,7 +7,7 @@ repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/7/x86_64/
|
|||||||
devdeps-gtest-1.8.0-3.el7.x86_64.rpm
|
devdeps-gtest-1.8.0-3.el7.x86_64.rpm
|
||||||
devdeps-isa-l-static-2.22.0-3.el7.x86_64.rpm
|
devdeps-isa-l-static-2.22.0-3.el7.x86_64.rpm
|
||||||
devdeps-libcurl-static-7.29.0-3.el7.x86_64.rpm
|
devdeps-libcurl-static-7.29.0-3.el7.x86_64.rpm
|
||||||
devdeps-libunwind-static-1.5.0-3.el7.x86_64.rpm
|
devdeps-libunwind-static-1.6.2-11.el7.x86_64.rpm
|
||||||
devdeps-mariadb-connector-c-3.1.12-3.el7.x86_64.rpm
|
devdeps-mariadb-connector-c-3.1.12-3.el7.x86_64.rpm
|
||||||
devdeps-openssl-static-1.0.1e-3.el7.x86_64.rpm
|
devdeps-openssl-static-1.0.1e-3.el7.x86_64.rpm
|
||||||
devdeps-libaio-0.3.112-3.el7.x86_64.rpm
|
devdeps-libaio-0.3.112-3.el7.x86_64.rpm
|
||||||
|
|||||||
2
deps/3rd/oceanbase.el8.x86_64.deps
vendored
2
deps/3rd/oceanbase.el8.x86_64.deps
vendored
@ -7,7 +7,7 @@ repo=http://mirrors.aliyun.com/oceanbase/development-kit/el/8/x86_64/
|
|||||||
devdeps-gtest-1.8.0-3.el8.x86_64.rpm
|
devdeps-gtest-1.8.0-3.el8.x86_64.rpm
|
||||||
devdeps-isa-l-static-2.22.0-3.el8.x86_64.rpm
|
devdeps-isa-l-static-2.22.0-3.el8.x86_64.rpm
|
||||||
devdeps-libcurl-static-7.29.0-3.el8.x86_64.rpm
|
devdeps-libcurl-static-7.29.0-3.el8.x86_64.rpm
|
||||||
devdeps-libunwind-static-1.5.0-3.el8.x86_64.rpm
|
devdeps-libunwind-static-1.6.2-11.el8.x86_64.rpm
|
||||||
devdeps-mariadb-connector-c-3.1.12-3.el8.x86_64.rpm
|
devdeps-mariadb-connector-c-3.1.12-3.el8.x86_64.rpm
|
||||||
devdeps-openssl-static-1.0.1e-3.el8.x86_64.rpm
|
devdeps-openssl-static-1.0.1e-3.el8.x86_64.rpm
|
||||||
devdeps-libaio-0.3.112-3.el8.x86_64.rpm
|
devdeps-libaio-0.3.112-3.el8.x86_64.rpm
|
||||||
|
|||||||
3
deps/oblib/src/lib/CMakeLists.txt
vendored
3
deps/oblib/src/lib/CMakeLists.txt
vendored
@ -11,6 +11,8 @@ ob_lib_add_target(oblib_lib_charset
|
|||||||
charset/ob_ctype_utf8.c
|
charset/ob_ctype_utf8.c
|
||||||
charset/ob_dtoa.c
|
charset/ob_dtoa.c
|
||||||
hash/xxhash.c
|
hash/xxhash.c
|
||||||
|
signal/safe_snprintf.c
|
||||||
|
signal/ob_libunwind.c
|
||||||
)
|
)
|
||||||
disable_pch(oblib_lib_charset)
|
disable_pch(oblib_lib_charset)
|
||||||
|
|
||||||
@ -209,7 +211,6 @@ ob_set_subtarget(oblib_lib common
|
|||||||
word_segment/ob_word_segment.cpp
|
word_segment/ob_word_segment.cpp
|
||||||
encode/ob_base64_encode.cpp
|
encode/ob_base64_encode.cpp
|
||||||
signal/ob_memory_cutter.cpp
|
signal/ob_memory_cutter.cpp
|
||||||
signal/safe_snprintf.cpp
|
|
||||||
signal/ob_signal_struct.cpp
|
signal/ob_signal_struct.cpp
|
||||||
signal/ob_signal_utils.cpp
|
signal/ob_signal_utils.cpp
|
||||||
signal/ob_signal_handlers.cpp
|
signal/ob_signal_handlers.cpp
|
||||||
|
|||||||
107
deps/oblib/src/lib/signal/ob_libunwind.c
vendored
Normal file
107
deps/oblib/src/lib/signal/ob_libunwind.c
vendored
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2021 OceanBase
|
||||||
|
* OceanBase CE is licensed under Mulan PubL v2.
|
||||||
|
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||||
|
* You may obtain a copy of Mulan PubL v2 at:
|
||||||
|
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||||
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the Mulan PubL v2 for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "lib/signal/ob_libunwind.h"
|
||||||
|
#include "lib/signal/safe_snprintf.h"
|
||||||
|
#define UNW_LOCAL_ONLY
|
||||||
|
#include <libunwind.h>
|
||||||
|
|
||||||
|
static const int MAX_BT_ADDRESS_CNT = 100;
|
||||||
|
static int safe_backtrace_(unw_context_t *context, char *buf, int64_t len, int64_t *pos);
|
||||||
|
static ssize_t get_stack_trace_inplace(
|
||||||
|
unw_context_t *context, unw_cursor_t *cursor, uintptr_t *addresses, size_t max_addresses);
|
||||||
|
static int8_t get_frame_info(unw_cursor_t *cursor, uintptr_t *ip);
|
||||||
|
|
||||||
|
int safe_backtrace(char *buf, int64_t len, int64_t *pos)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
unw_context_t context;
|
||||||
|
if (unw_getcontext(&context) < 0) {
|
||||||
|
ret = -1;
|
||||||
|
} else {
|
||||||
|
ret = safe_backtrace_(&context, buf, len, pos);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int safe_backtrace_(unw_context_t *context, char *buf, int64_t len, int64_t *pos)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
unw_cursor_t cursor;
|
||||||
|
uintptr_t addrs[MAX_BT_ADDRESS_CNT];
|
||||||
|
int n = get_stack_trace_inplace(context, &cursor, addrs, sizeof(addrs) / sizeof(addrs[0]));
|
||||||
|
*pos = 0;
|
||||||
|
if (n < 0) {
|
||||||
|
ret = -1;
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
int count = safe_snprintf(buf + *pos, len - *pos, "0x%lx", addrs[i]);
|
||||||
|
count++; // for space
|
||||||
|
if (count > 0 && *pos + count < len) {
|
||||||
|
*pos += count;
|
||||||
|
buf[*pos - 1] = ' ';
|
||||||
|
} else {
|
||||||
|
// buf not enough
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--*pos;
|
||||||
|
}
|
||||||
|
buf[*pos] = '\0';
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssize_t get_stack_trace_inplace(
|
||||||
|
unw_context_t *context, unw_cursor_t *cursor, uintptr_t *addresses, size_t max_addresses)
|
||||||
|
{
|
||||||
|
if (max_addresses == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (unw_init_local(cursor, context) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!get_frame_info(cursor, addresses)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
++addresses;
|
||||||
|
size_t count = 1;
|
||||||
|
for (; count != max_addresses; ++count, ++addresses) {
|
||||||
|
int r = unw_step(cursor);
|
||||||
|
if (r < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (r == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!get_frame_info(cursor, addresses)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
int8_t get_frame_info(unw_cursor_t *cursor, uintptr_t *ip)
|
||||||
|
{
|
||||||
|
unw_word_t uip;
|
||||||
|
if (unw_get_reg(cursor, UNW_REG_IP, &uip) < 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int r = unw_is_signal_frame(cursor);
|
||||||
|
if (r < 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// Use previous instruction in normal (call) frames (because the
|
||||||
|
// return address might not be in the same function for noreturn functions)
|
||||||
|
// but not in signal frames.
|
||||||
|
*ip = uip - (r == 0);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
23
deps/oblib/src/lib/signal/ob_libunwind.h
vendored
Normal file
23
deps/oblib/src/lib/signal/ob_libunwind.h
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2021 OceanBase
|
||||||
|
* OceanBase CE is licensed under Mulan PubL v2.
|
||||||
|
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||||
|
* You may obtain a copy of Mulan PubL v2 at:
|
||||||
|
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||||
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the Mulan PubL v2 for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OCEANBASE_LIBUNWIND_BT_H_
|
||||||
|
#define OCEANBASE_LIBUNWIND_BT_H_
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include "lib/utility/ob_macro_utils.h"
|
||||||
|
|
||||||
|
EXTERN_C_BEGIN
|
||||||
|
extern int safe_backtrace(char *buf, int64_t len, int64_t *pos);
|
||||||
|
EXTERN_C_END
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -16,6 +16,7 @@
|
|||||||
#include <sys/prctl.h>
|
#include <sys/prctl.h>
|
||||||
#include "lib/profile/ob_trace_id.h"
|
#include "lib/profile/ob_trace_id.h"
|
||||||
#include "lib/utility/utility.h"
|
#include "lib/utility/utility.h"
|
||||||
|
#include "lib/signal/ob_libunwind.h"
|
||||||
#include "lib/signal/ob_signal_struct.h"
|
#include "lib/signal/ob_signal_struct.h"
|
||||||
#include "lib/signal/ob_signal_utils.h"
|
#include "lib/signal/ob_signal_utils.h"
|
||||||
#include "lib/signal/ob_memory_cutter.h"
|
#include "lib/signal/ob_memory_cutter.h"
|
||||||
@ -80,7 +81,7 @@ void coredump_cb(int sig, siginfo_t* si)
|
|||||||
// backtrace
|
// backtrace
|
||||||
char bt[256];
|
char bt[256];
|
||||||
int64_t len = 0;
|
int64_t len = 0;
|
||||||
safe_backtrace(bt, sizeof(bt) - 1, len);
|
safe_backtrace(bt, sizeof(bt) - 1, &len);
|
||||||
bt[len++] = '\0';
|
bt[len++] = '\0';
|
||||||
// trace_id
|
// trace_id
|
||||||
const uint64_t* trace_id = ObCurTraceId::get();
|
const uint64_t* trace_id = ObCurTraceId::get();
|
||||||
|
|||||||
@ -50,12 +50,10 @@ int ObSigBTOnlyProcessor::prepare()
|
|||||||
int64_t tid = syscall(SYS_gettid);
|
int64_t tid = syscall(SYS_gettid);
|
||||||
char tname[16];
|
char tname[16];
|
||||||
prctl(PR_GET_NAME, tname);
|
prctl(PR_GET_NAME, tname);
|
||||||
unw_context_t uctx;
|
|
||||||
unw_getcontext(&uctx);
|
|
||||||
int64_t count = 0;
|
int64_t count = 0;
|
||||||
count = safe_snprintf(buf_ + pos_, len - pos_, "tid: %ld, tname: %s, lbt: ", tid, tname);
|
count = safe_snprintf(buf_ + pos_, len - pos_, "tid: %ld, tname: %s, lbt: ", tid, tname);
|
||||||
pos_ += count;
|
pos_ += count;
|
||||||
safe_backtrace(uctx, buf_ + pos_, len - pos_, count);
|
safe_backtrace(buf_ + pos_, len - pos_, &count);
|
||||||
pos_ += count;
|
pos_ += count;
|
||||||
buf_[pos_++] = '\n';
|
buf_[pos_++] = '\n';
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
89
deps/oblib/src/lib/signal/ob_signal_utils.cpp
vendored
89
deps/oblib/src/lib/signal/ob_signal_utils.cpp
vendored
@ -18,6 +18,7 @@
|
|||||||
#include "lib/ob_errno.h"
|
#include "lib/ob_errno.h"
|
||||||
#include "lib/utility/ob_macro_utils.h"
|
#include "lib/utility/ob_macro_utils.h"
|
||||||
#include "lib/charset/ob_mysql_global.h"
|
#include "lib/charset/ob_mysql_global.h"
|
||||||
|
#include "lib/signal/ob_libunwind.h"
|
||||||
|
|
||||||
namespace oceanbase {
|
namespace oceanbase {
|
||||||
namespace common {
|
namespace common {
|
||||||
@ -33,94 +34,6 @@ void safe_sleep_micros(int64_t usec)
|
|||||||
nanosleep(&ts, nullptr);
|
nanosleep(&ts, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_frame_info(unw_cursor_t* cursor, uintptr_t& ip)
|
|
||||||
{
|
|
||||||
unw_word_t uip;
|
|
||||||
if (unw_get_reg(cursor, UNW_REG_IP, &uip) < 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
int r = unw_is_signal_frame(cursor);
|
|
||||||
if (r < 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Use previous instruction in normal (call) frames (because the
|
|
||||||
// return address might not be in the same function for noreturn functions)
|
|
||||||
// but not in signal frames.
|
|
||||||
ip = uip - (r == 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* From facebook-folly */
|
|
||||||
ssize_t get_stack_trace_inplace(
|
|
||||||
unw_context_t& context, unw_cursor_t& cursor, uintptr_t* addresses, size_t max_addresses)
|
|
||||||
{
|
|
||||||
if (max_addresses == 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (unw_init_local(&cursor, &context) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (!get_frame_info(&cursor, *addresses)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
++addresses;
|
|
||||||
size_t count = 1;
|
|
||||||
for (; count != max_addresses; ++count, ++addresses) {
|
|
||||||
int r = unw_step(&cursor);
|
|
||||||
if (r < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (r == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!get_frame_info(&cursor, *addresses)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
int safe_backtrace(char* buf, int64_t len, int64_t& pos)
|
|
||||||
{
|
|
||||||
int ret = OB_SUCCESS;
|
|
||||||
unw_context_t context;
|
|
||||||
if (unw_getcontext(&context) < 0) {
|
|
||||||
ret = OB_ERROR;
|
|
||||||
} else {
|
|
||||||
ret = safe_backtrace(context, buf, len, pos);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const int MAX_BT_ADDRESS_CNT = 100;
|
|
||||||
|
|
||||||
int safe_backtrace(unw_context_t& context, char* buf, int64_t len, int64_t& pos)
|
|
||||||
{
|
|
||||||
int ret = OB_SUCCESS;
|
|
||||||
unw_cursor_t cursor;
|
|
||||||
uintptr_t addrs[MAX_BT_ADDRESS_CNT];
|
|
||||||
int n = get_stack_trace_inplace(context, cursor, addrs, ARRAYSIZEOF(addrs));
|
|
||||||
pos = 0;
|
|
||||||
if (n < 0) {
|
|
||||||
ret = OB_ERROR;
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < n; i++) {
|
|
||||||
int count = safe_snprintf(buf + pos, len - pos, "0x%lx", addrs[i]);
|
|
||||||
count++; // for space
|
|
||||||
if (count > 0 && pos + count < len) {
|
|
||||||
pos += count;
|
|
||||||
buf[pos - 1] = ' ';
|
|
||||||
} else {
|
|
||||||
// buf not enough
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pos--;
|
|
||||||
}
|
|
||||||
buf[pos] = '\0';
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
__thread ObJumpBuf* g_jmp = nullptr;
|
__thread ObJumpBuf* g_jmp = nullptr;
|
||||||
|
|
||||||
void crash_restore_handler(int sig, siginfo_t* s, void* p)
|
void crash_restore_handler(int sig, siginfo_t* s, void* p)
|
||||||
|
|||||||
4
deps/oblib/src/lib/signal/ob_signal_utils.h
vendored
4
deps/oblib/src/lib/signal/ob_signal_utils.h
vendored
@ -21,8 +21,6 @@
|
|||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#define UNW_LOCAL_ONLY
|
|
||||||
#include <libunwind.h>
|
|
||||||
#include "lib/signal/ob_signal_struct.h"
|
#include "lib/signal/ob_signal_struct.h"
|
||||||
#include "lib/signal/safe_snprintf.h"
|
#include "lib/signal/safe_snprintf.h"
|
||||||
#include "lib/utility/ob_macro_utils.h"
|
#include "lib/utility/ob_macro_utils.h"
|
||||||
@ -33,8 +31,6 @@
|
|||||||
namespace oceanbase {
|
namespace oceanbase {
|
||||||
namespace common {
|
namespace common {
|
||||||
void safe_sleep_micros(int64_t usec);
|
void safe_sleep_micros(int64_t usec);
|
||||||
int safe_backtrace(unw_context_t& context, char* buf, int64_t len, int64_t& pos);
|
|
||||||
int safe_backtrace(char* buf, int64_t len, int64_t& pos);
|
|
||||||
|
|
||||||
struct DLogLevel {
|
struct DLogLevel {
|
||||||
enum DLogLevelEnum { DEBUG, INFO, WARN, ERROR };
|
enum DLogLevelEnum { DEBUG, INFO, WARN, ERROR };
|
||||||
|
|||||||
@ -1,35 +1,16 @@
|
|||||||
/*
|
/**
|
||||||
* twemcache - Twitter memcached.
|
* Copyright (c) 2021 OceanBase
|
||||||
* Copyright (c) 2012, Twitter, Inc.
|
* OceanBase CE is licensed under Mulan PubL v2.
|
||||||
* All rights reserved.
|
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||||
*
|
* You may obtain a copy of Mulan PubL v2 at:
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||||
* modification, are permitted provided that the following conditions
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
* are met:
|
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
* * Redistributions of source code must retain the above copyright
|
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* See the Mulan PubL v2 for more details.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of the Twitter nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "lib/signal/safe_snprintf.h"
|
#include "lib/signal/safe_snprintf.h"
|
||||||
namespace oceanbase {
|
|
||||||
namespace common {
|
|
||||||
static const char HEX[] = "0123456789abcdef";
|
static const char HEX[] = "0123456789abcdef";
|
||||||
|
|
||||||
static char* safe_utoa(int _base, uint64_t val, char* buf)
|
static char* safe_utoa(int _base, uint64_t val, char* buf)
|
||||||
@ -129,14 +110,14 @@ static char* safe_itoa(int base, int64_t val, char* buf)
|
|||||||
|
|
||||||
static const char* safe_check_longlong(const char* fmt, int32_t* have_longlong)
|
static const char* safe_check_longlong(const char* fmt, int32_t* have_longlong)
|
||||||
{
|
{
|
||||||
*have_longlong = false;
|
*have_longlong = 0;
|
||||||
if (*fmt == 'l') {
|
if (*fmt == 'l') {
|
||||||
fmt++;
|
fmt++;
|
||||||
if (*fmt != 'l') {
|
if (*fmt != 'l') {
|
||||||
*have_longlong = (sizeof(long) == sizeof(int64_t));
|
*have_longlong = (sizeof(long) == sizeof(int64_t));
|
||||||
} else {
|
} else {
|
||||||
fmt++;
|
fmt++;
|
||||||
*have_longlong = true;
|
*have_longlong = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fmt;
|
return fmt;
|
||||||
@ -147,7 +128,7 @@ int _safe_vsnprintf(char* to, size_t size, const char* format, va_list ap)
|
|||||||
char* start = to;
|
char* start = to;
|
||||||
char* end = start + size - 1;
|
char* end = start + size - 1;
|
||||||
for (; *format; ++format) {
|
for (; *format; ++format) {
|
||||||
int32_t have_longlong = false;
|
int32_t have_longlong = 0;
|
||||||
if (*format != '%') {
|
if (*format != '%') {
|
||||||
if (to == end) { /* end of buffer */
|
if (to == end) { /* end of buffer */
|
||||||
break;
|
break;
|
||||||
@ -228,5 +209,3 @@ int _safe_snprintf(char* to, size_t n, const char* fmt, ...)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} // namespace common
|
|
||||||
} // namespace oceanbase
|
|
||||||
10
deps/oblib/src/lib/signal/safe_snprintf.h
vendored
10
deps/oblib/src/lib/signal/safe_snprintf.h
vendored
@ -17,11 +17,11 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
namespace oceanbase {
|
|
||||||
namespace common {
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include "lib/utility/ob_macro_utils.h"
|
||||||
|
|
||||||
|
EXTERN_C_BEGIN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A (very) limited version of snprintf.
|
A (very) limited version of snprintf.
|
||||||
@ -41,6 +41,6 @@ int _safe_snprintf(char* to, size_t n, const char* fmt, ...);
|
|||||||
|
|
||||||
#define safe_vsnprintf(_s, _n, _f, _a) _safe_vsnprintf((char*)(_s), (size_t)(_n), _f, _a)
|
#define safe_vsnprintf(_s, _n, _f, _a) _safe_vsnprintf((char*)(_s), (size_t)(_n), _f, _a)
|
||||||
|
|
||||||
} // namespace common
|
EXTERN_C_END
|
||||||
} // namespace oceanbase
|
|
||||||
#endif // OCEANBASE_SAFE_SNPRINTF_H_
|
#endif // OCEANBASE_SAFE_SNPRINTF_H_
|
||||||
|
|||||||
141
rpm/oceanbase.deps
Normal file
141
rpm/oceanbase.deps
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
[target]
|
||||||
|
os=7
|
||||||
|
arch=aarch64
|
||||||
|
[deps]
|
||||||
|
ob-lua-5.4.3-20210419222527.alios7.aarch64.rpm=current
|
||||||
|
ob-ncurses-6.2-20200624000532.alios7.aarch64.rpm=test
|
||||||
|
ob-elfutils-0.181-20201030224029.alios7.aarch64.rpm
|
||||||
|
keyutils-libs-devel-1.5.8-3.3.alios7.aarch64
|
||||||
|
libcom_err-devel-1.42.9-7.2.alios7.aarch64
|
||||||
|
libselinux-devel-2.2.2-6.3.alios7.aarch64
|
||||||
|
libsepol-devel-2.1.9-3.3.alios7.aarch64
|
||||||
|
libverto-devel-0.2.5-4.3.alios7.aarch64
|
||||||
|
pcre-devel-8.32-15.2.alios7.aarch64
|
||||||
|
krb5-devel-1.13.2-10.2.alios7.aarch64
|
||||||
|
babassl-ob-8.1.3-1900607.alios7.aarch64.rpm=test
|
||||||
|
libcurl-devel-7.29.0-25.2.alios7.aarch64.rpm
|
||||||
|
libcurl-7.29.0-25.2.alios7.aarch64.rpm
|
||||||
|
openldap-devel-2.4.40-8.2.alios7.aarch64.rpm
|
||||||
|
openldap-2.4.40-8.2.alios7.aarch64.rpm
|
||||||
|
libaio-devel-0.3.109-13.2.alios7.aarch64.rpm
|
||||||
|
t-ant-light-drcmessage-for-bt-1.0.0-20210712071538.alios7.aarch64.rpm=test
|
||||||
|
ob-rocksdb-6.22.1-20210805175734.alios7.aarch64.rpm
|
||||||
|
obclient-1.2.3-20210701163349.el7.alios7.aarch64.rpm
|
||||||
|
ob-apr-1.6.5-20200217230442.alios7.aarch64.rpm=test
|
||||||
|
ob-mxml-2.12.0-20200219103712.alios7.aarch64.rpm=test
|
||||||
|
ob-oss-c-sdk-3.9.2-20200729160751.alios7.aarch64.rpm=test
|
||||||
|
gcc52-5.2.0-1.alios7.aarch64.rpm
|
||||||
|
expat-2.1.0-8.3.alios7.aarch64.rpm
|
||||||
|
expat-devel-2.1.0-8.3.alios7.aarch64.rpm
|
||||||
|
ali-dds-aliws-1.4.0.2-1862830.alios7.aarch64.rpm=test
|
||||||
|
t-midware-vipserver-c-client-arm-1.0.14.3-20191125213454.alios7.aarch64.rpm
|
||||||
|
ob-boost-1.53.0-20200218205728.alios7.aarch64.rpm=test
|
||||||
|
zlib-devel-1.2.7-15.2.alios7.aarch64.rpm
|
||||||
|
zlib-1.2.7-15.2.alios7.aarch64.rpm
|
||||||
|
ob-rapidjson-1.1.0-20211015163659.alios7.aarch64.rpm
|
||||||
|
#second level requires analysis:
|
||||||
|
binutils-2.27-9.base.alios7.aarch64.rpm
|
||||||
|
binutils-devel-2.27-9.base.alios7.aarch64.rpm
|
||||||
|
isal-2.22.0-20200623101955.alios7.aarch64.rpm=test
|
||||||
|
ob-llvm2-6.0.1-20200220185349.alios7.aarch64.rpm=test
|
||||||
|
obs-libunwind-1.0.3-20220121155402.alios7.aarch64.rpm=test
|
||||||
|
# compatible with el6
|
||||||
|
ob-cmake3-3.22.1-20211230145243.alios7.aarch64=test
|
||||||
|
ob-clang11-11.1.0-20220110114534.alios7.aarch64=test
|
||||||
|
ob-lld11-11.0.0-20210106153627.alios7.aarch64.rpm
|
||||||
|
ob-gtest-1.8.2-20200214192053.alios7.aarch64.rpm=test
|
||||||
|
# ofs
|
||||||
|
ob-ofs-devel-1.1.0-20210812171031.el7.aarch64.rpm=current
|
||||||
|
ob-libevent-2.1.10-20200303195414.alios7.aarch64.rpm=test
|
||||||
|
ob-jemalloc-5.2.1-20201013165401.alios7.aarch64.rpm=test
|
||||||
|
|
||||||
|
|
||||||
|
[target]
|
||||||
|
os=7
|
||||||
|
arch=x86_64
|
||||||
|
[deps]
|
||||||
|
ob-lua-5.4.3-20210419222527.alios7.x86_64.rpm=current
|
||||||
|
ob-ncurses-6.2-20200624000532.alios7.x86_64.rpm=test
|
||||||
|
ob-elfutils-0.181-20201030224029.alios7.x86_64.rpm
|
||||||
|
keyutils-libs-devel-1.5.8-3.1.alios7.x86_64
|
||||||
|
libcom_err-devel-1.42.9-7.1.alios7.x86_64
|
||||||
|
libselinux-devel-2.2.2-6.1.alios7.x86_64
|
||||||
|
libsepol-devel-2.1.9-3.1.alios7.x86_64
|
||||||
|
libverto-devel-0.2.5-4.1.alios7.x86_64
|
||||||
|
pcre-devel-8.32-15.1.alios7.x86_64
|
||||||
|
krb5-devel-1.13.2-10.1.alios7.x86_64
|
||||||
|
babassl-ob-8.1.3-1900407.alios7.x86_64.rpm=test
|
||||||
|
libcurl-devel-7.29.0-25.1.alios7.x86_64.rpm
|
||||||
|
libcurl-7.29.0-25.1.alios7.x86_64.rpm
|
||||||
|
openldap-devel-2.4.40-8.1.alios7.x86_64.rpm
|
||||||
|
openldap-2.4.40-8.1.alios7.x86_64.rpm
|
||||||
|
libaio-devel-0.3.109-13.1.alios7.x86_64.rpm
|
||||||
|
t-ant-light-drcmessage-for-bt-1.0.0-20210712071538.alios7.x86_64.rpm=test
|
||||||
|
ob-rocksdb-6.22.1-20210805175734.alios7.x86_64.rpm
|
||||||
|
obclient-1.2.3-20210701163349.el7.alios7.x86_64.rpm
|
||||||
|
ob-apr-1.6.5-20200217230442.alios7.x86_64.rpm=test
|
||||||
|
ob-mxml-2.12.0-20200219103712.alios7.x86_64.rpm=test
|
||||||
|
ob-oss-c-sdk-3.9.2-20200729160751.alios7.x86_64.rpm=test
|
||||||
|
gcc52-5.2.0-445134.el7.x86_64.rpm=current
|
||||||
|
expat-2.1.0-8.1.alios7.x86_64.rpm
|
||||||
|
expat-devel-2.1.0-8.1.alios7.x86_64.rpm
|
||||||
|
ali-dds-aliws-1.4.0.1-638651.el7.x86_64
|
||||||
|
t-midware-vipserver-cpp-client-1.0.14.6-20210304162233.alios7.x86_64
|
||||||
|
ob-boost-1.53.0-20210225114205.alios7.x86_64.rpm=test
|
||||||
|
zlib-devel-1.2.7-16.2.alios7.x86_64.rpm
|
||||||
|
zlib-1.2.7-16.2.alios7.x86_64.rpm
|
||||||
|
ob-rapidjson-1.1.0-20211015163659.alios7.x86_64.rpm
|
||||||
|
#second level requires analysis:
|
||||||
|
binutils-2.30-20180325160334.alios7.x86_64
|
||||||
|
ob-binutils-devel2-2.29.1-20200218233710.alios7.x86_64.rpm=test
|
||||||
|
isal-2.22.0-20200623101955.alios7.x86_64.rpm=test
|
||||||
|
ob-llvm-6.0.1-5.x86_64.rpm=test
|
||||||
|
obs-libunwind-1.0.3-20220121155402.alios7.x86_64.rpm=test
|
||||||
|
# compatible with el6
|
||||||
|
ob-cmake3-3.22.1-20211230145243.alios7.x86_64.rpm=test
|
||||||
|
ob-clang11-11.1.0-20220110114534.alios7.x86_64.rpm=test
|
||||||
|
ob-lld11-11.0.0-20210106153627.alios7.x86_64.rpm
|
||||||
|
ob-gtest-1.8.0-1.x86_64
|
||||||
|
# ofs
|
||||||
|
ob-ofs-devel-1.1.0-20210812171031.el7.x86_64.rpm=current
|
||||||
|
ob-libevent-2.1.10-20190605211727.alios7.x86_64.rpm=test
|
||||||
|
ob-jemalloc-5.2.1-20201013165401.alios7.x86_64.rpm=test
|
||||||
|
|
||||||
|
[target]
|
||||||
|
os=6
|
||||||
|
arch=x86_64
|
||||||
|
[deps]
|
||||||
|
ob-lua-5.4.3-20210419222527.alios6.x86_64.rpm=current
|
||||||
|
ob-ncurses-6.2-20200624000532.alios6.x86_64.rpm=test
|
||||||
|
libaio-devel-0.3.107-10.1.alios6.x86_64
|
||||||
|
babassl-ob-8.1.3-1900407.alios6.x86_64.rpm=test
|
||||||
|
isal-2.22.0-20200623101955.alios6.x86_64.rpm=test
|
||||||
|
t-ant-light-drcmessage-for-bt-1.0.0-20210611161024.alios6.x86_64.rpm=test
|
||||||
|
ob-rocksdb-6.22.1-20210805175734.alios6.x86_64.rpm
|
||||||
|
curl-7.29.0-1.el6.x86_64
|
||||||
|
obclient-1.2.3-20210701163349.el6.alios6.x86_64.rpm
|
||||||
|
ob-apr-1.6.5-20200217230442.alios6.x86_64.rpm=test
|
||||||
|
ob-mxml-2.12.0-20200219103712.alios6.x86_64.rpm=test
|
||||||
|
ob-oss-c-sdk-3.9.2-20200729160751.alios6.x86_64.rpm=test
|
||||||
|
gcc52-5.2.0-224921.alios6.x86_64.rpm=current
|
||||||
|
expat-2.0.1-9.1.1.alios6.x86_64
|
||||||
|
expat-devel-2.0.1-9.1.1.alios6.x86_64
|
||||||
|
ali-dds-aliws-1.4.0.0-563776.alios6.x86_64
|
||||||
|
binutils-2.29.1-20180327141620.alios6.x86_64
|
||||||
|
ob-binutils-devel2-2.29.1-20200218233710.alios6.x86_64.rpm=test
|
||||||
|
obs-libunwind-1.0.3-20220121155402.alios6.x86_64.rpm=test
|
||||||
|
ob-rapidjson-1.1.0-20211015163659.alios6.x86_64.rpm
|
||||||
|
# follows used by jit
|
||||||
|
ob-llvm-6.0.1-3.el6.x86_64
|
||||||
|
ob-cmake3-3.22.1-20211230145243.alios6.x86_64=test
|
||||||
|
ob-clang11-11.1.0-20220110114534.alios6.x86_64.rpm=test
|
||||||
|
ob-lld-7.1.0-2.el6.x86_64
|
||||||
|
ob-gtest-1.8.1-2.el6.x86_64
|
||||||
|
# ofs
|
||||||
|
ob-ofs-devel-1.1.0-20210812171031.el6.x86_64.rpm=current
|
||||||
|
ob-libevent-2.1.10-20190605211727.alios6.x86_64.rpm=test
|
||||||
|
ob-jemalloc-5.2.1-20201013165401.alios6.x86_64.rpm=test
|
||||||
|
|
||||||
|
t-midware-vipserver-cpp-client-1.0.14.6-20210304162233.alios6.x86_64
|
||||||
|
ob-boost-1.53.0-20210225114205.alios6.x86_64.rpm=test
|
||||||
|
#second level requires analysis:
|
||||||
Reference in New Issue
Block a user