Commit ef5f65af authored by Claes Sjofors's avatar Claes Sjofors

Mac OS X runtime modifications

parent 68846391
...@@ -1967,15 +1967,15 @@ ini_ProcPrio ( ...@@ -1967,15 +1967,15 @@ ini_ProcPrio (
) )
{ {
char set[100];
pwr_dStatus(sts, status, INI__SUCCESS); pwr_dStatus(sts, status, INI__SUCCESS);
if (pp->flags.b.running) if (pp->flags.b.running)
return; return;
if (pp->flags.b.run) { if (pp->flags.b.run) {
#if defined(OS_LINUX) || defined(OS_MACOS) #if defined(OS_LINUX)
char set[100];
if (!(pp->flags.b.plc)) { if (!(pp->flags.b.plc)) {
sprintf(set, "rt_prio -rp %d %d", pp->proc.p_prio, pp->proc.pid); sprintf(set, "rt_prio -rp %d %d", pp->proc.p_prio, pp->proc.pid);
system(set); system(set);
......
...@@ -37,6 +37,7 @@ char *syi_NodeSpec (pwr_tStatus*, char*, int); ...@@ -37,6 +37,7 @@ char *syi_NodeSpec (pwr_tStatus*, char*, int);
pwr_tBoolean syi_LocalBoot (pwr_tStatus*); pwr_tBoolean syi_LocalBoot (pwr_tStatus*);
pwr_tStatus syi_UserName( char *user, int len); pwr_tStatus syi_UserName( char *user, int len);
const char *syi_Hardware(); const char *syi_Hardware();
const char *syi_OpSys();
char *syi_ProcessId(); char *syi_ProcessId();
#if defined __cplusplus #if defined __cplusplus
......
...@@ -153,6 +153,18 @@ const char *syi_Hardware() ...@@ -153,6 +153,18 @@ const char *syi_Hardware()
return hw; return hw;
} }
const char *syi_OpSys()
{
#if defined OS_LINUX
static const char opsys[] = "Linux";
#elif defined OS_MACOS
static const char opsys[] = "MacOS";
#else
static const char opsys[] = "Unknown";
#endif
return opsys;
}
char *syi_ProcessId() char *syi_ProcessId()
{ {
static char pidstr[40]; static char pidstr[40];
......
...@@ -153,6 +153,18 @@ const char *syi_Hardware() ...@@ -153,6 +153,18 @@ const char *syi_Hardware()
return hw; return hw;
} }
const char *syi_OpSys()
{
#if defined OS_LINUX
static const char opsys[] = "Linux";
#elif defined OS_MACOS
static const char opsys[] = "MacOS";
#else
static const char opsys[] = "Unknown";
#endif
return opsys;
}
char *syi_ProcessId() char *syi_ProcessId()
{ {
static char pidstr[40]; static char pidstr[40];
......
...@@ -113,6 +113,7 @@ qos_WaitQueOld ( ...@@ -113,6 +113,7 @@ qos_WaitQueOld (
#endif #endif
#if 0
pwr_tBoolean pwr_tBoolean
qos_WaitQue ( qos_WaitQue (
pwr_tStatus *status, pwr_tStatus *status,
...@@ -164,6 +165,68 @@ qos_WaitQue ( ...@@ -164,6 +165,68 @@ qos_WaitQue (
return signal; return signal;
} }
#endif
pwr_tBoolean
qos_WaitQue (
pwr_tStatus *status,
qdb_sQue *qp,
int tmo
)
{
struct timespec ts;
int remaining_time = tmo;
int delta = 100;
ts.tv_sec = 0;
qdb_AssumeLocked;
qp->lock.waiting = TRUE;
qdb_Unlock;
if ( tmo == -1) {
ts.tv_nsec = delta * 1000000;
while (1) {
if ( !qp->lock.waiting) {
*status = QCOM__SUCCESS;
qdb_Lock;
return 1;
}
nanosleep( &ts, 0);
}
}
else {
while (1) {
if ( !qp->lock.waiting) {
*status = QCOM__SUCCESS;
qdb_Lock;
return 1;
}
if ( !remaining_time) {
/* Timeout */
*status = QCOM__TMO;
qdb_Lock;
return 0;
}
if ( remaining_time <= delta) {
ts.tv_nsec = remaining_time * 1000000;
remaining_time = 0;
}
else {
ts.tv_nsec = delta * 1000000;
remaining_time -= delta;
}
nanosleep( &ts, 0);
}
}
return 0;
}
#if 0 #if 0
...@@ -196,6 +259,19 @@ qos_SignalQueOld ( ...@@ -196,6 +259,19 @@ qos_SignalQueOld (
#endif #endif
pwr_tStatus
qos_SignalQue (
pwr_tStatus *status,
qdb_sQue *qp
)
{
pwr_dStatus (sts, status, QCOM__SUCCESS);
qp->lock.waiting = FALSE;
return TRUE;
}
#if 0
pwr_tStatus pwr_tStatus
qos_SignalQue ( qos_SignalQue (
pwr_tStatus *status, pwr_tStatus *status,
...@@ -216,6 +292,7 @@ qos_SignalQue ( ...@@ -216,6 +292,7 @@ qos_SignalQue (
return TRUE; return TRUE;
} }
#endif
qdb_sQlock * qdb_sQlock *
......
...@@ -297,8 +297,8 @@ scan ( ...@@ -297,8 +297,8 @@ scan (
sem_wait(&tp->ScanSem); sem_wait(&tp->ScanSem);
#elif defined OS_MACOS #elif defined OS_MACOS
struct timespec ts; struct timespec ts;
ts.tv_sec = tp->sync_time.tv_sec; ts.tv_sec = delta.tv_sec;
ts.tv_nsec = tp->sync_time.tv_nsec; ts.tv_nsec = delta.tv_nsec;
nanosleep(&ts, NULL); nanosleep(&ts, NULL);
#else #else
/* REMARK /* REMARK
......
...@@ -1258,8 +1258,10 @@ qdb_AddQue ( ...@@ -1258,8 +1258,10 @@ qdb_AddQue (
pthread_condattr_setpshared(&condattr, PTHREAD_PROCESS_SHARED); pthread_condattr_setpshared(&condattr, PTHREAD_PROCESS_SHARED);
pthread_mutexattr_init(&mutexattr); pthread_mutexattr_init(&mutexattr);
pthread_mutexattr_setpshared(&mutexattr, PTHREAD_PROCESS_SHARED); pthread_mutexattr_setpshared(&mutexattr, PTHREAD_PROCESS_SHARED);
pthread_mutex_init(&qp->lock.mutex, &mutexattr); if ( pthread_mutex_init(&qp->lock.mutex, &mutexattr) != 0)
pthread_cond_init(&qp->lock.cond, &condattr); errh_Error("pthread_mutex_init, errno %d", errno);
if ( pthread_cond_init(&qp->lock.cond, &condattr) != 0)
errh_Error("pthread_cond_init, errno %d", errno);
qp = hash_Insert(sts, &qdb->qix_ht, qp); qp = hash_Insert(sts, &qdb->qix_ht, qp);
......
...@@ -136,7 +136,7 @@ realclean : clean $(clean_h_includes) $(clean_hpp_includes) clean_dirs ...@@ -136,7 +136,7 @@ realclean : clean $(clean_h_includes) $(clean_hpp_includes) clean_dirs
$(export_exe) : $(link_rule) $(export_obj) $(objects) $(export_exe) : $(link_rule) $(export_obj) $(objects)
@ $(log_link_exe) @ $(log_link_exe)
$(link) @ $(link)
# This is for Lynx 2.5 map files, it doesn't work for Linux. ML # This is for Lynx 2.5 map files, it doesn't work for Linux. ML
......
...@@ -146,6 +146,7 @@ main() ...@@ -146,6 +146,7 @@ main()
int found; int found;
string oname; string oname;
string hw; string hw;
string os;
verify(0); verify(0);
...@@ -154,6 +155,7 @@ main() ...@@ -154,6 +155,7 @@ main()
dv_sim_qbus = get_pwr_config( "defaultSimulationQbus"); dv_sim_qbus = get_pwr_config( "defaultSimulationQbus");
hw = GetHardware(); hw = GetHardware();
os = GetOpSys();
if ( ! EditMode()) if ( ! EditMode())
MessageDialog("Error", "Enter edit mode before starting wizard"); MessageDialog("Error", "Enter edit mode before starting wizard");
...@@ -542,11 +544,17 @@ page_4: ...@@ -542,11 +544,17 @@ page_4:
attr = name + ".NodeName"; attr = name + ".NodeName";
SetAttribute( attr, node_name[i]); SetAttribute( attr, node_name[i]);
attr = name + ".OperatingSystem"; attr = name + ".OperatingSystem";
if ( hw == "x86_64") if ( os == "Linux")
SetAttribute( attr, 128); if ( hw == "x86_64")
else SetAttribute( attr, 128);
SetAttribute( attr, 64); else
SetAttribute( attr, 64);
endif
endif endif
if ( os == "MacOS")
SetAttribute( attr, 256);
endif
attr = name + ".Address"; attr = name + ".Address";
SetAttribute( attr, node_ip[i]); SetAttribute( attr, node_ip[i]);
if ( !node_disdistr[i]) if ( !node_disdistr[i])
......
...@@ -54,6 +54,7 @@ main() ...@@ -54,6 +54,7 @@ main()
string oname; string oname;
string current_node; string current_node;
string hw; string hw;
string os;
verify(0); verify(0);
...@@ -62,6 +63,7 @@ main() ...@@ -62,6 +63,7 @@ main()
rv_opmaintenance = get_pwr_config( "defaultOpMaintenance"); rv_opmaintenance = get_pwr_config( "defaultOpMaintenance");
hw = GetHardware(); hw = GetHardware();
os = GetOpSys();
if ( ! EditMode()) if ( ! EditMode())
MessageDialog("Error", "Enter edit mode before starting wizard"); MessageDialog("Error", "Enter edit mode before starting wizard");
...@@ -132,10 +134,15 @@ page_4: ...@@ -132,10 +134,15 @@ page_4:
# Create objects # Create objects
str1 = volume + ":"; str1 = volume + ":";
if ( hw == "x86_64") if ( os == "Linux")
set attr/name='str1'/attr=OperatingSystem/value=128/nolog/noconf if ( hw == "x86_64")
else set attr/name='str1'/attr=OperatingSystem/value=128/nolog/noconf
set attr/name='str1'/attr=OperatingSystem/value=64/nolog/noconf else
set attr/name='str1'/attr=OperatingSystem/value=64/nolog/noconf
endif
endif
if ( os == "MacOS")
set attr/name='str1'/attr=OperatingSystem/value=256/nolog/noconf
endif endif
if ( rv_nodehierroot != "") if ( rv_nodehierroot != "")
......
...@@ -1108,6 +1108,24 @@ static int wccm_stringtoobjectname_func( ...@@ -1108,6 +1108,24 @@ static int wccm_stringtoobjectname_func(
return 1; return 1;
} }
static int wccm_getopsys_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
if ( arg_count != 0)
return CCM__ARGMISM;
strcpy( return_string, syi_OpSys());
*return_decl = CCM_DECL_STRING;
return 1;
}
static int wccm_gethardware_func( static int wccm_gethardware_func(
void *filectx, void *filectx,
ccm_sArg *arg_list, ccm_sArg *arg_list,
...@@ -1200,6 +1218,8 @@ int wccm_register( ...@@ -1200,6 +1218,8 @@ int wccm_register(
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
sts = ccm_register_function( "GetHardware", wccm_gethardware_func); sts = ccm_register_function( "GetHardware", wccm_gethardware_func);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
sts = ccm_register_function( "GetOpSys", wccm_getopsys_func);
if ( EVEN(sts)) return sts;
sts = ccm_create_external_var( "cmd_status", CCM_DECL_INT, 0, 1, sts = ccm_create_external_var( "cmd_status", CCM_DECL_INT, 0, 1,
NULL); NULL);
......
...@@ -772,7 +772,7 @@ int Wtt::set_edit() ...@@ -772,7 +772,7 @@ int Wtt::set_edit()
case ldh_cUserDatabaseVolume: case ldh_cUserDatabaseVolume:
// Privilege Administrator required // Privilege Administrator required
if ( !(CoLogin::privilege() & pwr_mPrv_Administrator)) { if ( !(CoLogin::privilege() & pwr_mPrv_Administrator)) {
message( 'E', "User is not authorized to administrate"); message( 'E', "User is not authorized to administrate. Login with command \"login/adm\"");
return 1; return 1;
} }
break; break;
...@@ -951,7 +951,7 @@ void Wtt::activate_print() ...@@ -951,7 +951,7 @@ void Wtt::activate_print()
dcli_translate_filename( filename, filename); dcli_translate_filename( filename, filename);
focused_wnav->print( filename); focused_wnav->print( filename);
#if defined OS_LINUX #if defined OS_LINUX || defined OS_MACOS
sprintf( cmd, "wb_gre_print.sh %s", filename); sprintf( cmd, "wb_gre_print.sh %s", filename);
sts = system( cmd); sts = system( cmd);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment