Initial AROS commit, such that it compiles & links now, but doesn't run properly yet.

This commit is contained in:
Brian Cox 2016-04-01 08:22:13 -07:00
parent 2038ff627d
commit f3fd9f0a49
7 changed files with 61 additions and 7 deletions

View File

@ -740,7 +740,6 @@ FILE *fp;
return(-1);
}
/*
* like popen but A LOT safer
* uses file descriptors for all three files
@ -867,6 +866,10 @@ FILE *fp[];
return(mfpclose(indx, fp));
}
#ifdef __AROS__
#define fork() vfork()
#endif
/*
* signal values
*/
@ -893,7 +896,6 @@ int mask;
register int i; /* counter in for loop */
register int ch_pid; /* child PID */
register int euid, egid; /* in case reset[gu]id is -1 */
/*
* create 1 pipe for each of standard input, output, error
*/
@ -989,7 +991,6 @@ int mask;
(void) close(p[2][0]);
}
}
/*
* return child's PID
*/

View File

@ -54,6 +54,10 @@
#define TIME_MAX 2147483647L // largest signed 32 bit number
#ifdef __AROS__
#define tzset()
#endif
struct tm* cTimeUtil::TimeToDateGMT( const int64& seconds )
{
ASSERT( seconds < TIME_MAX );// this assumes time_t size is 32 bit. Yikes!

View File

@ -77,6 +77,11 @@ void util_SignalHandler( int sig )
}
#if IS_UNIX
#ifndef NSIG
#define NSIG 32
#endif
void tw_psignal(int sig, const TCHAR *str)
{
const TCHAR *siglist[NSIG] = {

View File

@ -66,6 +66,9 @@ static TSTRING& util_FormatTime( struct tm* ptm, TSTRING& strBuf );
// PUBLIC METHOD CODE
//=========================================================================
#ifdef __AROS__
#define tzset()
#endif
void cTWLocale::InitGlobalLocale()
{
@ -243,7 +246,6 @@ TSTRING& cTWLocale::FormatTime( int64 t, TSTRING& strBuf )
{
// clear return string
strBuf.erase();
tzset();
time_t tmpTime = t;
struct tm * ptm = localtime( &tmpTime );

View File

@ -66,6 +66,12 @@
#define INVALID_SOCKET -1
#ifdef __AROS__
#ifndef HAVE_GETHOSTNAME
#define HAVE_GETHOSTNAME 1
#endif
#endif
#ifndef HAVE_GETHOSTNAME
static int gethostname( char* name, int namelen )
{
@ -87,7 +93,6 @@ static int gethostname( char* name, int namelen )
}
}
#endif
// Unix does not require us to go though any silly DLL hoops, so we'll
// just #define the pointers to functions needed by Windows to be the
// berkely functions.

View File

@ -54,6 +54,12 @@
#include "tw/twerrors.h"
#include "tw/twstrings.h"
#ifdef __AROS__
#include <proto/bsdsocket.h>
#define openlog(a,b,c)
#define closelog()
#endif
///////////////////////////////////////////////////////////////////////////////
// Syslog
///////////////////////////////////////////////////////////////////////////////
@ -91,11 +97,9 @@ void cSyslog::Log(const TCHAR* programName, cSyslog::LogType logType, const TCHA
const char* msg = message;
#endif
#ifndef SKYOS // Handle an oddball OS that has syslog.h but doesn't implement the calls.
openlog(ident, LOG_PID, LOG_USER);
syslog(LOG_NOTICE, "%s", msg);
closelog();
#endif
#elif SUPPORTS_EVENTLOG

View File

@ -79,6 +79,13 @@
#include "core/tw_signal.h" // to ignore SIGPIPE
#endif
#ifdef __AROS__
#include <proto/exec.h>
#include <proto/bsdsocket.h>
#include <bsdsocket/socketbasetags.h>
static bool aros_socketbase_init();
#endif
//=============================================================================
// cTWInit_i
@ -238,6 +245,9 @@ void cTWInit::Init( const TSTRING& strArgv0 )
// END:RAD
// ------------------------------------------------------------
#ifdef __AROS__
aros_socketbase_init();
#endif
//
// set up the file system services
//
@ -305,4 +315,27 @@ void cTWInit::Init( const TSTRING& strArgv0 )
}
#ifdef __AROS__
struct Library* SocketBase=0;
bool aros_socketbase_init()
{
if (!(SocketBase = OpenLibrary("bsdsocket.library", 4)))
{
printf("Failed to load socket library");
return 0;
}
if (SocketBaseTags(
SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (IPTR)&errno,
SBTM_SETVAL(SBTC_HERRNOLONGPTR), (IPTR)&errno,
TAG_DONE))
{
printf("Failed to init socket library");
return 0;
}
return 1;
}
#endif