util: add CloseLog routine to close the server log
[openafs.git] / src / util / afsutil.h
index 6a06510..90c20fc 100644 (file)
@@ -50,45 +50,13 @@ extern void FSLog(const char *format, ...)
 
 #define ViceLog(level, str)  do { if ((level) <= LogLevel) (FSLog str); } while (0)
 #define vViceLog(level, str) do { if ((level) <= LogLevel) (vFSLog str); } while (0)
+#define ViceLogThenPanic(level, str) \
+    do { ViceLog(level, str); osi_Panic str; } while(0);
 
 extern int OpenLog(const char *filename);
 extern int ReOpenLog(const char *fileName);
 extern void SetupLogSignals(void);
-
-/* special version of ctime that clobbers a *different static variable, so
- * that ViceLog can call ctime and not cause buffer confusion.
- */
-extern char *vctime(const time_t * atime);
-
-/* Need a thead safe ctime for pthread builds. Use std ctime for LWP */
-#if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
-#if defined(AFS_SUN5_ENV) && !defined(_POSIX_PTHREAD_SEMANTICS) && (_POSIX_C_SOURCE - 0 < 199506L)
-#define afs_ctime(C, B, L) ctime_r(C, B, L)
-#else
-/* Cast is for platforms which do not prototype ctime_r */
-#define afs_ctime(C, B, L) (char*)ctime_r(C, B)
-#endif /* AFS_SUN5_ENV */
-#else /* AFS_PTHREAD_ENV && !AFS_NT40_ENV */
-static_inline char *
-afs_ctime(const time_t *C, char *B, size_t S) {
-#if !defined(AFS_NT40_ENV) || (_MSC_VER < 1400)
-    strncpy(B, ctime(C), (S-1));
-    B[S-1] = '\0';
-#else
-    ctime_s(B, S, C);
-#endif
-    return B;
-}
-#endif /* AFS_PTHREAD_ENV && !AFS_NT40_ENV */
-
-
-/* abort the current process. */
-#ifdef AFS_NT40_ENV
-#define afs_abort() afs_NTAbort()
-#else
-#define afs_abort() abort()
-#endif
-
+extern void CloseLog(void);
 
 #ifdef AFS_NT40_ENV
 #ifndef _MFC_VER
@@ -99,18 +67,9 @@ afs_ctime(const time_t *C, char *B, size_t S) {
      extern int afs_winsockInit(void);
      extern void afs_winsockCleanup(void);
 
-     struct timezone {
-        int tz_minuteswest;    /* of Greenwich */
-        int tz_dsttime;        /* type of dst correction to apply */
-     };
-#define gettimeofday afs_gettimeofday
-     int afs_gettimeofday(struct timeval *tv, struct timezone *tz);
-
 /* Unbuffer output when Un*x would do line buffering. */
 #define setlinebuf(S) setvbuf(S, NULL, _IONBF, 0)
 
-/* Abort on error, possibly trapping to debugger or dumping a trace. */
-     void afs_NTAbort(void);
 #endif /* AFS_NT40_ENV */
 
 #ifndef HAVE_POSIX_REGEX