MakeDoCedarImpl.mesa
Copyright Ó 1988, 1991 by Xerox Corporation. All rights reserved.
Eduardo Pelegri-Llopart, March 17, 1989 9:57:18 am PST
Implementation of (P)Cedar-dependent actions
Willie-s, September 27, 1991 2:03 pm PDT
DIRECTORY
IO,
MakeDo,
MakeDoBasics,
MakeDoPorting,
Rope,
SystemNames USING [UserCedarDir],
UserProfile;
MakeDoCedarImpl: CEDAR MONITOR
IMPORTS IO, SystemNames, UserProfile
EXPORTS MakeDo, MakeDoPorting, MakeDoBasics
~
BEGIN
OPEN MakeDo;
ROPE: TYPE ~ Rope.ROPE;
NYI: ERROR;
MaxProcessAllocationDefault: INT ~ 2; -- small because of limit on number of open files!! --
File Manipulation
existsFSWatch: PUBLIC BOOL ¬ FALSE;
defaultReporter: PUBLIC ROPE ¬ "files";
logPath: PUBLIC ROPE ¬ SystemNames.UserCedarDir[NIL];
logPath: PUBLIC ROPE ← "/usr/tmp/";
verifyAttachments: PUBLIC BOOL ¬ FALSE;
StartFSWatchers:
PUBLIC PROC = {
ERROR NYI;
};
Process Execution And Forking Estimation
JobResources:
TYPE ~ MakeDoBasics.JobResources;
No real information associated in PCedar (yet)
processUse: INTEGER ¬ 0;
maxProcessUse: INTEGER ¬ 0;
processAllocation:
INTEGER ¬ 0;
processAllocation is a hard limit on the number of processes
ForkParms: TYPE ~ REF ForkParmsRep;
ForkParmsRep:
PUBLIC TYPE ~
RECORD [
pa: INT
];
Fork Enquires (need not be protected, only one going at a time?)
ShouldFork:
PUBLIC
PROC
RETURNS [fork:
BOOL, valid:
BOOL ¬
FALSE, resources: JobResources ¬
NIL] ~ {
IF processAllocation = 0
THEN {
fork ¬ FALSE;
valid ¬ TRUE;
RETURN;
};
IF processUse<processAllocation
THEN {
fork ¬ TRUE;
valid ¬ TRUE;
processUse ¬ processUse+1;
maxProcessUse ¬ MAX[maxProcessUse, processUse];
}
};
RecordAFork:
PUBLIC
PROC [jr: JobResources] ~ {
processUse ¬ processUse - 1;
};
Fork Parameter Manipulation
InnerGetForkParms:
PUBLIC
PROC
RETURNS [forkParms: ForkParms] = {
-- INNER -- already protected by MakeDoBasicImpl.GetForkParms[]
pa: NAT;
pa ¬ processAllocation;
RETURN [NEW [ForkParmsRep ¬ [pa: pa]]];
};
InnerSetForkParms:
PUBLIC
PROC [forkParms: ForkParms] ~ {
-- INNER -- already protected by MakeDoBasicImpl.GetForkParms[]
WITH forkParms
SELECT FROM
fp:
REF ForkParmsRep => {
processAllocation ¬ fp.pa;
}
ENDCASE => ERROR;
RETURN};
ForkParmsFromStream:
PUBLIC
PROC [in:
IO.
STREAM]
RETURNS [parms: ForkParms] ~ {
pa: NAT ~ in.GetInt[];
RETURN [NEW [ForkParmsRep ¬ [pa: pa]]];
};
ForkParmsFromProfile:
PUBLIC
PROC
RETURNS [ForkParms] ~ {
pa: INT ~ UserProfile.Number["MakeDo.AuxilliaryProcessAllocation", MaxProcessAllocationDefault];
RETURN [NEW [ForkParmsRep ¬ [pa: pa]]];
};
END.