Initial support for Solaris 7 and the Sun Forte.
git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@636 0109f412-320b-0410-ab79-c3e0c5ffbbe6
This commit is contained in:
41
ftk/Makefile
41
ftk/Makefile
@@ -1343,29 +1343,38 @@ libs: status clean dircheck $(ftk_static_lib) $(ftk_shared_lib)
|
||||
# -- *.cpp -> *$(obj_suffix) --
|
||||
|
||||
ifdef win_target
|
||||
define cpp_to_obj_template
|
||||
$$($(1)_obj_dir)/%$$(obj_suffix) : %.cpp
|
||||
$$(ec)$$(compiler) $$(ccflags) /Fo$$(call hostpath,$$@) $$(call hostpath,$$<)
|
||||
endef
|
||||
$(lib_obj_dir)/%$(obj_suffix) : %.cpp
|
||||
$(ec)$(compiler) $(ccflags) /Fo$(call hostpath,$@) $(call hostpath,$<)
|
||||
endif
|
||||
|
||||
ifdef unix_target
|
||||
define cpp_to_obj_template
|
||||
$$($(1)_obj_dir)/%$$(obj_suffix) : %.cpp
|
||||
$$(ec)$$(gprintf) "$$<\n"
|
||||
$$(ec)$$(compiler) $$(ccflags) -c $$< -o $$@
|
||||
endef
|
||||
ifdef win_target
|
||||
$(test_obj_dir)/%$(obj_suffix) : %.cpp
|
||||
$(ec)$(compiler) $(ccflags) /Fo$(call hostpath,$@) $(call hostpath,$<)
|
||||
endif
|
||||
|
||||
ifdef netware_target
|
||||
define cpp_to_obj_template
|
||||
$$($(1)_obj_dir)/%$(obj_suffix) : %.cpp
|
||||
$$(ec)$$(gprintf) "$$(notdir $$(strip $$@))\n"
|
||||
$$(ec)$$(call hostpath,$$(compiler)) $$(call hostpath,$$<) /fo=$$(call hostpath,$$@)
|
||||
endef
|
||||
$(lib_obj_dir)/%$(obj_suffix) : %.cpp
|
||||
$(ec)$(gprintf) "$(notdir $(strip $@))\n"
|
||||
$(ec)$(call hostpath,$(compiler)) $(call hostpath,$<) /fo=$(call hostpath,$@)
|
||||
endif
|
||||
|
||||
$(foreach tmpl,lib test,$(eval $(call cpp_to_obj_template,$(tmpl))))
|
||||
ifdef netware_target
|
||||
$(test_obj_dir)/%$(obj_suffix) : %.cpp
|
||||
$(ec)$(gprintf) "$(notdir $(strip $@))\n"
|
||||
$(ec)$(call hostpath,$(compiler)) $(call hostpath,$<) /fo=$(call hostpath,$@)
|
||||
endif
|
||||
|
||||
ifdef unix_target
|
||||
$(lib_obj_dir)/%$(obj_suffix) : %.cpp
|
||||
$(ec)$(gprintf) "$<\n"
|
||||
$(ec)$(compiler) $(ccflags) -c $< -o $@
|
||||
endif
|
||||
|
||||
ifdef unix_target
|
||||
$(test_obj_dir)/%$(obj_suffix) : %.cpp
|
||||
$(ec)$(gprintf) "$<\n"
|
||||
$(ec)$(compiler) $(ccflags) -c $< -o $@
|
||||
endif
|
||||
|
||||
# -- ftk.lib and libftk.a --
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#undef FLM_LINUX
|
||||
#undef FLM_SOLARIS
|
||||
#undef FLM_SPARC
|
||||
#undef FLM_SPARC_PLUS
|
||||
#undef FLM_HPUX
|
||||
#undef FLM_OSX
|
||||
#undef FLM_BIG_ENDIAN
|
||||
@@ -111,6 +112,9 @@
|
||||
#define FLM_SPARC
|
||||
#define FLM_BIG_ENDIAN
|
||||
#define FLM_STRICT_ALIGNMENT
|
||||
#if defined( __sparcv8plus) || defined( __sparcv9)
|
||||
#define FLM_SPARC_PLUS
|
||||
#endif
|
||||
#endif
|
||||
#elif defined( sun)
|
||||
#define FLM_SOLARIS
|
||||
@@ -120,6 +124,9 @@
|
||||
#if defined( sparc) || defined( __sparc) || defined( __sparc__)
|
||||
#define FLM_SPARC
|
||||
#define FLM_BIG_ENDIAN
|
||||
#if defined( __sparcv8plus) || defined( __sparcv9)
|
||||
#define FLM_SPARC_PLUS
|
||||
#endif
|
||||
#endif
|
||||
#elif defined( __hpux) || defined( hpux)
|
||||
#define FLM_HPUX
|
||||
|
||||
@@ -1214,7 +1214,7 @@ FLMINT32 FLMAPI f_atomicInc(
|
||||
{
|
||||
return( (FLMINT32)OSAtomicIncrement32( (int32_t *)piTarget));
|
||||
}
|
||||
#elif defined( FLM_SOLARIS) && defined( FLM_SPARC) && !defined( FLM_GNUC)
|
||||
#elif defined( FLM_SOLARIS) && defined( FLM_SPARC_PLUS) && !defined( FLM_GNUC)
|
||||
{
|
||||
return( sparc_atomic_add_32( piTarget, 1));
|
||||
}
|
||||
@@ -1263,7 +1263,7 @@ FLMINT32 FLMAPI f_atomicDec(
|
||||
{
|
||||
return( (FLMINT32)OSAtomicDecrement32( (int32_t *)piTarget));
|
||||
}
|
||||
#elif defined( FLM_SOLARIS) && defined( FLM_SPARC) && !defined( FLM_GNUC)
|
||||
#elif defined( FLM_SOLARIS) && defined( FLM_SPARC_PLUS) && !defined( FLM_GNUC)
|
||||
{
|
||||
return( sparc_atomic_add_32( piTarget, -1));
|
||||
}
|
||||
@@ -1335,7 +1335,7 @@ FLMINT32 FLMAPI f_atomicExchange(
|
||||
|
||||
return( (FLMINT32)iOldVal);
|
||||
}
|
||||
#elif defined( FLM_SOLARIS) && defined( FLM_SPARC) && !defined( FLM_GNUC)
|
||||
#elif defined( FLM_SOLARIS) && defined( FLM_SPARC_PLUS) && !defined( FLM_GNUC)
|
||||
{
|
||||
return( sparc_atomic_xchg_32( piTarget, i32NewVal));
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ void FLMAPI f_mutexDestroy(
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
#if defined( FLM_SOLARIS)
|
||||
#if defined( FLM_SOLARIS)
|
||||
void FLMAPI f_mutexDestroy(
|
||||
F_MUTEX * phMutex)
|
||||
{
|
||||
@@ -491,8 +491,6 @@ FINLINE int _sema_timedwait(
|
||||
unsigned int msecs)
|
||||
{
|
||||
int iErr = 0;
|
||||
struct timeval now;
|
||||
struct timespec abstime;
|
||||
|
||||
// If timeout is F_SEM_WAITFOREVER, do sem_wait.
|
||||
|
||||
@@ -502,20 +500,26 @@ FINLINE int _sema_timedwait(
|
||||
return( iErr);
|
||||
}
|
||||
|
||||
gettimeofday( &now, NULL);
|
||||
abstime.tv_sec = now.tv_sec + ((msecs) ? (msecs / 1000) : 0);
|
||||
abstime.tv_nsec = ( now.tv_usec + ((msecs % 1000) * 1000)) * 1000;
|
||||
|
||||
Restart:
|
||||
|
||||
if( (iErr = sema_timedwait( pSem, &abstime)) != 0)
|
||||
for( ;;)
|
||||
{
|
||||
if( iErr == EINTR)
|
||||
if( (iErr = sema_trywait( pSem)) != 0)
|
||||
{
|
||||
iErr = 0;
|
||||
goto Restart;
|
||||
if( iErr == EINTR)
|
||||
{
|
||||
iErr = 0;
|
||||
}
|
||||
|
||||
f_sleep( f_min( msecs, 10));
|
||||
msecs -= f_min( msecs, 10);
|
||||
|
||||
if( !msecs)
|
||||
{
|
||||
iErr = -1;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Exit:
|
||||
@@ -605,11 +609,11 @@ RCODE f_semWait(
|
||||
|
||||
f_assert( hSem != F_SEM_NULL);
|
||||
|
||||
//catch the F_SEM_WAITFOREVER flag so we can directly call _sema_wait
|
||||
//instead of passing F_SEM_WAITFOREVER through to _sema_timedwait.
|
||||
//Note that on AIX the datatype of the uiTimeout (in the timespec
|
||||
//struct) is surprisingly a signed int, which makes this catch
|
||||
//essential.
|
||||
// Catch the F_SEM_WAITFOREVER flag so we can directly call _sema_wait
|
||||
// instead of passing F_SEM_WAITFOREVER through to _sema_timedwait.
|
||||
// Note that on AIX the datatype of the uiTimeout (in the timespec
|
||||
// struct) is surprisingly a signed int, which makes this catch
|
||||
// essential.
|
||||
|
||||
if( uiTimeout == F_SEM_WAITFOREVER)
|
||||
{
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
/**********************************************************************
|
||||
Desc:
|
||||
**********************************************************************/
|
||||
#if defined( FLM_SOLARIS) && defined( FLM_SPARC) && !defined( FLM_GNUC)
|
||||
#if defined( FLM_SOLARIS) && defined( FLM_SPARC_PLUS) && !defined( FLM_GNUC)
|
||||
extern "C" FLMINT32 sparc_atomic_add_32(
|
||||
volatile FLMINT32 * piTarget,
|
||||
FLMINT32 iDelta);
|
||||
@@ -192,7 +192,7 @@
|
||||
/**********************************************************************
|
||||
Desc:
|
||||
**********************************************************************/
|
||||
#if defined( FLM_SOLARIS) && defined( FLM_SPARC) && !defined( FLM_GNUC)
|
||||
#if defined( FLM_SOLARIS) && defined( FLM_SPARC_PLUS) && !defined( FLM_GNUC)
|
||||
extern "C" FLMINT32 sparc_atomic_xchg_32(
|
||||
volatile FLMINT32 * piTarget,
|
||||
FLMINT32 iNewValue);
|
||||
|
||||
@@ -1693,7 +1693,7 @@ FLMUINT f_getFSBlockSize(
|
||||
/****************************************************************************
|
||||
Desc:
|
||||
****************************************************************************/
|
||||
#if defined( FLM_SOLARIS) && defined( FLM_SPARC) && !defined( FLM_GNUC)
|
||||
#if defined( FLM_SOLARIS) && defined( FLM_SPARC_PLUS) && !defined( FLM_GNUC)
|
||||
static void sparc_asm_code( void)
|
||||
{
|
||||
asm( ".align 8");
|
||||
|
||||
Reference in New Issue
Block a user