linux fixes
This commit is contained in:
parent
36bc7609c5
commit
7129ea67bd
@ -1,10 +1,11 @@
|
||||
#include "BinarySemaphore.h"
|
||||
#include "../../serviceinterface/ServiceInterfacePrinter.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
extern "C" {
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
}
|
||||
|
||||
|
||||
BinarySemaphore::BinarySemaphore() {
|
||||
// Using unnamed semaphores for now
|
||||
@ -113,7 +114,8 @@ uint8_t BinarySemaphore::getSemaphoreCounter(sem_t *handle) {
|
||||
}
|
||||
else if(result != 0 and errno == EINVAL) {
|
||||
// Could be called from interrupt, use lightweight printf
|
||||
printf("BinarySemaphore::getSemaphoreCounter: Invalid semaphore\n");
|
||||
fsfw::printError("BinarySemaphore::getSemaphoreCounter: "
|
||||
"Invalid semaphore\n");
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
@ -128,15 +130,19 @@ void BinarySemaphore::initSemaphore(uint8_t initCount) {
|
||||
switch(errno) {
|
||||
case(EINVAL):
|
||||
// Value exceeds SEM_VALUE_MAX
|
||||
case(ENOSYS):
|
||||
case(ENOSYS): {
|
||||
// System does not support process-shared semaphores
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "BinarySemaphore: Init failed with" << strerror(errno)
|
||||
<< std::endl;
|
||||
sif::error << "BinarySemaphore: Init failed with "
|
||||
<< strerror(errno) << std::endl;
|
||||
#else
|
||||
fsfw::printError("BinarySemaphore: Init failed with %s\n",
|
||||
strerror(errno));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t BinarySemaphore::checkCount(sem_t* handle, uint8_t maxCount) {
|
||||
int value = getSemaphoreCounter(handle);
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "../../osal/linux/CountingSemaphore.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../../serviceinterface/ServiceInterface.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
CountingSemaphore::CountingSemaphore(const uint8_t maxCount, uint8_t initCount):
|
||||
maxCount(maxCount), initCount(initCount) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "MessageQueue.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../../serviceinterface/ServiceInterface.h"
|
||||
#include "../../objectmanager/ObjectManagerIF.h"
|
||||
|
||||
#include <fstream>
|
||||
@ -121,14 +121,16 @@ ReturnValue_t MessageQueue::handleError(mq_attr* attributes,
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
default: {
|
||||
// Failed either the first time or the second time
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "MessageQueue::MessageQueue: Creating Queue " << std::hex
|
||||
<< name << std::dec << " failed with status: "
|
||||
<< strerror(errno) << std::endl;
|
||||
sif::error << "MessageQueue::MessageQueue: Creating Queue " << name
|
||||
<< " failed with status: " << strerror(errno) << std::endl;
|
||||
#else
|
||||
fsfw::printError("MessageQueue::MessageQueue: Creating Queue %s"
|
||||
" failed with status: %s\n", name, strerror(errno));
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "TcUnixUdpPollingTask.h"
|
||||
#include "../../globalfunctions/arrayprinter.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
TcUnixUdpPollingTask::TcUnixUdpPollingTask(object_id_t objectId,
|
||||
object_id_t tmtcUnixUdpBridge, size_t frameSize,
|
||||
double timeoutSeconds): SystemObject(objectId),
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "TmTcUnixUdpBridge.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../../serviceinterface/ServiceInterface.h"
|
||||
#include "../../ipc/MutexHelper.h"
|
||||
|
||||
#include <errno.h>
|
||||
@ -188,13 +188,17 @@ void TmTcUnixUdpBridge::handleBindError() {
|
||||
|
||||
void TmTcUnixUdpBridge::handleSendError() {
|
||||
switch(errno) {
|
||||
default:
|
||||
default: {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "TmTcUnixBridge::handleSendError: "
|
||||
<< strerror(errno) << std::endl;
|
||||
#else
|
||||
fsfw::printError("TmTcUnixBridge::handleSendError: %s\n",
|
||||
strerror(errno));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TmTcUnixUdpBridge::setClientAddressToAny(bool ipAddrAnySet){
|
||||
this->ipAddrAnySet = ipAddrAnySet;
|
||||
|
Loading…
x
Reference in New Issue
Block a user