Skip to content

Commit

Permalink
[merged] pr #4: compatibility with recent autotools and gcc
Browse files Browse the repository at this point in the history
  • Loading branch information
ckl committed Sep 17, 2015
1 parent f720d75 commit b588055
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Tell automake to put the object file for monitord/apple.c in dir monitord/
AUTOMAKE_OPTIONS := subdir-objects
AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = -I m4

# The installable executable.
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ AC_INIT([monitord], [2.0svn], [[email protected]])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

AM_PROG_AR

AC_PROG_CC
AC_PROG_CXX
Expand Down
40 changes: 20 additions & 20 deletions monitord/SocketServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ SocketServer::SocketServer(MonitorConfiguration *config, std::string FilterFileN

if (lua_pcall(L, 0, 0, 0))
{
LOG_ERROR("LUA test fehlgeschlagen" << endl )
FILE_LOG(logERROR) << "LUA test fehlgeschlagen" << endl ;
}

m_bUseLUAScript=true ;
LOG_INFO("Successfully loaded LUA filter: " << FilterFileName )
FILE_LOG(logINFO) << "Successfully loaded LUA filter: " << FilterFileName ;
}
catch (const std::string &e)
{
LOG_ERROR("Error loading lua script: " << e)
FILE_LOG(logERROR) << "Error loading lua script: " << e;
}

#endif
Expand Down Expand Up @@ -268,7 +268,7 @@ void *SocketServer::Thread()

socklen_t sin_size = sizeof (sockaddr_in);
int fd = accept(m_sock,(sockaddr*) &socketThread[useSocket]->m_client,&sin_size);
LOG_INFO("new connection from " << inet_ntoa(socketThread[useSocket]->m_client.sin_addr) )
FILE_LOG(logINFO) << "new connection from " << inet_ntoa(socketThread[useSocket]->m_client.sin_addr) ;

// Thread mit dem oben angenommenen Socket starten
socketThread[useSocket]->setFD(fd) ;
Expand All @@ -281,16 +281,16 @@ void *SocketServer::Thread()
closesocket( m_sock);

// Alle Clients beenden
LOG_INFO("Beende alle Clients" )
FILE_LOG(logINFO) << "Beende alle Clients" ;
for (int i=0;i<MAX_CLIENTS;++i)
{
LOG_DEBUG("beende client " << i)
FILE_LOG(logDEBUG) << "beende client " << i ;
if (socketThread[i]->IsRunning())
{
socketThread[i]->closeSocket() ;
LOG_INFO(i << ": closesocket done" )
FILE_LOG(logINFO) << i << ": closesocket done" ;
socketThread[i]->Kill() ;
LOG_INFO(i << ": kill done" )
FILE_LOG(logINFO) << i << ": kill done" ;
}
}

Expand Down Expand Up @@ -435,19 +435,19 @@ void SocketServer::addResult(ModuleResultBase* pRes)

/* do the call (2 arguments, 1 result) */
if (lua_pcall(L, 0, LUA_MULTRET, 0) != 0) {
LOG_ERROR("Fehler beim Aufruf lua dispatcher script:" << lua_tostring(L, -1))
FILE_LOG(logERROR) << "Fehler beim Aufruf lua dispatcher script:" << lua_tostring(L, -1);
//error(L, "error running function `f': %s",
// lua_tostring(L, -1));
}

/* retrieve result */
if (!lua_isnumber(L, -1)) {
LOG_ERROR("nicht-numerische Antwort vom lua dispatcher script" )
FILE_LOG(logERROR) << "nicht-numerische Antwort vom lua dispatcher script" ;
//error(L, "function `f' must return a number");
}
z = lua_tonumber(L, -1);
lua_pop(L, 1); /* pop returned value */
LOG_DEBUG("lua Result (global dispatcher)" << z)
FILE_LOG(logDEBUG1) << "lua Result (global dispatcher)" << z ;

if (z==1) m_bSkipDispatching=true ;
}
Expand Down Expand Up @@ -548,7 +548,7 @@ void *SocketThread::Thread()
createLock() ;
createSocket() ;

LOG_INFO("SocketThreads exits" )
FILE_LOG(logINFO) << "SocketThreads exits" ;

releaseLock() ;
return NULL;
Expand Down Expand Up @@ -617,7 +617,7 @@ void SocketThread::say(const std::string& something)
unsigned int len=send( m_fd, something.c_str(), something.length(), 0);
if (len!=something.length())
{
LOG_ERROR("error sending date to client. thread exiting" )
FILE_LOG(logERROR) << "error sending date to client. thread exiting" ;
doLogout() ;
}
}
Expand All @@ -627,7 +627,7 @@ void SocketThread::say(const char *something)
unsigned int len = send( m_fd, something, strlen(something), 0);
if (len!=strlen(something))
{
LOG_ERROR("error sending date to client. thread exiting" )
FILE_LOG(logERROR) << "error sending date to client. thread exiting" ;
doLogout() ;
}
}
Expand Down Expand Up @@ -674,7 +674,7 @@ void SocketThread::createSocket()
// Gültige IP Adresse, die sich nicht anmelden muss ?
if (m_MonitorConfiguration->IsValidLogin("","",this->m_sClientIP))
{
LOG_INFO("login authentication (ip allowed): " << m_sClientIP )
FILE_LOG(logINFO) << "login authentication (ip allowed): " << m_sClientIP ;
this->m_authenticated=true ;
}

