Close a log channel and remove it from the thread-logger table. Arguments: None

Return TypeFunction nameArguments
hzEcodehzLogger::Close(void)

Declared in file: hzProcess.h
Defined in file : hzLogger.cpp

Function Logic:

0:START 1:unknown 2:unknown 3:items 4:m_pFile m_nSessID items items 5:Return E_OK 6:u nProcID u u u items items m_nSessID u items items items nProcID u nBytes 7:unknown 8:Return E_SENDFAIL 9:unknown 10:Return E_RECVFAIL 11:unknown 12:Return E_OK 13:Return E_PROTOCOL

Function body:

hzEcode hzLogger::Close (void)
{
   //  Close a log channel and remove it from the thread-logger table.
   //  
   //  Arguments: None
   //  
   //  Returns: E_SENDFAIL If the open command could not be sent to the logserver
   //     E_RECVFAIL If the logserver's response could not be received
   //     E_PROTOCOL If the uid of the calling process is not permitted to write to the file
   //     E_OK  If the log channel was successfully closed
   _hzfunc("hzLogger::Close") ;
   uint32_t    nBytes ;    //  Size of logserver client request
   uint32_t    nProcID ;   //  Caller process id
   uchar*      u ;         //  Pointer into message buffer
   if (m_File)
   {
       //  Log channel is using a direct file
       if (m_pFile)
           fclose(m_pFile) ;
       m_pFile = 0;
       m_nSessID = 0;
       m_Base.Clear() ;
       m_File.Clear() ;
       return E_OK ;
   }
   //  Log channel is using the logserver
   u = (uchar*) m_cvData ;
   nProcID = getpid() ;
   //  Command
   u[0]= LS_STOP ;
   //  Size of message is 8 bytes
   u[1]= 0;
   u[2]= 8;
   //  Session ID
   u[3]= (m_nSessID & 0x00ff0000)>>16;
   u[4]= (m_nSessID & 0x0000ff00)>>8;
   u[5]= (m_nSessID & 0x000000ff);
   //  Proc ID (not applicable)
   u[6]= (nProcID & 0xff00)>>8;
   u[7]= (nProcID & 0xff00)>>8;
   u[8]= (nProcID & 0xff00)>>8;
   u[9]= (nProcID & 0xff);
   nBytes = 10;
   //  Send message and receive response
   if (m_pConnection->Send(m_cvData, nBytes) != E_OK)
       return E_SENDFAIL ;
   if (m_pConnection->Recv(m_cvData, nBytes, 64)!=E_OK)
       return E_RECVFAIL ;
   if (m_cvData[0]== LS_OK)
       return E_OK ;
   return E_PROTOCOL ;
}