Merge pull request 'Linux convergence' (#310) from KSat/fsfw:mueller/linux-update into development
Reviewed-on: fsfw/fsfw#310
This commit is contained in:
commit
d8be07b4db
@ -1,5 +1,5 @@
|
||||
#ifndef FRAMEWORK_IPC_MUTEXFACTORY_H_
|
||||
#define FRAMEWORK_IPC_MUTEXFACTORY_H_
|
||||
#ifndef FSFW_IPC_MUTEXFACTORY_H_
|
||||
#define FSFW_IPC_MUTEXFACTORY_H_
|
||||
|
||||
#include "MutexIF.h"
|
||||
/**
|
||||
@ -31,4 +31,4 @@ private:
|
||||
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_IPC_MUTEXFACTORY_H_ */
|
||||
#endif /* FSFW_IPC_MUTEXFACTORY_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "../../osal/linux/BinarySemaphore.h"
|
||||
#include "BinarySemaphore.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
extern "C" {
|
||||
|
@ -76,25 +76,25 @@ timeval Clock::getUptime() {
|
||||
|
||||
ReturnValue_t Clock::getUptime(timeval* uptime) {
|
||||
//TODO This is not posix compatible and delivers only seconds precision
|
||||
// is the OS not called Linux?
|
||||
//Linux specific file read but more precise
|
||||
// Linux specific file read but more precise.
|
||||
double uptimeSeconds;
|
||||
if(std::ifstream("/proc/uptime",std::ios::in) >> uptimeSeconds){
|
||||
uptime->tv_sec = uptimeSeconds;
|
||||
uptime->tv_usec = uptimeSeconds *(double) 1e6 - (uptime->tv_sec *1e6);
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
//TODO This is not posix compatible and delivers only seconds precision
|
||||
// I suggest this is moved into another clock function which will
|
||||
// deliver second precision later.
|
||||
// Wait for new FSFW Clock function delivering seconds uptime.
|
||||
//uint32_t Clock::getUptimeSeconds() {
|
||||
// //TODO This is not posix compatible and delivers only seconds precision
|
||||
// struct sysinfo sysInfo;
|
||||
// int result = sysinfo(&sysInfo);
|
||||
// if(result != 0){
|
||||
// return HasReturnvaluesIF::RETURN_FAILED;
|
||||
// }
|
||||
// return sysInfo.uptime;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
//}
|
||||
|
||||
ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
|
||||
timeval uptime;
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "../../objectmanager/ObjectManagerIF.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <fcntl.h> /* For O_* constants */
|
||||
#include <sys/stat.h> /* For mode constants */
|
||||
#include <cstring>
|
||||
|
@ -1,10 +1,9 @@
|
||||
#ifndef OS_LINUX_MUTEX_H_
|
||||
#define OS_LINUX_MUTEX_H_
|
||||
#ifndef FSFW_OSAL_LINUX_MUTEX_H_
|
||||
#define FSFW_OSAL_LINUX_MUTEX_H_
|
||||
|
||||
#include "../../ipc/MutexIF.h"
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
class Mutex : public MutexIF {
|
||||
public:
|
||||
Mutex();
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "../../ipc/MutexFactory.h"
|
||||
#include "Mutex.h"
|
||||
|
||||
#include "../../ipc/MutexFactory.h"
|
||||
|
||||
//TODO: Different variant than the lazy loading in QueueFactory. What's better and why?
|
||||
MutexFactory* MutexFactory::factoryInstance = new MutexFactory();
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "PosixThread.h"
|
||||
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <errno.h>
|
||||
|
||||
@ -149,8 +151,10 @@ void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) {
|
||||
|
||||
status = pthread_attr_setstack(&attributes, stackPointer, stackSize);
|
||||
if(status != 0){
|
||||
sif::error << "Posix Thread attribute setStack failed with: " <<
|
||||
strerror(status) << std::endl;
|
||||
sif::error << "PosixThread::createTask: pthread_attr_setstack "
|
||||
" failed with: " << strerror(status) << std::endl;
|
||||
sif::error << "Make sure the specified stack size is valid and is "
|
||||
"larger than the minimum allowed stack size." << std::endl;
|
||||
}
|
||||
|
||||
status = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "../../tasks/SemaphoreFactory.h"
|
||||
#include "BinarySemaphore.h"
|
||||
#include "CountingSemaphore.h"
|
||||
|
||||
#include "../../tasks/SemaphoreFactory.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "FixedTimeslotTask.h"
|
||||
#include "PeriodicPosixTask.h"
|
||||
|
||||
#include "../../tasks/TaskFactory.h"
|
||||
#include "../../returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "Timer.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include <errno.h>
|
||||
#include "Timer.h"
|
||||
|
||||
|
||||
Timer::Timer() {
|
||||
sigevent sigEvent;
|
||||
|
Loading…
Reference in New Issue
Block a user