From 603d2ded05450918e5cd857a4379c4715a76ba43 Mon Sep 17 00:00:00 2001 From: piaip Date: Wed, 9 Jan 2008 16:11:05 +0000 Subject: - mmbsd: improve DEBUGSLEEP proctitle for debugging multiple versions - bbs: try to prevent mmap SEGV issue (caused by mv(1) truncating ?) - pmore: change back to MAP_SHARED, and try MAP_POPULATE git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3810 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/mbbsd.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'mbbsd/mbbsd.c') 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) -- cgit v1.2.3