Camelot.mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Bob Hagmann May 4, 1989 9:42:33 am PDT
This interface is to the "Primitive Camelot Interface." See the Guide to the Camelot Distributed Transaction Facility for the proper release.
Procedures in this interface are intended to be the same as the procedures as in Camelot, except that underscores are missing from the names and the case has been adjusted. The calling sequences have been massaged to conform to Cedar. For example, OUT variables for Camelot are return arguments in Cedar.
Most calls have a raiseSignal argument. If set TRUE, then any return from the underlying Camelot code except KernSuccess will cause a SIGNAL Mach.MachCall. In any event, the kernel return code is returned in kernCode (whether it really came from the kernel or not).
DIRECTORY
Mach,
Rope;
Camelot: CEDAR DEFINITIONS
~ BEGIN
Common data types
CAMELOTSTRINGLENGTH: INT = 256;
camelotStringT: TYPE = PACKED ARRAY [0..CAMELOTSTRINGLENGTH) OF CHAR;
serverIdT: TYPE = RECORD [value: CARD16];
applicationIdT: TYPE = RECORD [value: INT32];
segmentIdT: TYPE = RECORD [value: CARD16];
uChar: TYPE = CHAR;
uInt: TYPE = CARD32;
segmentDescT: TYPE = RECORD [
serverId: serverIdT,
segmentId: segmentIdT,
logicalDisk: uChar,
unused: uChar,
highSize: CARD16,
lowSize: CARD32
];
segmentDescListT: TYPE = POINTER TO segmentDescT;
ListOfSegmentDesc: TYPE = LIST OF segmentDescT;
optrT: TYPE = RECORD [
segmentId: segmentIdT,
highOffset: CARD16,
lowOffset: CARD32
];
lsnT: TYPE = RECORD [
high: uInt,
low: uInt
];
nodeIdT: TYPE = RECORD [value: CARD32 ← 0];
btidT: TYPE = MACHINE DEPENDENT RECORD [
nodeId(0): nodeIdT,
ovnv (2:0..0): BOOLFALSE,
serverBased (2:1..1): BOOLFALSE,
reserved (2:2..7): CARD [0..64) ← 0,
randomBitsHigh (2:8..15): BYTE ← 0,
randomBits (2:16..23): BYTE ← 0,
highTicker (2:24..31): CARD[0..256) ← 0,
lowTicker (4:0..31): CARD ← 0
];
tidT: TYPE = RECORD [
top: btidT,
bottom: btidT
];
tidListT: TYPE = LONG POINTER TO tidT;
TIDARRAYSIZE: INT = 10;
tidArrayT: TYPE = ARRAY [0..TIDARRAYSIZE) OF tidT;
lamportClockT: TYPE = RECORD [
high: CARD32,
low: CARD32
];
timestampT: TYPE = RECORD [
time: lamportClockT,
nodeId: nodeIdT
];
transactionTypeT: TYPE = MACHINE DEPENDENT {ttOvnvHybridatomic (1), ttOvnvStandard (2), ttNvHybridatomic (3), ttNvStandard (4), ttOvnvServerBased (5), ttNvServerBased (6)};
protocolTypeT: TYPE = MACHINE DEPENDENT {ptTwoPhased (1), ptNonBlocking (2), ptLazy (3)};
voteT: TYPE = MACHINE DEPENDENT {voteYes (1), voteNo (2), voteReadOnly (3)};
DSQUEUESIZE: INT = ((1024-3*SIZE[uInt])/SIZE[uInt]);
dsQueueT: TYPE = RECORD [
head: uInt,
tail: uInt,
unused: uInt,
queue: ARRAY [0..DSQUEUESIZE) OF uInt
];
transactionState: TYPE = MACHINE DEPENDENT {tsActive (1), tsPrepared (2), tsCommitted (3), tsAborted (4)};
ObjectNameLength: INT = 80;
objectNameT: TYPE = RECORD[
name: PACKED ARRAY [0..ObjectNameLength) OF CHAR
];
Error codes: classes and codes
ErClassMask: CARD32 = 0FFFF0000h;
ErCodeMask: WORD = 00000FFFFh;
ServFailure: CARD32 = 07f1fch; -- Generic server failure
TwoToTheSixteen: INT = 65536;
ErMigErrorCode: INT =  (-1 * TwoToTheSixteen);
ErMachErrorCode: INT =  (0 * TwoToTheSixteen);
ErCamelotErrorCode: INT =  (2 * TwoToTheSixteen);
ErUserAbortCode: INT =  (3 * TwoToTheSixteen);
ErSystemAbortCode: INT =  (4 * TwoToTheSixteen);
ErRestrictedUserAbortCode: INT = (5 * TwoToTheSixteen);
ErNonAbortingExceptionCode: INT = (6 * TwoToTheSixteen);
ErSuccess: INT =   Mach.KernSuccess;
ErFailure: INT =   (ErCamelotErrorCode + 0);
ErBadPort: INT =   (ErCamelotErrorCode + 1);
ErBadTid: INT =   (ErCamelotErrorCode + 2);
ErBadUserName: INT =  (ErCamelotErrorCode + 3);
ErBadPassword: INT =   (ErCamelotErrorCode + 4);
ErBadPrivileges: INT =  (ErCamelotErrorCode + 5);
ErTooManyConnections: INT =  (ErCamelotErrorCode + 6);
ErEntryExists: INT =   (ErCamelotErrorCode + 7);
ErNoEntry: INT =   (ErCamelotErrorCode + 8);
ErTooManyEntries: INT =  (ErCamelotErrorCode + 9);
ErEntryBusy: INT =   (ErCamelotErrorCode + 10);
ErTidSuspended: INT =  (ErCamelotErrorCode + 11);
ErBadValue: INT =   (ErCamelotErrorCode + 12);
ErBadOptr: INT =   (ErCamelotErrorCode + 13);
ErRunningRecovery: INT =  (ErCamelotErrorCode + 14);
ErNotPinned: INT =   (ErCamelotErrorCode + 15);
ErBadLength: INT =   (ErCamelotErrorCode + 16);
ErWaitingTransAborted: INT = (ErCamelotErrorCode + 17);
ErBadProtocol: INT =   (ErCamelotErrorCode + 18);
ErApplNotFound: INT =  (ErCamelotErrorCode + 19);
ErTransNotFound: INT =  (ErCamelotErrorCode + 20);
ErTranmanError: INT =  (ErCamelotErrorCode + 21);
ErServerError: INT =   (ErCamelotErrorCode + 22);
ErBadTransType: INT =  (ErCamelotErrorCode + 23);
ErServerNotFound: INT =  (ErCamelotErrorCode + 24);
ErCallNotAllowed: INT =  (ErCamelotErrorCode + 25);
ErActiveChildren: INT =  (ErCamelotErrorCode + 26);
ErNotBeginner: INT =   (ErCamelotErrorCode + 27);
ErTransAlreadyAborted: INT = (ErCamelotErrorCode + 28);
ErAlreadyJoined: INT =  (ErCamelotErrorCode + 29);
ErTooManyServers: INT =  (ErCamelotErrorCode + 30);
ErPagesPinned: INT =   (ErCamelotErrorCode + 31);
ErPagesQueuedForFlush: INT = (ErCamelotErrorCode + 32);
ErNonAbortingException: INT = (ErNonAbortingExceptionCode + 33);
ErTooManyTids: INT =  (ErCamelotErrorCode + 34);
ErServerNotDown: INT =  (ErCamelotErrorCode + 35);
ErLwmMismatch: INT =   (ErCamelotErrorCode + 36);
AcIllegalAbortCode: INT =  (ErSystemAbortCode + 1);
AcCommitFailed: INT =  (ErSystemAbortCode + 2);
AcServerDied: INT =   (ErSystemAbortCode + 5);
AcApplicationDied: INT =  (ErSystemAbortCode + 6);
AcAncestorAborted: INT =  (ErSystemAbortCode + 8);
AcCommittedChildAborted: INT = (ErSystemAbortCode + 9);
AcLongRunning: INT =   (ErSystemAbortCode + 10);
Camelot and Camlib message types
camelotMsgT: TYPE = RECORD [
head: Mach.msgHeaderT,
retcodeType: Mach.msgTypeT,
retcode: Mach.kernReturnT,
dummyType: Mach.msgTypeT,
dummy: Mach.caddrT,
tidType: Mach.msgTypeT,
tid: tidT
];
camlibMsgT: TYPE = RECORD [
hdr: camelotMsgT,
data: ARRAY [0..1000) OF INT
];
camlibSysReqMsgT: TYPE = RECORD [
head: Mach.msgHeaderT,
data: ARRAY [0..1000) OF INT
];
camlibSysRepMsgT: TYPE = RECORD [
head: Mach.msgHeaderT,
retcodetype: Mach.msgTypeT,
retcode: Mach.kernReturnT,
data: ARRAY [0..1000) OF INT
];
LockName: TYPE = RECORD [segmentId: segmentIdT, offset: vmOffsetT];
lockModeT: TYPE = RECORD [mode: INT];
LockModeRead: lockModeT = [1];
LockModeWrite: lockModeT = [2];
Recoverable Storage Management
DSInitialize: PROC [dsPort: Mach.portT, raiseSignal: BOOL] RETURNS [serverID: serverIdT, tsPort, mPort, sPort: Mach.portT, sharedMemAddr: Mach.vmAddressT, seqDescList: ListOfSegmentDesc, seqPortList: Mach.ListOfPorts, kernCode: Mach.kernReturnT];
Initialize the data server.
DSPinObject: PROC [dsPort: Mach.portT, tid: tidT, optr: optrT, size: uInt, raiseSignal: BOOL] RETURNS [kernCode: Mach.kernReturnT];
Pin an object in preparation for modification.
DSLogNewValue: PROC [dsPort: Mach.portT, tid: tidT, optr: optrT, newValue: Mach.pointerT, newValueCnt: INT, raiseSignal: BOOL] RETURNS [kernCode: Mach.kernReturnT];
Send a new value of an object to the log.
DSLogOldValueNewValue: PROC [dsPort: Mach.portT, tid: tidT, optr: optrT, oldValue: Mach.pointerT, oldValueCnt: INT, newValue: Mach.pointerT, newValueCnt: INT, raiseSignal: BOOL] RETURNS [kernCode: Mach.kernReturnT];
Send a new value of an object to the log.
DSPrepare: PROC [dsPort: Mach.portT, topBTid: btidT, prepareData: Mach.pointerT, prepareDataCnt: INT, raiseSignal: BOOL] RETURNS [kernCode: Mach.kernReturnT];
Send a new value of an object to the log.
DSQInit: PROC [sharedMemAddr: Mach.vmAddressT];
Send a new value of an object to the log.
DSQPreflush: PROC [dsPort: Mach.portT, optr: optrT, sizeInBytes: uInt];
Preflush some dirty memory.
DSQZeroFill: PROC [dsPort: Mach.portT, optr: optrT, sizeInBytes: uInt];
Zero some memory.
Transaction Management
TAAddApplication: PROC [tPort: Mach.portT, atPort: Mach.portT, authName: Rope.ROPE, raiseSignal: BOOL] RETURNS [applicationID: applicationIdT, taPort: Mach.portT, kernCode: Mach.kernReturnT];
Initialize an application to the transaction manager.
TABegin: PROC [taPort: Mach.portT, parentTid: tidT, transType: transactionTypeT, raiseSignal: BOOL] RETURNS [newTid: tidT, kernCode: Mach.kernReturnT];
Start a new transaction.
TAEnd: PROC [taPort: Mach.portT, tid: tidT, protocolType: protocolTypeT, raiseSignal: BOOL] RETURNS [timestamp: timestampT, status: INT, kernCode: Mach.kernReturnT];
Try to commit a transaction.
TAKill: PROC [taPort: Mach.portT, tid: tidT, status: INT, raiseSignal: BOOL] RETURNS [kernCode: Mach.kernReturnT] ;
Try to abort a transaction.
TDAddDataServer: PROC [tdPort: Mach.portT, serverID: serverIdT, sendPort: Mach.portT, raiseSignal: BOOL] RETURNS [rcvPort: Mach.portT, kernCode: Mach.kernReturnT];
Initialize the data server to the transaction manager.
TSJoin: PROC [tsPort: Mach.portT, tid: tidT, raiseSignal: BOOL] RETURNS [kernCode: Mach.kernReturnT];
Join an existing transaction.
Name server
CSSignIn: PROC [nameServerPort: Mach.portT, name: Rope.ROPE, port: Mach.portT, raiseSignal: BOOL] RETURNS [kernCode: Mach.kernReturnT];
Sign in as a data server.
CSSignOut: PROC [nameServerPort: Mach.portT, name: Rope.ROPE, port: Mach.portT, raiseSignal: BOOL] RETURNS [kernCode: Mach.kernReturnT];
Sign out as a data server.
CSLookup: PROC [nameServerPort: Mach.portT, name: Rope.ROPE, site: Rope.ROPE, numberWanted: INT, maxSeconds: INT, raiseSignal: BOOL] RETURNS [portList: Mach.ListOfPorts, kernCode: Mach.kernReturnT];
Lookup for servers.
CALookup: PROC [nameServerPort: Mach.portT, name: Rope.ROPE, site: Rope.ROPE, numberWanted: INT, maxSeconds: INT, raiseSignal: BOOL] RETURNS [portList: Mach.ListOfPorts, kernCode: Mach.kernReturnT];
Lookup for applications.
Locking
TSIsLockBreakable: PROC [tsPort: Mach.portT, holdingTrans: tidT, requestingTrans: tidT] RETURNS [answer: BOOL];
Test breakable lock.
TSWaitForLockToBreak: PROC [tsPort: Mach.portT, holdingTrans: tidT, requestingTrans: tidT];
Wait for breakable lock.
Lock: PROC [tid: tidT, lockName: LockName, lockMode: lockModeT];
Obtain the lock for this transaction.
TryLock: PROC [tid: tidT, lockName: LockName, lockMode: lockModeT];
Obtain the lock for this transaction if immediately available.
Unlock: PROC [tid: tidT, lockName: LockName];
Release lock for this transaction.
DemoteLock: PROC [tid: tidT, lockName: LockName];
Demote write lock to a read lock for this transaction.
END.