Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #90 from apollo-lhc/develop
Browse files Browse the repository at this point in the history
Merging for new tag
  • Loading branch information
dgastler authored Feb 2, 2023
2 parents e975cf9 + b5c210e commit 5e491c4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ CXX?=g++
IPBUS_REG_HELPER_PATH?=${BUTOOL_PATH}/plugins/BUTool-IPBUS-Helpers

LIBRARY_APOLLO_SM_DEVICE = lib/libBUTool_ApolloSMDevice.so
LIBRARY_APOLLO_SM_DEVICE_SOURCES = $(wildcard src/ApolloSM_device/*.cc)
#make sure version.cc isn't found here in the wildcard, otherwise it might get added twice.
LIBRARY_APOLLO_SM_DEVICE_SOURCES = $(patsubst $(VERSION_FILE),,$(wildcard src/ApolloSM_device/*.cc))
#add version.cc
LIBRARY_APOLLO_SM_DEVICE_SOURCES += $(VERSION_FILE)
LIBRARY_APOLLO_SM_DEVICE_OBJECT_FILES = $(patsubst src/%.cc,obj/%.o,${LIBRARY_APOLLO_SM_DEVICE_SOURCES})

Expand Down
4 changes: 2 additions & 2 deletions src/ApolloSM/ApolloSM_debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void ApolloSM::DebugDump(std::ostream & output){
try{
val = ReadRegister(*itReg);
output << "0x" << std::setfill('0') << std::setw(8) << std::hex << val << std::endl;
}catch(uhal::exception::UIOBusError & e){
}catch(uhal::exception::SigBusError & e){
output << "BusErr" << std::endl;
}catch(BUException::REG_READ_DENIED & e){
output << "Write Only" << std::endl;
Expand All @@ -42,7 +42,7 @@ void ApolloSM::DebugDump(std::ostream & output){
try{
val = ReadRegister(*itReg);
output << "0x" << std::setfill('0') << std::setw(8) << std::hex << val << std::endl;
}catch(uhal::exception::UIOBusError & e){
}catch(uhal::exception::SigBusError & e){
output << std::string("BusErr") << std::endl;
}catch(BUException::REG_READ_DENIED & e){
output << "Write Only" << std::endl;
Expand Down
15 changes: 14 additions & 1 deletion src/standalone/daemon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <syslog.h>
#include <signal.h>
#include <string.h>
#include <fcntl.h>

// this allows sig_handler to access the class variable "loop" without being a class function
bool static volatile * globalLoop;
Expand Down Expand Up @@ -58,9 +59,21 @@ void Daemon::daemonizeThisProgram(std::string pidFileName, std::string runPath)
syslog(LOG_INFO,"Changed path to \"%s\"\n", runPath.c_str());

//Everything looks good, close the standard file fds.
//Since something might still try to use them, use dup to link them all to /dev/null
int nullFD = open("/dev/null",O_RDWR);
if(-1 == nullFD){
syslog(LOG_ERR,"Failed to open /dev/null for std fd closing");
exit(EXIT_FAILURE);
}
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);

//remap the st file descriptors to nullFD
dup2(nullFD,STDIN_FILENO);
dup2(nullFD,STDOUT_FILENO);
dup2(nullFD,STDERR_FILENO);

}

//void static signal_handler(int const signum) {
Expand All @@ -85,4 +98,4 @@ void Daemon::SetLoop(bool b) {

bool Daemon::GetLoop() {
return loop;
}
}

0 comments on commit 5e491c4

Please sign in to comment.