Initial tweaks for RTEMS support, though linking is still a work in progress.

This commit is contained in:
Brian Cox 2016-07-10 22:33:23 -07:00
parent 2d49bf6630
commit ad85c15f07
13 changed files with 95 additions and 19 deletions

View File

@ -114,6 +114,9 @@
/* Define to 1 if you have the <sys/ustat.h> header file. */
#undef HAVE_SYS_USTAT_H
/* Define to 1 if you have the <sys/utsname.h> header file. */
#undef HAVE_SYS_UTSNAME_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

13
configure vendored
View File

@ -5733,6 +5733,19 @@ fi
done
for ac_header in sys/utsname.h memory.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_header in sys/fs/vx_ioctl.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "sys/fs/vx_ioctl.h" "ac_cv_header_sys_fs_vx_ioctl_h" "$ac_includes_default"

View File

@ -71,6 +71,7 @@ AC_CHECK_HEADERS(sys/ustat.h sys/sysmacros.h sys/syslog.h sys/socket.h)
AC_CHECK_HEADERS(unistd.h syslog.h langinfo.h sys/statfs.h sys/select.h)
AC_CHECK_HEADERS(signum.h bits/signum.h, break )
AC_CHECK_HEADERS(stdarg.h varargs.h, break )
AC_CHECK_HEADERS(sys/utsname.h memory.h)
AC_CHECK_HEADERS(sys/fs/vx_ioctl.h)
dnl # Special case for malloc.h, because it's depreciated on most systems.

View File

@ -78,8 +78,8 @@
#define OS_SKYOS 0x0505
#define OS_SORTIX 0x0506
#define OS_MINT 0x0507
#define OS_AROS 0x0506
#define OS_AROS 0x0508
#define OS_RTEMS 0x0509
#define COMP_UNKNOWN 0
#define COMP_GCC 0x0001
@ -196,20 +196,24 @@
#elif defined(SKYOS)
#define OS OS_SKYOS
#define IS_SKYOS 1
#define IS_SKYOS 1
#elif defined(_SORTIX_SOURCE)
#define OS OS_SORTIX
#define IS_SORTIX 1
#define OS OS_SORTIX
#define IS_SORTIX 1
#elif defined(__MINT__)
#define OS OS_MINT
#define IS_MINT 1
#define IS_MINT 1
#elif defined(__AROS__)
#define OS OS_AROS
#define IS_AROS 1
#elif defined(__rtems__)
#define OS OS_RTEMS
#define IS_RTEMS 1
#else
// OK for OS not to resolve, it's being phased out.
// #error Unknown OS
@ -301,8 +305,10 @@
#define USES_MBLEN (!IS_ANDROID && !IS_AROS)
#define USES_DEVICE_PATH (IS_AROS || IS_DOS_DJGPP)
#define ICONV_CONST_SOURCE (IS_MINIX)
#define SUPPORTS_DIRECT_IO (IS_LINUX) // Others may work, but only tested & verified on Linux so far.
#define SUPPORTS_DIRECT_IO (IS_LINUX)
// Linux is the only platform where direct i/o hashing has been tested & works properly so far.
#define SUPPORTS_TERMIOS (!IS_RTEMS)
// RTEMS errors are probably just a buildsys issue & this will change or go away.
//=============================================================================

View File

@ -64,7 +64,10 @@
#include "stdcore.h"
#include <stdio.h>
#include <sys/types.h>
#include <memory.h>
#if HAVE_MEMORY_H
# include <memory.h>
#endif
#include "sha.h"

View File