Expand Down Expand Up @@ -718,20 +718,20 @@ void SocketThread::createSocket()

if (FD_ISSET(m_fd,&fdset)>0) // Socket ereignis ?
{
LOG_DEBUG("Socket reports read event")
FILE_LOG(logDEBUG) << "Socket reports read event" ;
result=1 ;
}

if (FD_ISSET(m_fd,&fdset_write)>0) // Problem ?
{
LOG_DEBUG("Socket reports write event")
FILE_LOG(logDEBUG) << "Socket reports write event" ;
result=0 ;
//m_exitThread=true ;
}

if (FD_ISSET(m_fd,&fdset_exceptions)>0) // Problem ?
{
LOG_DEBUG("Socket reports exception event")
FILE_LOG(logDEBUG) << "Socket reports exception event" ;
result=0 ;
m_exitThread=true ;
}
Expand All @@ -744,7 +744,7 @@ void SocketThread::createSocket()
gelesen=recv (m_fd, buffer, RECV_BUFFER-1, 0) ;
if (gelesen<=0) // Nix am Port, aber doch Port Event ?
{
LOG_INFO("recv()<=0 => socketthread exiting" )
FILE_LOG(logINFO) << "recv()<=0 => socketthread exiting" ;
m_exitThread=true ;
}
buffer[gelesen]='\0';
Expand Down Expand Up @@ -848,7 +848,7 @@ MonitorSocketsManager* GetSocketsManager() {

MonitorSocketsManager::MonitorSocketsManager()
{
LOG_DEBUG("SocketManager erstellt")
FILE_LOG(logDEBUG) << "SocketManager erstellt" ;

if ( memLockCreate( 12347, & m_MemLock) < 0) {
ThrowMonitorException("SocketsManager: memLockCreate failed") ;
Expand Down
5 changes: 3 additions & 2 deletions monitord/plugins/mpluginAudio.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "mpluginAudio.h"
#include <unistd.h>

using namespace std ;

Expand All @@ -17,7 +18,7 @@ void MonitorAudioPlugIn::addThreadMessage(SocketThread* pClient, std::string mes
pMsg->pThread=pClient ;
pMsg->message=message ;

while (m_bLockSocketMessages==true) Sleep(3) ;
while (m_bLockSocketMessages==true) sleep(3) ;

m_bLockSocketMessages=true ;
m_SocketMessages.push_back(pMsg) ;
Expand All @@ -38,7 +39,7 @@ bool MonitorAudioPlugIn::getThreadMessage(SocketMessage & msg)
{
bool retVal=false ;

while (m_bLockSocketMessages) Sleep(1) ;
while (m_bLockSocketMessages) sleep(1) ;

m_bLockSocketMessages=true ;

Expand Down
8 changes: 4 additions & 4 deletions simpleopt/SimpleGlob.h
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ CSimpleGlobTempl<SOCHAR>::Add(
if (!SimpleGlobUtil::strchr(a_pszFileSpec, '*') &&
!SimpleGlobUtil::strchr(a_pszFileSpec, '?'))
{
SG_FileType nType = GetFileTypeS(a_pszFileSpec);
SG_FileType nType = this->GetFileTypeS(a_pszFileSpec);
if (nType == SG_FILETYPE_INVALID) {
if (m_uiFlags & SG_GLOB_NOCHECK) {
return AppendName(a_pszFileSpec, false);
Expand All @@ -641,7 +641,7 @@ CSimpleGlobTempl<SOCHAR>::Add(
#endif

// search for the first match on the file
int rc = FindFirstFileS(a_pszFileSpec, m_uiFlags);
int rc = this->FindFirstFileS(a_pszFileSpec, m_uiFlags);
if (rc != SG_SUCCESS) {
if (rc == SG_ERR_NOMATCH && (m_uiFlags & SG_GLOB_NOCHECK)) {
int ok = AppendName(a_pszFileSpec, false);
Expand All @@ -654,8 +654,8 @@ CSimpleGlobTempl<SOCHAR>::Add(
int nError, nStartLen = m_nArgsLen;
bool bSuccess;
do {
nError = AppendName(GetFileNameS((SOCHAR)0), IsDirS((SOCHAR)0));
bSuccess = FindNextFileS((SOCHAR)0);
nError = AppendName(this->GetFileNameS((SOCHAR)0), this->IsDirS((SOCHAR)0));
bSuccess = this->FindNextFileS((SOCHAR)0);
}
while (nError == SG_SUCCESS && bSuccess);
SimpleGlobBase<SOCHAR>::FindDone();
Expand Down

0 comments on commit b588055

Please sign in to comment.