Camelot.mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Bob Hagmann September 29, 1988 1:45:50 pm 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 (1:0..0): BOOLFALSE,
serverBased (1:1..1): BOOLFALSE,
reserved (1:2..7): CARD [0..64) ← 0,
randomBits (1:8..23): INT16 ← 0,
highTicker (1:24..31): CARD[0..256) ← 0,
lowTicker (2: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 (100001), ttOvnvStandard (100002), ttNvHybridatomic (100003), ttNvStandard (100004), ttOvnvServerBased (100005), ttNvServerBased (100006)};
protocolTypeT: TYPE = MACHINE DEPENDENT {ptTwoPhased (100001), ptNonBlocking (100002), ptLazy (100003)};
voteT: TYPE = MACHINE DEPENDENT {voteYes (100001), voteNo (100002), voteReadOnly (100003)};
DSQUEUESIZE: INT = ((4*4096-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 (100001), tsPrepared (100002), tsCommitted (100003), tsAborted (100004)};
ObjectNameLength: INT = 80;
objectNameT: TYPE = RECORD[
name: PACKED ARRAY [0..ObjectNameLength) OF CHAR
];
Error codes: classes and codes
ErClassMask: WORD = 0FFFF0000h;
ErCodeMask: WORD = 00000FFFFh;
ServFailure: WORD = 07f1fch; -- Generic server failure
ErMigErrorCode: INT =  (-1 * 2**16);
ErMachErrorCode: INT =  (0 * 2**16);
ErCamelotErrorCode: INT =  (2 * 2**16);
ErUserAbortCode: INT =  (3 * 2**16);
ErSystemAbortCode: INT =  (4 * 2**16);
ErRestrictedUserAbortCode: INT = (5 * 2**16);
ErNonAbortingExceptionCode: INT = (6 * 2**16);
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.
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.