Prepared RTEMS 4.10 posix with network
This commit is contained in:
committed by
Brendan Chandler
parent
8ef4d29c48
commit
9f387b9675
@@ -1,6 +1,8 @@
|
||||
#include <rtems.h>
|
||||
#include <rtems/error.h>
|
||||
#include <rtems/rtems/tasks.h>
|
||||
#ifndef RTEMS_LEGACY_STACK
|
||||
#include <rtems/score/threadimpl.h>
|
||||
#endif
|
||||
|
||||
#include "../posix/osdMutex.c"
|
||||
#include "../posix/osdMutex.c"
|
||||
|
||||
@@ -13,6 +13,21 @@
|
||||
#define epicsExportSharedSymbols
|
||||
#include "osiPoolStatus.h"
|
||||
|
||||
#if __RTEMS_MAJOR__<5
|
||||
/*
|
||||
* * osiSufficentSpaceInPool ()
|
||||
* */
|
||||
LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize )
|
||||
{
|
||||
rtems_malloc_statistics_t s;
|
||||
unsigned long n;
|
||||
|
||||
malloc_get_statistics(&s);
|
||||
n = s.space_available - (unsigned long)(s.lifetime_allocated - s.lifetime_freed);
|
||||
return (n > (50000 + contiguousBlockSize));
|
||||
}
|
||||
|
||||
#else
|
||||
/*
|
||||
* osiSufficentSpaceInPool ()
|
||||
*/
|
||||
@@ -25,3 +40,4 @@ LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize
|
||||
n = info.Stats.size - (unsigned long)(info.Stats.lifetime_allocated - info.Stats.lifetime_freed);
|
||||
return (n > (50000 + contiguousBlockSize));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,17 @@
|
||||
#include <netdb.h>
|
||||
#include <unistd.h> /* close() and others */
|
||||
|
||||
#ifdef RTEMS_LEGACY_STACK
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // LEGACY_STACK
|
||||
typedef int SOCKET;
|
||||
#define INVALID_SOCKET (-1)
|
||||
#define SOCKERRNO errno
|
||||
|
||||
@@ -7,9 +7,29 @@
|
||||
\*************************************************************************/
|
||||
/* osi/os/posix/osdFindSymbol.c */
|
||||
|
||||
#include "epicsFindSymbol.h"
|
||||
|
||||
/* RTEMS posix but without libbsd */
|
||||
#ifdef RTEMS_LEGACY_STACK
|
||||
LIBCOM_API void * epicsLoadLibrary(const char *name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
LIBCOM_API const char *epicsLoadError(void)
|
||||
{
|
||||
return "epicsLoadLibrary not implemented";
|
||||
}
|
||||
|
||||
LIBCOM_API void * epicsStdCall epicsFindSymbol(const char *name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "epicsFindSymbol.h"
|
||||
|
||||
/* non-POSIX extension available on Linux (glibc at least) and OSX.
|
||||
*/
|
||||
@@ -31,3 +51,4 @@ LIBCOM_API void * epicsStdCall epicsFindSymbol(const char *name)
|
||||
{
|
||||
return dlsym(RTLD_DEFAULT, name);
|
||||
}
|
||||
#endif // RTEMS_LEGACY_STACK
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(_POSIX_MEMLOCK) && _POSIX_MEMLOCK > 0
|
||||
#include <sys/mman.h>
|
||||
#ifndef RTEMS_LEGACY_STACK // seems to be part of libbsd?
|
||||
#include <sys/mman.h>
|
||||
#endif // LEGACY STACK
|
||||
#endif
|
||||
|
||||
#include "epicsStdio.h"
|
||||
@@ -426,6 +428,7 @@ LIBCOM_API
|
||||
void epicsThreadRealtimeLock(void)
|
||||
{
|
||||
#if defined(_POSIX_MEMLOCK) && _POSIX_MEMLOCK > 0
|
||||
#ifndef RTEMS_LEGACY_STACK // seems to be part of libbsd?
|
||||
if (pcommonAttr->maxPriority > pcommonAttr->minPriority) {
|
||||
int status = mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||
|
||||
@@ -450,6 +453,7 @@ void epicsThreadRealtimeLock(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // LEGACY STACK
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user