From: Stephen D. <sd...@us...> - 2005-10-21 05:25:51
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32050/nsd Modified Files: tclinit.c init.tcl Log Message: * nsd/nsd.h: * nsd/tclinit.c (Ns_TclTraceCreate): Run CREATE traces as they are registered in order to make Tcl comamnds registered by binary module available to the boot script and Tcl module files. * nsd/init.tcl: Rename use of depraciated api. * nsdb/db.h: * nsdb/nsdb.c: * nsdb/dbtcl.c: Fix bug where Ns_TclRegisterTrace was being called after server startup. * tests/test.nscfg: * tests/ns_accesslog.test: Add stub tests for the nslog module. Index: tclinit.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclinit.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tclinit.c 30 Jul 2005 03:35:11 -0000 1.12 --- tclinit.c 21 Oct 2005 05:25:36 -0000 1.13 *************** *** 477,481 **** * Ns_TclRegisterTrace -- * ! * Add an interp trace. Traces are called in FIFO order. * * Results: --- 477,483 ---- * Ns_TclRegisterTrace -- * ! * Add an interp trace. Traces are called in FIFO order. Valid ! * traces are: NS_TCL_TRACE... CREATE, DELETE, ALLOCATE, ! * DEALLOCATE, GETCONN, and FREECONN. * * Results: *************** *** 484,488 **** * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 486,491 ---- * * Side effects: ! * CREATE and ALLOCATE traces are run immediately in the current ! * interp (the initial bootstrap interp). * *---------------------------------------------------------------------- *************** *** 493,503 **** void *arg, int when) { ! Trace *tracePtr, **firstPtrPtr; ! NsServer *servPtr; servPtr = NsGetServer(server); ! if (servPtr == NULL || Ns_InfoStarted()) { return NS_ERROR; } tracePtr = ns_malloc(sizeof(Trace)); tracePtr->proc = proc; --- 496,516 ---- void *arg, int when) { ! Trace *tracePtr, **nextPtrPtr; ! NsServer *servPtr; ! Tcl_Interp *interp; ! ! Ns_Log(Warning, "Ns_TclTraceCreate[%s]: %d", ! server, when); servPtr = NsGetServer(server); ! if (servPtr == NULL) { ! Ns_Log(Error, "Ns_TclRegisterTrace: Invalid server: %s", server); return NS_ERROR; } + if (Ns_InfoStarted()) { + Ns_Log(Error, "Can not register Tcl trace, server already started."); + return NS_ERROR; + } + tracePtr = ns_malloc(sizeof(Trace)); tracePtr->proc = proc; *************** *** 505,513 **** tracePtr->when = when; tracePtr->nextPtr = NULL; ! firstPtrPtr = &servPtr->tcl.firstTracePtr; ! while (*firstPtrPtr != NULL) { ! firstPtrPtr = &((*firstPtrPtr)->nextPtr); } - *firstPtrPtr = tracePtr; return NS_OK; --- 518,541 ---- tracePtr->when = when; tracePtr->nextPtr = NULL; ! ! nextPtrPtr = &servPtr->tcl.firstTracePtr; ! while (*nextPtrPtr != NULL) { ! nextPtrPtr = &((*nextPtrPtr)->nextPtr); ! } ! *nextPtrPtr = tracePtr; ! ! /* ! * Run CREATE and ALLOCATE traces immediately so that commands registered ! * by binary modules can be called by Tcl init scripts sourced by the ! * already initialised interp which loads the modules. ! */ ! ! if (when & NS_TCL_TRACE_CREATE || when & NS_TCL_TRACE_ALLOCATE) { ! interp = Ns_TclAllocateInterp(server); ! if ((*proc)(interp, arg) != TCL_OK) { ! Ns_TclLogError(interp); ! } ! Ns_TclDeAllocateInterp(interp); } return NS_OK; *************** *** 1628,1635 **** RunTraces(NsInterp *itPtr, int why) { ! Trace *tracePtr; ! if (itPtr->servPtr != NULL) { ! tracePtr = itPtr->servPtr->tcl.firstTracePtr; while (tracePtr != NULL) { if ((tracePtr->when & why)) { --- 1656,1664 ---- RunTraces(NsInterp *itPtr, int why) { ! Trace *tracePtr; ! NsServer *servPtr = itPtr->servPtr; ! if (servPtr != NULL) { ! tracePtr = servPtr->tcl.firstTracePtr; while (tracePtr != NULL) { if ((tracePtr->when & why)) { Index: init.tcl =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/init.tcl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** init.tcl 20 Oct 2005 17:56:17 -0000 1.5 --- init.tcl 21 Oct 2005 05:25:36 -0000 1.6 *************** *** 607,611 **** } else { if {$is_proc == ""} { ! ns_ictl oninit "rename $oldName $newName" } } --- 607,611 ---- } else { if {$is_proc == ""} { ! ns_ictl trace create "rename $oldName $newName" } } |