svn commit: samba r13770 - in branches/SAMBA_4_0/source/lib/util: .
metze at samba.org
metze at samba.org
Wed Mar 1 15:02:07 GMT 2006
Author: metze
Date: 2006-03-01 15:02:07 +0000 (Wed, 01 Mar 2006)
New Revision: 13770
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13770
Log:
- do fsync() on the debug fd, as we do in samba3,
I have an report that smbd memory usage grows to 1,5 GB or more
without this...
- make log_timestamp static
metze
Modified:
branches/SAMBA_4_0/source/lib/util/debug.c
branches/SAMBA_4_0/source/lib/util/debug.h
Changeset:
Modified: branches/SAMBA_4_0/source/lib/util/debug.c
===================================================================
--- branches/SAMBA_4_0/source/lib/util/debug.c 2006-03-01 13:20:32 UTC (rev 13769)
+++ branches/SAMBA_4_0/source/lib/util/debug.c 2006-03-01 15:02:07 UTC (rev 13770)
@@ -46,6 +46,24 @@
const char *prog_name;
} state;
+static void log_timestring(int level, const char *location, const char *func)
+{
+ char *t = NULL;
+ char *s = NULL;
+
+ if (state.logtype != DEBUG_FILE) return;
+
+ t = timestring(NULL, time(NULL));
+ if (!t) return;
+
+ asprintf(&s, "[%s, %d %s:%s()]\n", t, level, location, func);
+ talloc_free(t);
+ if (!s) return;
+
+ write(state.fd, s, strlen(s));
+ free(s);
+}
+
/*
the backend for debug messages. Note that the DEBUG() macro has already
ensured that the log level has been met before this is called
@@ -60,7 +78,7 @@
the backend for debug messages. Note that the DEBUG() macro has already
ensured that the log level has been met before this is called
*/
-void do_debug(const char *format, ...)
+void do_debug(const char *format, ...) _PRINTF_ATTRIBUTE(1,2)
{
va_list ap;
char *s = NULL;
@@ -76,6 +94,7 @@
va_end(ap);
write(state.fd, s, strlen(s));
+ fsync(state.fd);
free(s);
}
@@ -119,6 +138,7 @@
}
if (old_fd > 2) {
+ fsync(old_fd);
close(old_fd);
}
}
@@ -173,24 +193,6 @@
}
}
-void log_timestring(int level, const char *location, const char *func)
-{
- char *t = NULL;
- char *s = NULL;
-
- if (state.logtype != DEBUG_FILE) return;
-
- t = timestring(NULL, time(NULL));
- if (!t) return;
-
- asprintf(&s, "[%s, %d %s:%s()]\n", t, level, location, func);
- talloc_free(t);
- if (!s) return;
-
- write(state.fd, s, strlen(s));
- free(s);
-}
-
uint32_t get_task_id(void)
{
if (debug_handlers.ops.get_task_id) {
Modified: branches/SAMBA_4_0/source/lib/util/debug.h
===================================================================
--- branches/SAMBA_4_0/source/lib/util/debug.h 2006-03-01 13:20:32 UTC (rev 13769)
+++ branches/SAMBA_4_0/source/lib/util/debug.h 2006-03-01 15:02:07 UTC (rev 13770)
@@ -43,9 +43,6 @@
void (*log_task_id)(int fd);
};
-void do_debug_header(int level, const char *location, const char *func);
-void do_debug(const char *, ...) PRINTF_ATTRIBUTE(1,2);
-
extern int DEBUGLEVEL;
#define DEBUGLVL(level) ((level) <= DEBUGLEVEL)
More information about the samba-cvs
mailing list