@ -70,7 +70,11 @@
#ifdef HAVE_SYS_SYSMACROS_H
# include <sys/sysmacros.h>
#endif
#include <sys/utsname.h>
#if HAVE_SYS_UTSNAME_H
# include <sys/utsname.h>
#endif
#include <pwd.h>
#if HAVE_SYS_SOCKET_H
@ -397,15 +401,20 @@ void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const th
void cUnixFSServices::GetMachineName( TSTRING& strName ) const throw( eFSServices )
{
#if HAVE_SYS_UTSNAME_H
struct utsname namebuf;
if( uname( &namebuf ) == -1 )
throw eFSServicesGeneric( strName );
else
strName = namebuf.nodename;
#else
strName = "localhost";
#endif
}
void cUnixFSServices::GetMachineNameFullyQualified( TSTRING& strName ) const
{
#if HAVE_SYS_UTSNAME_H
char buf[256];
if (gethostname(buf, 256) != 0)
{
@ -423,7 +432,7 @@ void cUnixFSServices::GetMachineNameFullyQualified( TSTRING& strName ) const
}
#endif
}
#endif
try
{
cUnixFSServices::GetMachineName(strName);
@ -464,7 +473,7 @@ bool cUnixFSServices::GetIPAddress( uint32& uiIPAddress )
bool fGotAddress = false;
cDebug d( _T("cUnixFSServices::GetIPAddress") );
#if SUPPORTS_NETWORKING
#if SUPPORTS_NETWORKING && HAVE_SYS_UTSNAME_H
struct utsname utsnameBuf;
if( EFAULT != uname( &utsnameBuf) )
{

View File

@ -49,6 +49,11 @@
#include "hierdbpath.h"
#endif
#if HAVE_STRINGS_H // RTEMS needs this for strcasecmp
# include <strings.h>
#endif
class cHierDatabaseIter;
class cErrorBucket;

View File

@ -40,6 +40,10 @@
#include "stdfco.h"
#include "fcodatasourceiter.h"
#if HAVE_STRINGS_H // for strcasecmp on RTEMS
# include <strings.h>
#endif
//=========================================================================
// METHOD CODE
//=========================================================================

View File

@ -43,6 +43,10 @@
#include "genreinfo.h"
#include "core/errorutil.h"
#if HAVE_STRINGS_H // for strcasecmp on RTEMS
# include <strings.h>
#endif
//=========================================================================
// STATIC MEMBERS
//=========================================================================

View File

@ -50,8 +50,10 @@
#if IS_UNIX
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <sys/ioctl.h>
#if SUPPORTS_TERMIOS
# include <termios.h>
# include <sys/ioctl.h>
#endif
//#include <signal.h>
int _getch(void);
#endif

View File

@ -54,7 +54,10 @@
#endif
#include <sys/types.h>
#include <sys/time.h>
#include <sys/utsname.h>
#if HAVE_SYS_UTSNAME_H
# include <sys/utsname.h>
#endif
#if HAVE_SYS_SELECT_H
# include <sys/select.h>
@ -82,7 +85,8 @@
static int gethostname( char* name, int namelen )
{
name[0] = '\0';
#if HAVE_SYS_UTSNAME_H
struct utsname myname;
uname( & myname );
@ -97,6 +101,10 @@ static int gethostname( char* name, int namelen )
return -1;
// equivalent of SOCKET_ERROR
}
#else
strncpy(name, "localhost", namelen);
#endif
}
#endif
// Unix does not require us to go though any silly DLL hoops, so we'll

View File

@ -308,8 +308,14 @@ void cTWInit::Init( const TSTRING& strArgv0 )
tw_HandleSignal( SIGSYS ); // Bad system call.
#endif
tw_HandleSignal( SIGFPE ); // Floating point exception.
#ifdef SIGXCPU
tw_HandleSignal( SIGXCPU ); // CPU time exceeded. Might very well be an issue for us.
#endif
#ifdef SIGXFSZ
tw_HandleSignal( SIGXFSZ ); // File size limit exceeded.
#endif
#endif

View File

@ -74,8 +74,11 @@
#if IS_UNIX
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <sys/ioctl.h>
#if SUPPORTS_TERMIOS
# include <termios.h>
# include <sys/ioctl.h>
#endif
#include "core/tw_signal.h"
int _getch(void);
#endif
@ -1118,10 +1121,15 @@ void cTWUtil::CreatePrivateKey(cPrivateKeyProxy& proxy, cKeyFile& keyFile, const
#if IS_UNIX
static void (*old_SIGINT)(int);
static void (*old_SIGQUIT)(int);
#if SUPPORTS_TERMIOS
static struct termios Otty;
#endif
static void RestoreEcho(int sig)
{
#if SUPPORTS_TERMIOS
#ifdef _DEBUG
std::cout << "Caught signal, resetting echo."<< std::endl;
sleep(2);
@ -1130,7 +1138,7 @@ static void RestoreEcho(int sig)
tcsetattr( 0, TCSAFLUSH, &Otty);
tw_signal(SIGINT, old_SIGINT);
tw_signal(SIGQUIT, old_SIGQUIT);
#endif
tw_raise(sig);
}
@ -1173,6 +1181,7 @@ void cTWUtil::GetString(wc16_string& ret)
cTWUtil::NoEcho::NoEcho()
{
#if SUPPORTS_TERMIOS
// set the terminal to no echo mode
static struct termios Ntty;
@ -1190,13 +1199,16 @@ cTWUtil::NoEcho::NoEcho()
{
ThrowAndAssert(eTWUtilEchoModeSet());
}
#endif
}
cTWUtil::NoEcho::~NoEcho()
{
#if SUPPORTS_TERMIOS
tcsetattr( 0, TCSAFLUSH, &Otty);
tw_signal(SIGINT, old_SIGINT);
tw_signal(SIGQUIT, old_SIGQUIT);
#endif
}
void cTWUtil::GetStringNoEcho(wc16_string& ret)