summaryrefslogtreecommitdiffstats
path: root/mbbsd/mbbsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd/mbbsd.c')
-rw-r--r--mbbsd/mbbsd.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 7e6b52ab..23fa1e73 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -217,6 +217,10 @@ abort_bbs(int sig)
exit(0);
}
+#ifdef DEBUGSLEEP
+static unsigned int dbg_myrev = 0;
+#endif // DEBUGSLEEP
+
#ifdef GCC_NORETURN
static void abort_bbs_debug(int sig) GCC_NORETURN;
#endif
@@ -293,7 +297,8 @@ abort_bbs_debug(int sig)
#ifdef DEBUGSLEEP
#ifndef VALGRIND
- setproctitle("debug me!(%d)(%s,%d)", sig, cuser.userid, currstat);
+ setproctitle("debug me!(%d)(%s,%d)[%08u]", sig,
+ cuser.userid, currstat, dbg_myrev);
#endif
/* do this manually to prevent broken stuff */
/* will broken currutmp cause problems here? hope not... */
@@ -1506,6 +1511,24 @@ static int daemon_login(int argc, char *argv[], char *envp[]);
static int check_ban_and_load(int fd);
static int check_banip(char *host);
+#ifdef DEBUGSLEEP
+
+static void
+solve_symlink(const char *path)
+{
+ char buf[PATHLEN];
+ char *pdot = NULL;
+ if (readlink(path, buf, sizeof(buf)-1) < 1)
+ return;
+ buf[PATHLEN-1] = 0;
+ pdot = strrchr(buf, '.');
+ if (!pdot)
+ return;
+ dbg_myrev = (unsigned int)atoi(pdot+1);
+}
+
+#endif // DEBUGSLEEP
+
int
main(int argc, char *argv[], char *envp[])
{
@@ -1518,6 +1541,10 @@ main(int argc, char *argv[], char *envp[])
Signal(SIGUSR1, SIG_IGN);
Signal(SIGUSR2, SIG_IGN);
+#ifdef DEBUGSLEEP
+ solve_symlink(argv[0]);
+#endif // DEBUGSLEEP
+
#if defined(__GLIBC__) && defined(CRITICAL_MEMORY)
#define MY__MMAP_THRESHOLD (1024 * 8)
#define MY__MMAP_MAX (0)