Commit ef5f65af authored by Claes Sjofors's avatar Claes Sjofors

Mac OS X runtime modifications

parent 68846391
......@@ -1967,15 +1967,15 @@ ini_ProcPrio (
)
{
char set[100];
pwr_dStatus(sts, status, INI__SUCCESS);
if (pp->flags.b.running)
return;
if (pp->flags.b.run) {
#if defined(OS_LINUX) || defined(OS_MACOS)
#if defined(OS_LINUX)
char set[100];
if (!(pp->flags.b.plc)) {
sprintf(set, "rt_prio -rp %d %d", pp->proc.p_prio, pp->proc.pid);
system(set);
......
......@@ -37,6 +37,7 @@ char *syi_NodeSpec (pwr_tStatus*, char*, int);
pwr_tBoolean syi_LocalBoot (pwr_tStatus*);
pwr_tStatus syi_UserName( char *user, int len);
const char *syi_Hardware();
const char *syi_OpSys();
char *syi_ProcessId();
#if defined __cplusplus
......
......@@ -153,6 +153,18 @@ const char *syi_Hardware()
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()
{
static char pidstr[40];
......
......@@ -153,6 +153,18 @@ const char *syi_Hardware()
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()
{
static char pidstr[40];
......
......@@ -113,6 +113,7 @@ qos_WaitQueOld (
#endif
#if 0
pwr_tBoolean
qos_WaitQue (
pwr_tStatus *status,
......@@ -164,6 +165,68 @@ qos_WaitQue (
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
......@@ -196,6 +259,19 @@ qos_SignalQueOld (
#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
qos_SignalQue (
pwr_tStatus *status,
......@@ -216,6 +292,7 @@ qos_SignalQue (
return TRUE;
}
#endif
qdb_sQlock *
......
......@@ -297,8 +297,8 @@ scan (
sem_wait(&tp->ScanSem);
#elif defined OS_MACOS
struct timespec ts;
ts.tv_sec = tp->sync_time.tv_sec;
ts.tv_nsec = tp->sync_time.tv_nsec;
ts.tv_sec = delta.tv_sec;
ts.tv_nsec = delta.tv_nsec;
nanosleep(&ts, NULL);
#else
/* REMARK
......
......@@ -1258,8 +1258,10 @@ qdb_AddQue (
pthread_condattr_setpshared(&condattr, PTHREAD_PROCESS_SHARED);
pthread_mutexattr_init(&mutexattr);
pthread_mutexattr_setpshared(&mutexattr, PTHREAD_PROCESS_SHARED);
pthread_mutex_init(&qp->lock.mutex, &mutexattr);
pthread_cond_init(&qp->lock.cond, &condattr);
if ( pthread_mutex_init(&qp->lock.mutex, &mutexattr) != 0)
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);
......
......@@ -136,7 +136,7 @@ realclean : clean $(clean_h_includes) $(clean_hpp_includes) clean_dirs
$(export_exe) : $(link_rule) $(export_obj) $(objects)
@ $(log_link_exe)
$(link)
@ $(link)
# This is for Lynx 2.5 map files, it doesn't work for Linux. ML
......
......@@ -146,6 +146,7 @@ main()
int found;
string oname;
string hw;
string os;
verify(0);
......@@ -154,6 +155,7 @@ main()
dv_sim_qbus = get_pwr_config( "defaultSimulationQbus");
hw = GetHardware();
os = GetOpSys();
if ( ! EditMode())
MessageDialog("Error", "Enter edit mode before starting wizard");
......@@ -542,11 +544,17 @@ page_4:
attr = name + ".NodeName";
SetAttribute( attr, node_name[i]);
attr = name + ".OperatingSystem";
if ( hw == "x86_64")
SetAttribute( attr, 128);
else
SetAttribute( attr, 64);
if ( os == "Linux")
if ( hw == "x86_64")
SetAttribute( attr, 128);
else
SetAttribute( attr, 64);
endif
endif
if ( os == "MacOS")
SetAttribute( attr, 256);
endif
attr = name + ".Address";
SetAttribute( attr, node_ip[i]);
if ( !node_disdistr[i])
......
......@@ -54,6 +54,7 @@ main()
string oname;
string current_node;
string hw;
string os;
verify(0);
......@@ -62,6 +63,7 @@ main()
rv_opmaintenance = get_pwr_config( "defaultOpMaintenance");
hw = GetHardware();
os = GetOpSys();
if ( ! EditMode())
MessageDialog("Error", "Enter edit mode before starting wizard");
......@@ -132,10 +134,15 @@ page_4:
# Create objects
str1 = volume + ":";
if ( hw == "x86_64")
set attr/name='str1'/attr=OperatingSystem/value=128/nolog/noconf
else
set attr/name='str1'/attr=OperatingSystem/value=64/nolog/noconf
if ( os == "Linux")
if ( hw == "x86_64")
set attr/name='str1'/attr=OperatingSystem/value=128/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
if ( rv_nodehierroot != "")
......
......@@ -1108,6 +1108,24 @@ static int wccm_stringtoobjectname_func(
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(
void *filectx,
ccm_sArg *arg_list,
......@@ -1200,6 +1218,8 @@ int wccm_register(
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "GetHardware", wccm_gethardware_func);
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,
NULL);
......
......@@ -772,7 +772,7 @@ int Wtt::set_edit()
case ldh_cUserDatabaseVolume:
// Privilege Administrator required
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;
}
break;
......@@ -951,7 +951,7 @@ void Wtt::activate_print()
dcli_translate_filename( filename, filename);
focused_wnav->print( filename);
#if defined OS_LINUX
#if defined OS_LINUX || defined OS_MACOS
sprintf( cmd, "wb_gre_print.sh %s", filename);
sts = system( cmd);
#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