Skip to content

Commit

Permalink
add fastdfsV5.05patch
Browse files Browse the repository at this point in the history
  • Loading branch information
liujie-666 committed Dec 11, 2024
1 parent 338460a commit 02a6f46
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 2 deletions.
5 changes: 3 additions & 2 deletions delron/fastdfs/5.05/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ ORGANIZATION?=calico
REPOSITORY?=fastdfs
TAG?=5.05

FASTDFS_SRC_URL=https://github.com/liujie-666/fastdfs.git
FASTDFS_SRC_URL=https://github.com/happyfish100/fastdfs.git
NGINX_SRC_URL=https://github.com/nginx/nginx.git
NGINX_MODULE_URL=https://github.com/happyfish100/fastdfs-nginx-module.git
LIBFAST_COMMON_SRC_URL=https://github.com/happyfish100/libfastcommon.git

FASTDFS_COMMIT=9a47139
NGINX_COMMIT=0ddad64
NGINX_MODULE_COMMIT=10d1729
LIBFAST_COMMON_COMMIT=906c9e8
Expand All @@ -21,7 +22,7 @@ default:image
image: $(foreach dir, $(SUBDIR), src/$(dir))
docker build -t $(IMAGE_NAME) .
src/fastdfs:
git clone $(FASTDFS_SRC_URL) $@
git clone $(FASTDFS_SRC_URL) $@ && cd $@ && git checkout ${FASTDFS_COMMIT} && git apply ../../fastdfsV5.05_patch.patch
src/nginx:
git clone $(NGINX_SRC_URL) $@ && cd $@ && git checkout ${NGINX_COMMITI}
src/nginx_module:
Expand Down
113 changes: 113 additions & 0 deletions delron/fastdfs/5.05/fastdfsV5.05_patch.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
diff --git a/common/linux_stack_trace.c b/common/linux_stack_trace.c
index 800e1a6..0bf381d 100644
--- a/common/linux_stack_trace.c
+++ b/common/linux_stack_trace.c
@@ -56,108 +56,5 @@ extern char g_exe_name[256];

void signal_stack_trace_print(int signum, siginfo_t *info, void *ptr)
{
- static const char *si_codes[3] = {"", "SEGV_MAPERR", "SEGV_ACCERR"};
-
- int i, f = 0;
- ucontext_t *ucontext;
- Dl_info dlinfo;
- void **bp = NULL;
- void *ip = NULL;
- char cmd[256];
- char buff[256];
- char output[8 * 1024];
- char *pCurrent;
-
- pCurrent = output;
- ucontext = (ucontext_t*)ptr;
- pCurrent += sprintf(pCurrent, "Segmentation Fault!\n");
- pCurrent += sprintf(pCurrent, "\tinfo.si_signo = %d\n", signum);
- pCurrent += sprintf(pCurrent, "\tinfo.si_errno = %d\n", info->si_errno);
- pCurrent += sprintf(pCurrent, "\tinfo.si_code = %d (%s)\n", \
- info->si_code, si_codes[info->si_code]);
- pCurrent += sprintf(pCurrent, "\tinfo.si_addr = %p\n", info->si_addr);
- for(i = 0; i < NGREG; i++)
- {
- pCurrent += sprintf(pCurrent, "\treg[%02d] = 0x"REGFORMAT"\n",
- i, ucontext->uc_mcontext.gregs[i]);
- }
-
-#ifndef SIGSEGV_NOSTACK
-#if defined(SIGSEGV_STACK_IA64) || defined(SIGSEGV_STACK_X86)
-#if defined(SIGSEGV_STACK_IA64)
- ip = (void*)ucontext->uc_mcontext.gregs[REG_RIP];
- bp = (void**)ucontext->uc_mcontext.gregs[REG_RBP];
-#elif defined(SIGSEGV_STACK_X86)
- ip = (void*)ucontext->uc_mcontext.gregs[REG_EIP];
- bp = (void**)ucontext->uc_mcontext.gregs[REG_EBP];
-#endif
-
- pCurrent += sprintf(pCurrent, "\tStack trace:\n");
- while(bp && ip)
- {
- const char *symname;
-#ifndef NO_CPP_DEMANGLE
- int status;
- char * tmp;
-#endif
-
- if(!dladdr(ip, &dlinfo))
- {
- break;
- }
-
- symname = dlinfo.dli_sname;
-
-#ifndef NO_CPP_DEMANGLE
- tmp = __cxa_demangle(symname, NULL, 0, &status);
-
- if (status == 0 && tmp)
- {
- symname = tmp;
- }
-#endif
-
- sprintf(cmd, "addr2line -e %s %p", g_exe_name, ip);
- if (getExecResult(cmd, buff, sizeof(buff)) != 0)
- {
- *buff = '0';
- }
-
- pCurrent += sprintf(pCurrent, "\t\t% 2d: %p <%s+%lu> (%s in %s)\n",
- ++f, ip, symname,
- (unsigned long)ip-(unsigned long)dlinfo.dli_saddr,
- trim_right(buff), dlinfo.dli_fname);
-
-
-#ifndef NO_CPP_DEMANGLE
- if (tmp)
- {
- free(tmp);
- }
-#endif
-
- if(dlinfo.dli_sname && !strcmp(dlinfo.dli_sname, "main"))
- {
- break;
- }
-
- ip = bp[1];
- bp = (void**)bp[0];
- }
-#else
- pCurrent += sprintf(pCurrent, "\tStack trace (non-dedicated):\n");
- sz = backtrace(bt, 20);
- strings = backtrace_symbols(bt, sz);
- for(i = 0; i < sz; ++i)
- {
- pCurrent += sprintf(pCurrent, "\t\t%s\n", strings[i]);
- }
-#endif
- pCurrent += sprintf(pCurrent, "\tEnd of stack trace.\n");
-#else
- pCurrent += sprintf(pCurrent, "\tNot printing stack strace.\n");
-#endif
-
- log_it_ex(&g_log_context, LOG_CRIT, output, pCurrent - output);
}

0 comments on commit 02a6f46

Please sign in to comment.