Return Type | Function name | Arguments |
---|---|---|
hzEcode | hzLogger::OpenPrivate | (const char*,hzLogRotate,unsigned int,) |
Declared in file: hzProcess.h
Defined in file : hzLogger.cpp
Function Logic:
Function body:
hzEcode hzLogger::OpenPrivate (const char* fpath, hzLogRotate eRotate, unsigned int nPerms) { _hzfunc("hzLogger::OpenPrivate") ; uint32_t nSize ; uint32_t nUsr ; uint32_t nGrp ; uint32_t nProcID ; uchar* u ; if (m_pConnection->ConnectStd(s_LocalHost, PORT_LOGSERVER) != E_OK) return E_HOSTFAIL ; nSize = 21+strlen(fpath) ; nProcID = getpid() ; nUsr = geteuid() ; nGrp = getegid() ; u = (uchar*) m_cvData ; u[ 0]= LS_OPEN_PUB ; u[ 1]= (nSize & 0xff00)>>8; u[ 2]= (nSize & 0xff); u[ 3]= (nProcID & 0xff000000)>>24; u[ 4]= (nProcID & 0xff0000)>>16; u[ 5]= (nProcID & 0xff00)>>8; u[ 6]= (nProcID & 0xff); u[ 7]= (nUsr & 0xff000000)>>24; u[ 8]= (nUsr & 0xff0000)>>16; u[ 9]= (nUsr & 0xff00)>>8; u[10]=(nUsr & 0xff); u[11]=(nGrp & 0xff000000)>>24; u[12]=(nGrp & 0xff0000)>>16; u[13]=(nGrp & 0xff00)>>8; u[14]=(nGrp & 0xff); u[15]=(nPerms & 0xff000000)>>24; u[16]=(nPerms & 0xff0000)>>16; u[17]=(nPerms & 0xff00)>>8; u[18]=(nPerms & 0xff); u[19]=eRotate ; strncpy(m_cvData + 20,fpath,HZ_MAXPATHLEN) ; if (m_pConnection->Send(m_cvData, nSize) != E_OK) return E_SENDFAIL ; if (m_pConnection->Recv(m_cvData, nSize, 64)!=E_OK) return E_RECVFAIL ; if (nSize == 4&& m_cvData[0]== LS_OK) { m_nSessID = 0; m_nSessID |= (u[1]<< 16); m_nSessID |= (u[2]<< 8); m_nSessID |= u[3]; m_pDataPtr = m_cvData + 10; return E_OK ; } return E_PROTOCOL ; }