DebugNubCedarParts.mesa
Copyright Ó 1990, 1991 by Xerox Corporation. All rights reserved.
Spreitze, June 3, 1992 7:58 am PDT
Willie-s, July 24, 1992 4:03 pm PDT
DIRECTORY Atom, BootTime, Convert, List, LocalRegistration, LocalRegistryAgent, Rope, SystemNames, Termination, UnixSysCalls;
DebugNubCedarParts: CEDAR MONITOR
IMPORTS Atom, BootTime, Convert, List, LocalRegistryAgent, SystemNames, Termination, UnixSysCalls
EXPORTS LocalRegistration
= BEGIN
ROPE: TYPE ~ Rope.ROPE;
debugNubServiceName: ROPE ~ "Xerox/PARC/Cedar10(24-Jul-92)";
props: LocalRegistryAgent.PropList ¬ NIL;
svc: LocalRegistryAgent.ServiceRegistration ¬ NIL;
GetPortNum: PROC RETURNS[CARD]
= TRUSTED MACHINE CODE {"CirioNubLocalGetPort"};
Start: ENTRY PROC ~ {
ENABLE UNWIND => NULL;
port: CARD;
port ¬ GetPortNum[];
props ¬ Atom.PutPropOnList[props, $WorldStartTime, Convert.RopeFromTimeRFC822[BootTime.Get[]]];
props ¬ Atom.PutPropOnList[props, $DebugNubPort, Convert.RopeFromCard[port]];
props ¬ Atom.PutPropOnList[props, $pid, Convert.RopeFromInt[UnixSysCalls.GetPID[]]];
props ¬ Atom.PutPropOnList[props, $euid, Convert.RopeFromInt[UnixSysCalls.GetEUID[]]];
props ¬ Atom.PutPropOnList[props, $UserName, SystemNames.UserName[]];
svc ¬ LocalRegistryAgent.MaintainService[debugNubServiceName, props, 3600*1000, 1200*1000];
RETURN};
AddProps: PUBLIC ENTRY PROC [delta: LocalRegistryAgent.PropList] ~ {
ENABLE UNWIND => NULL;
FOR delta ¬ delta, delta.rest WHILE delta#NIL DO
props ¬ CONS[delta.first, props];
ENDLOOP;
IF svc#NIL THEN LocalRegistryAgent.ChangeProps[svc, props];
RETURN};
RemProps: PUBLIC ENTRY PROC [delta: LocalRegistryAgent.PropList] ~ {
ENABLE UNWIND => NULL;
prev: LocalRegistryAgent.PropList ¬ NIL;
cur: LocalRegistryAgent.PropList ¬ props;
WHILE cur#NIL DO
IF PropListMemb[cur.first, delta]
THEN {IF prev=NIL THEN props ¬ cur.rest ELSE prev.rest ¬ cur.rest}
ELSE prev ¬ cur;
cur ¬ cur.rest;
ENDLOOP;
IF svc#NIL THEN LocalRegistryAgent.ChangeProps[svc, props];
RETURN};
PropListMemb: PROC [pair: Atom.DottedPair, list: LocalRegistryAgent.PropList] RETURNS [BOOL]
~ TRUSTED {RETURN List.Memb[pair, LOOPHOLE[list]]};
Retract: PROC [data: REF ANY] ~ {
s: LocalRegistryAgent.ServiceRegistration ~ svc;
IF s#NIL THEN LocalRegistryAgent.StopService[s];
RETURN};
Start[];
Termination.CallBeforeQuitWorld[Retract];
END.