bozo-save-old-cores-by-date-option-20010212
authorHartmut Reuter <reuter@rzg.mpg.de>
Mon, 12 Feb 2001 16:25:17 +0000 (16:25 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 12 Feb 2001 16:25:17 +0000 (16:25 +0000)
compile-time option to save old cores by date instead of rotating

src/bozo/bnode.c

index 8e16863..7f71b38 100644 (file)
@@ -19,6 +19,9 @@
 #include <sys/file.h>
 #include <sys/time.h>
 #endif
+#ifdef BOZO_SAVE_CORES
+#include <time.h>
+#endif
 #include <sys/stat.h>
 #include <afs/procmgmt.h>  /* signal(), kill(), wait(), etc. */
 #include <lwp.h>
@@ -85,11 +88,25 @@ register struct bnode *abnode; {
     char tbuffer[256];
     struct stat tstat;
     register afs_int32 code;
+#ifdef BOZO_SAVE_CORES
+    struct timeval  Start;
+    struct tm *TimeFields;
+    char FileName[256];
+#endif
 
     code = stat(AFSDIR_SERVER_CORELOG_FILEPATH, &tstat);
     if (code) return;
     
     bnode_CoreName(abnode, aproc->coreName, tbuffer);
+#ifdef BOZO_SAVE_CORES
+    TM_GetTimeOfDay(&Start, 0);
+    TimeFields = localtime(&Start.tv_sec);
+    sprintf(FileName,"%s.%d%02d%02d%02d%02d%02d", tbuffer,
+            TimeFields->tm_year, TimeFields->tm_mon + 1,
+            TimeFields->tm_mday, TimeFields->tm_hour, TimeFields->tm_min,
+            TimeFields->tm_sec);
+    strcpy(tbuffer,FileName);
+#endif
     code = renamefile(AFSDIR_SERVER_CORELOG_FILEPATH, tbuffer);
 }