<< LINES .001/.009 ARE RESERVED FOR SYSTEMS INTEGRATION>>               00000001
$PAGE  "INCLPXFL -- PXFILE Include File"                                00005000
<<***********************************************************>>         00010000
<<*                                                         *>>         00015000
<<*         INCLPXFL - PXFILE Include File                  *>>         00020000
<<*                                                         *>>         00025000
<<***********************************************************>>         00030000
COMMENT                                                                 00035000
                                                                        00040000
File System Section of PCBX (PXFILE)                                    00045000
------------------------------------                                    00050000
                                                                        00055000
The  PXFILE area is a subsection of the PCBX. It is a contiguous, expan-00060000
dable  (not  contractable,  ALTPXFILESIZE  does  not contract correctly)00065000
block  of  storage  that is managed by the file system primarily for its00070000
own  use.  Other  subsystems,  namely  CS  and  DS, also make use of the00075000
PXFILE section. In doing so, they must conform to the conventions of the00080000
the file system. The overall structure of the PXFILE area is:           00085000
                                                                        00090000
-------------------------                                               00095000
|                       |                                               00100000
|       Overhead        |     (fixed)                                   00105000
|      (%22 Words)      |                                               00110000
|                       |                                               00115000
|-----------------------|                                               00120000
|                       |                                               00125000
|     Control Block     |     (variable)                                00130000
|         Table         |                                               00135000
|                       |                                               00140000
|-----------------------|                                               00145000
|                       |                                               00150000
|       Available       |     (variable)                                00155000
|         Block         |                                               00160000
|                       |                                               00165000
|-----------------------|                                               00170000
|                       |                                               00175000
|      Active File      |     (variable)                                00180000
|        Table          |                                               00185000
|                       | DL-5                                          00190000
-------------------------                                               00195000
                                                                        00200000
Available Block Area                                                    00205000
--------------------                                                    00210000
                                                                        00215000
The  part labeled Available Block is used to provide space when the Con-00220000
trol Block Table or the Active File Table is expanded.  These two tables00225000
grow  towards each other, and when more space is needed it is simply ta-00230000
en from the Available Block.                                            00235000
                                                                        00240000
When  the Available Block is exhausted, the PXFILE area is expanded, the00245000
AFT is relocated and the new space is added to the Available Block.     00250000
;                                                                       00255000
                                                                        00260000
<<----------------------------------------------------------->>         00265000
<<                                                           >>         00270000
<<       PXFILE Overhead Definitions                         >>         00275000
<<                                                           >>         00280000
<<----------------------------------------------------------->>         00285000
                                                                        00290000
<< Find/Set ptr to PXFILE area of this stack.                >>         00295000
                                                                        00300000
DEFINE                                                                  00305000
GET'PXFILE'OFFSET = PUSH(Q,DL); ASSEMBLE(XCH,SUB);                      00310000
                    PXFILE'OFFSET := AQM1(S0)-AQM3(S0);DEL#,            00315000
FINDPXFILE      = PUSH(DL); TOS := TOS-PS0(-3)#,                        00320000
SETPXFILE       = FINDPXFILE; @PXFILE := TOS#;                          00325000
                                                                        00330000
EQUATE                                                                  00335000
PXFCBTMAX    = 8,           << Max number user (NOBUF) CBTs >>          00340000
PXFOVERHEAD  = 10+PXFCBTMAX,<< PXFILE overhead size in words >>         00345000
PXFCBTSIZEMAX=1000;         << Maximum PXFILE size allowed   >>         00350000
$PAGE                                                                   00355000
COMMENT                                                                 00360000
                                                                        00365000
PXFILE Overhead Area                                                    00370000
--------------------                                                    00375000
                                                                        00380000
The part labeled Overhead contains information that is                  00385000
pertinent to the entire table. It is addressed via the                  00390000
pointer at DL-3.                                                        00395000
                                                                        00400000
    0   1                   7   8                      15               00405000
  ---------------------------------------------------------             00410000
0 |                  PXFILE size in words                 |  0          00415000
  |-------------------------------------------------------|             00420000
1 | Last DOPEN error number   | Last COPEN error number   |  1          00425000
  |-------------------------------------------------------|             00430000
2 | N |                                                   |  2          00435000
  |-------------------------------------------------------|             00440000
3 |                    Last DE AFT                        |  3          00445000
  |-------------------------------------------------------|             00450000
4 |                    Slave AFT number                   |  4          00455000
  |-------------------------------------------------------|             00460000
5 | Last KOPEN error number   | Last FOPEN error number   |  5          00465000
  |-------------------------------------------------------|             00470000
6 |                   AFT size in words                   |  6          00475000
  |-------------------------------------------------------|             00480000
7 |                                                       |  7          00485000
  |                  CS Trace file info                   |             00490000
10|                                                       |  8          00495000
  |-------------------------------------------------------|             00500000
11|     Last responding NO-WAIT I/O AFT entry number      |  9          00505000
  |-------------------------------------------------------|             00510000
12|    1st user (NOBUF) Control Block Table DST number    | 10          00515000
  |-------------------------------------------------------|             00520000
13|    2nd user (NOBUF) Control Block Table DST number    | 11          00525000
  |-------------------------------------------------------|             00530000
14|    3rd user (NOBUF) Control Block Table DST number    | 12          00535000
  |-------------------------------------------------------|             00540000
15|    4th user (NOBUF) Control Block Table DST number    | 13          00545000
  |-------------------------------------------------------|             00550000
16|    5th user (NOBUF) Control Block Table DST number    | 14          00555000
  |-------------------------------------------------------|             00560000
17|    6th user (NOBUF) Control Block Table DST number    | 15          00565000
  |-------------------------------------------------------|             00570000
20|    7th user (NOBUF) Control Block Table DST number    | 16          00575000
  |-------------------------------------------------------|             00580000
21|    8th user (NOBUF) Control Block Table DST number    | 17          00585000
  ---------------------------------------------------------             00590000
                                                                        00595000
PXFAFTSIZE                                                              00600000
This is the size (in words) of the Active File Table. Note              00605000
that the size is in words and not in terms of number of                 00610000
entries.  The reason for this is that it simplifies the                 00615000
calculation for the size of the Available Block.                        00620000
                                                                        00625000
PXFCBT1-8                                                               00630000
These are the DST numbers of the user (NOBUF) control block             00635000
tables.  A DST number of 0 indicates that no data segment is            00640000
allocated.                                                              00645000
                                                                        00650000
PXFCOPEN                                                                00655000
This contains the last COPEN error number.  It is not used by           00660000
the file system.                                                        00665000
                                                                        00670000
PXFCTRINFO                                                              00675000
This contains information pertinent to the CS trace file. It            00680000
is not used by the file system.                                         00685000
                                                                        00690000
PXFDOPEN                                                                00695000
This contains the last DOPEN error number. It is not used by            00700000
the file system.                                                        00705000
                                                                        00710000
PXFDSINFO                                                               00715000
This cell is reserved for DS.  It is not used by the file               00720000
system.                                                                 00725000
                                                                        00730000
PXFFOPEN                                                                00735000
This contains the last FOPEN error number. If it is zero then           00740000
the last FOPEN completed successfully. If it is non-zero then           00745000
the last FOPEN completed unsuccessfully and the number                  00750000
represents the file system error number.                                00755000
                                                                        00760000
PXFKOPEN                                                                00765000
This contains the last KOPEN error number. Since KSAM is                00770000
imbedded in the file system, an FOPEN failure on a KSAM file            00775000
can be caused by a failure to open either the key file or               00780000
the data file. This error number is used in conjunction with            00785000
PXFFOPEN to determine which file caused the KSAM open failure.          00790000
Note that this error number is not used by the file system.             00795000
                                                                        00800000
PXFLEFTOFF                                                              00805000
This is the AFT entry number of the last file/line that                 00810000
completed a no-wait I/O, if zero then no no-wait I/O has                00815000
been completed.  This cell is maintained solely by and for              00820000
the IOWAIT intrinsic.                                                   00825000
                                                                        00830000
PXFNOCB                                                                 00835000
This bit is used to signify that no control blocks are to be            00840000
created in the PXFILE control block table. This bit is set by           00845000
the NOCB parameter to the CREATE intrinsic or the :RUN                  00850000
command. This feature permits the user to have as much stack            00855000
space as possible. Otherwise the file system will take                  00860000
several hundred words of stack for the PXFILE Control Block             00865000
Table.                                                                  00870000
                                                                        00875000
PXFSIZE                                                                 00880000
This is the size (in words) of the complete PXFILE area.  It            00885000
is the sum of the overhead block, the control block table, the          00890000
Available File Table and the Available Block.                           00895000
;                                                                       00900000
$PAGE                                                                   00905000
<< PXFILE Overhead Area. Use SETPXFILE or SETOTHERPXFILE to  >>         00910000
<< set up the PXFILE ptr before using these defines.         >>         00915000
                                                                        00920000
DEFINE                                                                  00925000
PXFSIZE     = PXFILE#,         << PXFILE size is 1st word    >>         00930000
PXFDOPEN    = PXFILE(1).(0:8)#,<< Last DOPEN error code      >>         00935000
PXFCOPEN    = PXFILE(1).(8:8)#,<< Last COPEN error code      >>         00940000
PXFNOCB     = LOGICAL(PXFILE(2).(0:1))#, << NOCB flag        >>         00945000
PXFDSINFO1  = PXFILE(3)#,      << Reserved for DS            >>         00950000
PXFDSINFO2  = PXFILE(4)#,      <<    "      "   "            >>         00955000
PXFKOPEN    = PXFILE(5).(0:8)#,<< Reserved for KSAM          >>         00960000
PXFFOPEN    = PXFILE(5).(8:8)#,<< Last FOPEN error code      >>         00965000
PXFAFTSIZE  = PXFILE(6)#,      << AFT size in words          >>         00970000
PXFCTRINFO1 = PXFILE(7)#,      << CS trace file info         >>         00975000
PXFCTRINFO2 = PXFILE(8)#,      <<  "   "     "    "          >>         00980000
PXFLEFTOFF  = PXFILE(9)#,      << Last responding file/line  >>         00985000
PXFCBT1     = PXFILE(10)#,     << 1st user (NOBUF) CBT DST   >>         00990000
PXFCBT2     = PXFILE(11)#,                                              00995000
PXFCBT3     = PXFILE(12)#,                                              01000000
PXFCBT4     = PXFILE(13)#,                                              01005000
PXFCBT5     = PXFILE(14)#,                                              01010000
PXFCBT6     = PXFILE(15)#,                                              01015000
PXFCBT7     = PXFILE(16)#,                                              01020000
PXFCBT8     = PXFILE(17)#;                                              01025000
                                                                        01030000
DEFINE               << These are for PXFILE in split stack.>>          01035000
QPXFAFTSIZE = AQPL6(Q'REL'PXFILE)#;                                     01040000
                                                                        01045000
                                                                        01050000
<< PXFILE CBT overhead area. (Same format as all CBTs).      >>         01055000
                                                                        01060000
DEFINE                                                                  01065000
PXFCBTAB    = PXFILE(PXFOVERHEAD)#,   << Control block table.>>         01070000
PXFCBTSIZE  = PXFILE(PXFOVERHEAD+0)#, << CB size in words.   >>         01075000
PXFDSTX     = PXFILE(PXFOVERHEAD+1)#, << CB DST number.      >>         01080000
PXFVTSIZE   = PXFILE(PXFOVERHEAD+2)#, << Vector table size.  >>         01085000
PXFCONTROL  = PXFILE(PXFOVERHEAD+3)#, << CB table lock word. >>         01090000
PXFPIN      = PXFILE(PXFOVERHEAD+4)#, << CB table lock PIN.  >>         01095000
PXFHEAD     = PXFILE(PXFOVERHEAD+5)#, << CB table impede head>>         01100000
PXFTAIL     = PXFILE(PXFOVERHEAD+6)#, << CB table impede tail>>         01105000
PXFUNUSED   = PXFILE(PXFOVERHEAD+7)#, << Unused word.        >>         01110000
PXFVT       = PXFILE(PXFOVERHEAD+CBTOVERHEAD)#; << VT start. >>         01115000
                                                                        01120000
<<----------------------------------------------------------->>         01125000
<<                                                           >>         01130000
<<       Control Block Definitions                           >>         01135000
<<                                                           >>         01140000
<<----------------------------------------------------------->>         01145000
                                                                        01150000
EQUATE                                                                  01155000
                                                                        01160000
<< Maximum sizes of any CBT.                                 >>         01165000
                                                                        01170000
FSEGINIT    = 720,  << DST CBT initial size - no buffers     >>         01175000
FSEGMAX     = 5120, << DST CBT maximum size - no buffers     >>         01180000
FSEGBUFMAX  = 8192, << DST CBT maximum size - buffers        >>         01185000
                                                                        01190000
CBTOVERHEAD = 8;    << Control Block Table overhead (words). >>         01195000
                                                                        01200000
INTEGER                                                                 01205000
FSSIZE   = DB+0,           << F.S. table size in words       >>         01210000
FSDSTX   = DB+1,           << F.S. table DST number          >>         01215000
FSVTSIZE = DB+2,           << Vector table size in words     >>         01220000
FSCONTROL= DB+3,           << F.S. control lock word         >>         01225000
FSPIN    = DB+4,           << PIN that has table locked.     >>         01230000
FSHEAD   = DB+5,           << F.S. table impeded queue       >>         01235000
FSTAIL   = DB+6,                                                        01240000
FSUNUSED = DB+7,           << Unused                         >>         01245000
FSVT     = DB+CBTOVERHEAD; << Begining of Vector Table.      >>         01250000
                                                                        01255000
COMMENT                                                                 01260000
                                                                        01265000
VECTOR FORMAT                                                           01270000
------ ------                                                           01275000
 0             5 6                           15                         01280000
|----------------------------------------------|                        01285000
|         DST OF FILE SYSTEM TABLE             |                        01290000
|----------------------------------------------|                        01295000
|         VECTOR TABLE ENTRY NUMBER            |                        01300000
------------------------------------------------                        01305000
                                                                        01310000
;                                                                       01315000
$PAGE                                                                   01320000
<<----------------------------------------------------------->>         01325000
<<                                                           >>         01330000
<<     Control Block Table (CBTAB) Definitions               >>         01335000
<<                                                           >>         01340000
<<----------------------------------------------------------->>         01345000
COMMENT                                                                 01350000
                                                                        01355000
Control Block Table                                                     01360000
-------------------                                                     01365000
                                                                        01370000
A  Control  Block  Table  will  exist in the PXFILE iff the user did NOT01375000
NOCB  on  the  :RUN  command  or CREATE intrinsic.  The format of a Con-01380000
trol  Block  Table  is  exactly  the  same  whether it lives in an extra01385000
data  segment  or  the PXFILE area of the stack.  The only difference is01390000
that  CBT  addressing  is  slightly more complicated in the PXFILE since01395000
since  the table does not begin at DB+0. As a result all pointers within01400000
the  table are table relative, the starting address of the table must be01405000
added  to  a  pointer  to  generate  a  final DB-relative address.  This01410000
addressing  convention is consistently applied to all file control block01415000
tables.                                                                 01420000
                                                                        01425000
The  first 8 words in the CBT are the Overhead area and contain informa-01430000
tion  pertaining to the entire table.  The Vector Table Area is set when01435000
the  control block is created and can expand into the control block area01440000
only  if the first control block is a "garbage" control block.  The con-01445000
trol  block  area  will  expand  until expansion can no longer be accom-01450000
plished.                                                                01455000
                                                                        01460000
  0        2        6   7                             15                01465000
----------------------------------------------------------              01470000
|               Table size in words                      | 0            01475000
|--------------------------------------------------------|              01480000
|         DST number containing this table               | 1            01485000
|--------------------------------------------------------|              01490000
|  Type  |          Vector Table size in words           | 2            01495000
|--------------------------------------------------------|              01500000
|  L |                                                   | 3            01505000
|--------------------------------------------------------|              01510000
|                    Lock PIN                            | 4            01515000
|--------------------------------------------------------|              01520000
|               Impeded queue head                       | 5            01525000
|--------------------------------------------------------|              01530000
|               Impeded queue tail                       | 6            01535000
|--------------------------------------------------------|              01540000
|                      Unused                            | 7            01545000
|--------------------------------------------------------|              01550000
|                                                        | 8            01555000
|                                                        |              01560000
|                   Vector Table                         |              01565000
|                                                        |              01570000
|                                                        |              01575000
|--------------------------------------------------------|              01580000
|                                                        |              01585000
|                                                        |              01590000
|                                                        |              01595000
|                 Control Block Area                     |              01600000
|                                                        |              01605000
|                                                        |              01610000
|                                                        |              01615000
----------------------------------------------------------              01620000
                                                                        01625000
CBTAB                                                                   01630000
This is the first word of the control block table.  In general          01635000
this is used only when referring to the entire control block            01640000
table.                                                                  01645000
                                                                        01650000
CBTSIZE                                                                 01655000
This is the size in words of the control block table. It                01660000
is initialized when the table is created and changed when               01665000
the table is expanded. At present, control block tables                 01670000
are never contracted, even though it would be possible.                 01675000
                                                                        01680000
CBTDSTX                                                                 01685000
This is the DST number of the data segment that contains the            01690000
control block table. If the CBT is in the PXFILE area, then             01695000
this is the same as the DST number of the stack.                        01700000
                                                                        01705000
CBTCONTROL                                                              01710000
This is the control word for locking the control block table.           01715000
                                                                        01720000
CBTLOCK                                                                 01725000
This bit is on if the control block table is locked.                    01730000
                                                                        01735000
CBTPIN                                                                  01740000
This is the number of the PIN that currently has the control            01745000
block table locked.                                                     01750000
                                                                        01755000
CBTTAIL                                                                 01760000
This is the PIN number of the tail of the queue waiting for the         01765000
control block table.                                                    01770000
                                                                        01775000
CBTHEAD                                                                 01780000
This is the PIN number at the head of the wait queue.                   01785000
                                                                        01790000
CBTVT                                                                   01795000
This is the first word of the vector table.  It is used when            01800000
referring to the vector table in general.                               01805000
                                                                        01810000
CBTVTSIZE                                                               01815000
This is the size, in words, of the vector table.  Note that             01820000
this is the length of the table and does not reflect the number         01825000
of entries used or unused.                                              01830000
                                                                        01835000
CBTTYPE                                                                 01840000
This field is the type of CBT. Possible values are:                     01845000
     0 - stack (PXFILE)                                                 01850000
     1 - NOBUF (expandable)                                             01855000
     2 - System shared FCB                                              01860000
     3 - Buffered (contains a single PACB with buffers)                 01865000
;                                                                       01870000
$PAGE                                                                   01875000
                                                                        01880000
<< Number of Vector entries for the different types of CBTs. >>         01885000
                                                                        01890000
EQUATE                                                                  01895000
CBTVT1      = 16,          << # initial VT entries - PXFILE  >>         01900000
CBTVT2      = 64,          << # initial VT entries - user    >>         01905000
CBTVT3      = 64,          << # initial VT entries - system  >>         01910000
CBTVT4      = 1;           << # initial VT entries - buf. ACB>>         01915000
                                                                        01920000
<< General CBT defines, CBTAB already pointing to CBT.       >>         01925000
                                                                        01930000
DEFINE                                                                  01935000
CBTSIZE    = CBTAB(0)#,        << CBT size in words        >>           01940000
CBTDSTX    = CBTAB(1)#,        << CBT DST number           >>           01945000
CBTVTSIZE  = CBTAB(2).(2:14)#, << Vector table size (words)>>           01950000
CBTTYPEF   = CBTAB(2).(0:2)#,  << Type of CBT              >>           01955000
CBTCONTROL = CBTAB(3)#,        << CBT lock word            >>           01960000
CBTLOCK'BIT= CBTCONTROL.(1:1)#,<< Set to 1 if CBT locked.  >>           01965000
CBTLOCK    = LOG(CBTLOCK'BIT)#,<< For testing lock bit.    >>           01970000
CBTPIN     = CBTAB(4)#,        << PIN that has CBT locked. >>           01975000
CBTHEAD    = CBTAB(5)#,        << CBT impeded queue head   >>           01980000
CBTTAIL    = CBTAB(6)#,        << CBT impeded queue tail   >>           01985000
CBTUNUSED  = CBTAB(7)#,        << Unused word.             >>           01990000
CBTVT      = CBTAB(CBTOVERHEAD)#;<< Start of the VT.       >>           01995000
                                                                        02000000
<< Type of CBs within the CBT control block area.            >>         02005000
                                                                        02010000
EQUATE                                                                  02015000
CBGARBAGE   = 0,          << Garbage (unused) Control Block  >>         02020000
CBFCB       = 1,          << FCB type Control Block          >>         02025000
CBPACB      = 2,          << PACB type Control Block         >>         02030000
CBLACB      = 3;          << LACB type Control Block         >>         02035000
                                                                        02040000
<< 1st word of any Control Block. (Ptr CB points to the      >>         02045000
<< Control Block) one of LACB, PACB or FCB.                  >>         02050000
                                                                        02055000
DEFINE                                                                  02060000
CBDESCRIP   = CB#,              << Descriptor word           >>         02065000
CBTYPE      = CBDESCRIP.(0:2)#, << CBT type field.           >>         02070000
CBSIZE      = CBDESCRIP.(2:14)#;<< CBT size in words.        >>         02075000
$PAGE                                                                   02080000
<<----------------------------------------------------------->>         02085000
<<                                                           >>         02090000
<<      Vector Table (VT) Definitions                        >>         02095000
<<                                                           >>         02100000
<<----------------------------------------------------------->>         02105000
COMMENT                                                                 02110000
                                                                        02115000
Vector Table                                                            02120000
------------                                                            02125000
                                                                        02130000
The part labeled Vector Table contains information used to              02135000
locate and lock/unlock a specific control block from the                02140000
control block area.                                                     02145000
                                                                        02150000
The overall structure of the vector table is:                           02155000
                                                                        02160000
-------------------------                                               02165000
|                       |                                               02170000
|     Entry # 0         |                                               02175000
|                       |                                               02180000
|-----------------------|                                               02185000
|                       |                                               02190000
|          .            |                                               02195000
|          .            |                                               02200000
|          .            |                                               02205000
|                       |                                               02210000
|-----------------------|                                               02215000
|                       |                                               02220000
|     Entry # N         |                                               02225000
|                       |                                               02230000
-------------------------                                               02235000
                                                                        02240000
An unused vector table entry will have zeroes in all words              02245000
of the entry. A used vector will have a non-zero value in               02250000
the first word (consequently, a control block address is                02255000
always non-zero).                                                       02260000
                                                                        02265000
The general structure of a vector table entry is:                       02270000
                                                                        02275000
  0   1             7   8                                               02280000
---------------------------------------------                           02285000
|         Control Block Address             |  0                        02290000
|--------------------------------------------                           02295000
| L | B |   Count     |       Unused        |  1                        02300000
|-------------------------------------------|                           02305000
|             Lock Pin                      |  2                        02310000
|-------------------------------------------|                           02315000
|        High Priority Impeded Queue(head)  |  3                        02320000
|-------------------------------------------|                           02325000
|        High Priority Impeded Queue(tail)  |  4                        02330000
|-------------------------------------------|                           02335000
|        Low Priority Impeded Queue(head)   |  5                        02340000
|-------------------------------------------|                           02345000
|        Low Priority Impeded Queue(tail)   |  6                        02350000
|-------------------------------------------|                           02355000
|               Unused                      |                           02360000
---------------------------------------------                           02365000
                                                                        02370000
VT'ADR                                                                  02375000
This is the CBT relative address of the specified control               02380000
block associated with this vector table entry.                          02385000
                                                                        02390000
VT'BREAK                                                                02395000
This bit signifies that we are in the middle of BREAK and               02400000
is therefore only used for the PACB of $STDIN/$STDLIST.                 02405000
                                                                        02410000
VTCONTROL                                                               02415000
The control word is used to coordinate access to the control            02420000
block. It contains a field that indicates that the control              02425000
block is being accessed and therefore locked, and the number            02430000
of times the CB has been locked.                                        02435000
                                                                        02440000
VT'COUNT                                                                02445000
This is a count of the number of times that the control                 02450000
block is locked by the process identified in CBLPIN. It                 02455000
is zero if the control block is not locked.                             02460000
                                                                        02465000
VT'HEAD                                                                 02470000
This is the PIN of the process at the head of the high                  02475000
priority impeded queue.                                                 02480000
                                                                        02485000
VT'LOCK                                                                 02490000
This is the lock field of the control block. Non-zero                   02495000
signifies that the control block is currently locked.                   02500000
                                                                        02505000
VT'PIN                                                                  02510000
This is the PIN of the process which has currently locked               02515000
the control block. Non-zero signifies unlocked.                         02520000
                                                                        02525000
VT'QUEUE                                                                02530000
The high priority impeded queue consists of a pair of                   02535000
PINs signifying the head and tail of the impeded processes              02540000
waiting for access to the control block.  Processes are                 02545000
impeded and umimpeded by the file system using the normal               02550000
mechanisms available under MPE.                                         02555000
                                                                        02560000
VT'SAVEDQUEUE                                                           02565000
The low priority impeded queue consists of a pair of                    02570000
PINs in the same format as VTQUEUE. The only time this                  02575000
queue is used is during BREAK to save the PIN of the                    02580000
process accessing the PACB of $STDIN/$STDLIST before the                02585000
break (and to save the PINs of any other processes waiting              02590000
for the PACB). As soon as the CI releases the PACB, the                 02595000
process that was interrupted will regain control of the PACB            02600000
and all waiting processes will be queued in the VTQUEUE.                02605000
                                                                        02610000
VTLOCKPIN                                                               02615000
Contains the PIN of the process which has exclusive access to the       02620000
control block.  Other processes attempting to access the block          02625000
will be impeded and queued.                                             02630000
                                                                        02635000
NOTE - All PINS are kept as word offsets into the PCB table of          02640000
the PCB entry and not as actual PIN numbers.                            02645000
                                                                        02650000
;                                                                       02655000
                                                                        02660000
EQUATE                                                                  02665000
VTENTRY     = 8 ;             << Vector table entry size     >>         02670000
                                                                        02675000
<< General Vector Table format. Ptr VT points to Vector Tab. >>         02680000
                                                                        02685000
DEFINE                                                                  02690000
VT'ADR          = VT(0)#,     << Control block address       >>         02695000
VT'CONTROL      = VT(1)#,     << Control word                >>         02700000
VT'LOCK'BIT     = VT'CONTROL.(0:1)#,<< CB is locked.         >>         02705000
VT'BREAK'BIT    = VT'CONTROL.(1:1)#,<< Break is established. >>         02710000
VT'LOCK = LOG(VT'LOCK'BIT )#, << For testing lock bit.       >>         02715000
VT'BREAK= LOG(VT'BREAK'BIT)#, << For testing break bit.      >>         02720000
VT'COUNT= VT'CONTROL.(2:6) #, << Lock count.                 >>         02725000
VT'PIN          = VT(2)#,     << Process pin holding lock.   >>         02730000
VT'QHEAD        = VT(3)#,     << Head process pin            >>         02735000
VT'QTAIL        = VT(4)#,     << Tail process pin            >>         02740000
VT'SAVEQ'HEAD   = VT(5)#,     << Low priority queue head     >>         02745000
VT'SAVEQ'TAIL   = VT(6)#,     << Low priority queue tail     >>         02750000
VT'UNUSED       = VT(7)#;     << Not used.                   >>         02755000
                                                                        02760000
$PAGE                                                                   02765000
<<----------------------------------------------------------->>         02770000
<<                                                           >>         02775000
<<         Active File Table (AFT) Entry Definitions         >>         02780000
<<                                                           >>         02785000
<<----------------------------------------------------------->>         02790000
COMMENT                                                                 02795000
                                                                        02800000
Active File Table                                                       02805000
-----------------                                                       02810000
                                                                        02815000
The part labeled Active File Table contains information                 02820000
used by the file system (or CS, DS, etc.) to grossly                    02825000
characterize the file access and, most importantly, to give             02830000
the location of the control blocks.                                     02835000
                                                                        02840000
The overall structure of the AFT is:                                    02845000
                                                                        02850000
-------------------------                                               02855000
|                       |                                               02860000
|        Entry N        |     (fixed, 6 words)                          02865000
|                       |                                               02870000
|-----------------------|                                               02875000
|                       |                                               02880000
|           .           |                                               02885000
|           .           |                                               02890000
|           .           |                                               02895000
|                       |                                               02900000
|-----------------------|                                               02905000
|                       |  DL-12                                        02910000
|        Entry 1        |                                               02915000
|                       |  DL-5                                         02920000
-------------------------                                               02925000
                                                                        02930000
where N = PXFAFTSIZE/6.                                                 02935000
                                                                        02940000
The AFT is as long as specified by PXFAFTSIZE.  Unused entries          02945000
are all zero's.  When the table is full it is expanded by               02950000
taking space from the Available Block.                                  02955000
                                                                        02960000
The AFT is negatively indexed by file number: the entry at              02965000
DL-12 corresponds to file number 1, the entry at DL-18                  02970000
corresponds to file number 2, etc.                                      02975000
                                                                        02980000
  0   1   2   3   4   5                                15               02985000
----------------------------------------------------------              02990000
|  Entry Type   | N |                                    |  0           02995000
|               |   |                                    |              03000000
|--------------------------------------------------------|              03005000
|                                                        |  1           03010000
|                  Physical ACB vector                   |              03015000
|                                                        |  2           03020000
|--------------------------------------------------------|              03025000
|                                                        |  3           03030000
|                  Logical ACB vector                    |              03035000
|                                                        |  4           03040000
|--------------------------------------------------------|              03045000
|                  NO-WAIT I/O IOQX                      |  5           03050000
----------------------------------------------------------              03055000
                                                                        03060000
Note that the entry format is dependent on the entry type.              03065000
The one shown above is the one used by the file system.                 03070000
                                                                        03075000
Global AFT's:                                                           03080000
                                                                        03085000
AFT's can also be found in a global AFT data segment.  The DST          03090000
number for this special table can be found in sysglobal exten-          03095000
tion cell number %121.  If a file is opened with the global             03100000
AFT bit on in the AOPTIONS and the user is privileged, then the         03105000
AFT is placed into the global AFT DST instead of in the stack.          03110000
These files are recognized by file system intrinsics by a neg-          03115000
ative file number.  All accesses to the file are identical as           03120000
using normal files.  The only difference is that these files            03125000
will not be closed at process termination time.  This allows            03130000
processes to share the same file without each process having to         03135000
FOPEN the file individually.                                            03140000
                                                                        03145000
The structure of the Global AFT is:                                     03150000
                                                                        03155000
------------------------                                                03160000
| Entry 0, not used.   |                                                03165000
|----------------------|                                                03170000
|     Entry 1          |                                                03175000
|----------------------|                                                03180000
~                      ~                                                03185000
|----------------------|                                                03190000
|     Entry N          |                                                03195000
|----------------------|                                                03200000
                                                                        03205000
AFTIOQX                                                                 03210000
This is the IOQ index of the pending no-wait I/O (if any).              03215000
Note that this is applicable iff the file was opened with the           03220000
NOWAIT option specified.  Also, CS and DS have the same                 03225000
capability and use this cell in a consistent manner.  The               03230000
reason for this is that the IOWAIT intrinsic services the file          03235000
system as well as CS and DS, and is the principal user of this          03240000
cell. If the cell is zero then there is no I/O pending,                 03245000
otherwise the cell contains the IOQ index corresponding to the          03250000
pending I/O.                                                            03255000
                                                                        03260000
NOTE:  If the IOQX is less than zero, then there exists one of three    03265000
possibilities.  For message files, this value represents the            03270000
accessors reply port number.  If this is a standard MPE file,           03275000
then the user performed a NOWAIT read agains an un-allocated            03280000
extent.  This is inserted simply as a file system stub. This            03285000
could also be an index used by the PORT procedures.                     03290000
                                                                        03295000
AFTLACBDST                                                              03300000
This is the first word of the LACBV. It is the DST number in            03305000
which the LACB exists. Applicable iff the file was opened               03310000
multi-access.                                                           03315000
                                                                        03320000
AFTLACBENTRY                                                            03325000
This is the second word of the LACBV. It is of the word                 03330000
offset into the control block table of the vector table entry for       03335000
this file, applicable iff the file was opened multi-access. This        03340000
value will be greater than CBTOFFSET and will always be a multiple      03345000
of VTENTRY size plus CBTOFFSET.                                         03350000
                                                                        03355000
AFTNULL                                                                 03360000
This bit signifies that the file is $NULL and that there are            03365000
no control blocks.                                                      03370000
                                                                        03375000
AFTPACBDST                                                              03380000
The first word of the PACBV consists of the DST in which the            03385000
PACB resides.  This will always be non-zero, except for $NULL.          03390000
                                                                        03395000
AFTPACBENTRY                                                            03400000
This is the word offset into the control block table of the             03405000
vector table entry for this file.  It will have at least the            03410000
value CBTOFFSET (first entry after the overhead) and will               03415000
always be a multiple of VTENTRY plus CBTOVERHEAD.  Will be              03420000
zero only for $NULL file.                                               03425000
                                                                        03430000
AFTTYPE                                                                 03435000
This is the AFT entry type number.                                      03440000
;                                                                       03445000
                                                                        03450000
EQUATE                                                                  03455000
AFTENTRY    = 6;    << AFT entry size >>                                03460000
                                                                        03465000
<< AFT file type entry codes.                                >>         03470000
                                                                        03475000
EQUATE                                                                  03480000
FS'TYPE      = 0,                   << Local (MPE) file type >>         03485000
RF'TYPE      = 1,                   << Remote file type      >>         03490000
DS'TYPE2     = 2,                   << DS type               >>         03495000
DS'TYPE3     = 3,                   << Other DS type         >>         03500000
CS'TYPE4     = 4,                   << CS type               >>         03505000
CS'TYPE5     = 5,                   << Autodialer CS type    >>         03510000
KS'TYPE      = 6,                   << KSAM file type        >>         03515000
TTS'TYPE     = 7,                   << 3270 file type        >>         03520000
MSG'TYPE     = 8,                   << MSG file type         >>         03525000
PORT'TYPE    = 9,                   << Port type             >>         03530000
ADV'S'TYPE   = 13;                  << Advanced net subsys   >>         03535000
                                                                        03540000
<< Find/Set a ptr to the AFT.                                >>         03545000
                                                                        03550000
DEFINE                                                                  03555000
FINDAFT     = PUSH(DL); TOS := TOS-4-FILENUM*AFTENTRY#,                 03560000
SETAFT      = FINDAFT; @AFT := TOS#,                                    03565000
GLOBAL'AFT'DSTN = SYSGLOBEXT(%121)#,                                    03570000
GLOBAL'FILENUM  = (FILENUM < 0)#,                                       03575000
FINDAFT'    = TOS:=-(TOS*AFTENTRY+4);PUSH (DL);TOS:=TOS+TOS#,           03580000
SETAFT'     = FINDAFT'; @AFT:=TOS#,                                     03585000
                                                                        03590000
<< Active File Table entries. Use SETAFT to set up AFT ptr.  >>         03595000
<< Below are straight file system defines.                   >>         03600000
                                                                        03605000
AFTTYPE     = AFT.(0:4)#,           << Entry type            >>         03610000
AFTFSTYPE   = (AFTTYPE=FS'TYPE)#,   << MPE file entry type   >>         03615000
AFTRFTYPE   = (AFTTYPE=RF'TYPE)#,   << Remote file entry type>>         03620000
AFTKSTYPE   = (AFTTYPE=KS'TYPE)#,   << KSAM file type        >>         03625000
AFTMSGTYPE  = (AFTTYPE=MSG'TYPE)#,  << MSG file entry type   >>         03630000
AFTPORTTYPE = (AFTTYPE=PORT'TYPE)#, << Port entry type       >>         03635000
AFTNULL     = AFT(0).(4:1)#,        << $NULL file entry type >>         03640000
AFTGLOBAL   = AFT(0).(5:1)#,        << Global AFT bit.       >>         03645000
AFTPACBVDSTN = AFT(1)#,             << DST of the PACBV.     >>         03650000
AFTPACBVENTRY= AFT(2)#,             << Entry offset of PACBV.>>         03655000
AFTLACBVDSTN = AFT(3)#,             << DST of LACBV.         >>         03660000
AFTLACBVENTRY= AFT(4)#,             << Entry offset of LACBV.>>         03665000
AFTIOQX      = AFT(5)#,             << No wait I/O index.    >>         03670000
AFTPRIV      = AFT.(13:1)#,         << Privileged bit.       >>         03675000
AFTSUBSYS    = AFT.(4:4)#,          << DS Subsystem.         >>         03680000
                                                                        03685000
<< These are used when the AFT has been placed on the stack  >>         03690000
<< by LOC'ACB.                                               >>         03695000
                                                                        03700000
FTYPE       = AFTE.(0:4)#,          << Type of file.         >>         03705000
                                                                        03710000
<< These are misc. AFT defines for CS, DS, etc.              >>         03715000
                                                                        03720000
AFTDSKLUDGE = (AFTTYPE <> 2)#,<< No I/O wait line - DS only  >>         03725000
AFT3270TYPE = (AFTTYPE=TTS'TYPE)#,  << 3270 entry type       >>         03730000
AFTDSTYPE   = (AFTTYPE&LSR(1) = 1)#,<< DS entry type         >>         03735000
AFTCSTYPE   = (AFTTYPE&LSR(1) = 2)#,<< CS entry type         >>         03740000
AFTLDEV     = AFT(1)#,        << Ldev # - CS only            >>         03745000
AFTCSIOQCBV = AFT(2)#,        << CS IOQ index CB vector      >>         03750000
AFTDSVIRTLDEV=AFT(3)#,        << DS virtual ldev number.     >>         03755000
AFTCS'MDST  = AFT(4)#,        << CS info data segment for AFT>>         03760000
AFTMPEV     = LOGICAL(AFT(2).(6:1))#; << true iff remote aft >>         03765000
                              << points to an MPEV/E machine >>         03770000
                                                                        03775000
<< Remote File Access Defines.                               >>         03780000
                                                                        03785000
DEFINE                                                                  03790000
AFTRFAMR     = AFT(0).(15:1)#,<< Signifies MR file.          >>         03795000
AFTRFAFNUM   = AFT(1)#,       << Remote file number          >>         03800000
AFTRFALINE   = AFT(2)#,       << Local line # of remote file >>         03805000
AFTRFADISP   = AFT(3)#;       << Pending FCLOSE disposition. >>         03810000
                                                                        03815000
<< These are KSAM AFT defines.                               >>         03820000
                                                                        03825000
DEFINE                                                                  03830000
AFTERRNUM   = AFT.(7:9)#,     << 9 bits for ksam error values>>         03835000
AFTFLAG     = AFT.(5:2)#,     << KSAM error flag             >>         03840000
AFTKEYFN    = AFT(1)#,        << Key file number             >>         03845000
AFTDATAFN   = AFT(2)#,        << Data file number            >>         03850000
AFTEDSNUM   = AFT(3)#,        << Extra data segment number.  >>         03855000
AFTRLLNUM   = AFT(4)#;        << KSAM rll segment number     >>         03856000
                                                                        03860000
                                                                        03865000
<<----------------------------------------------------------->>         03870000
<<                                                           >>         03875000
<<               AFT File Entry Types                        >>         03880000
<<                                                           >>         03885000
<<----------------------------------------------------------->>         03890000
                                                                        03895000
<< File type descriptor from the AFT (in FTYPE).             >>         03900000
                                                                        03905000
DEFINE                                                                  03910000
FSTYPE      = (FTYPE = FS'TYPE)#,   << Local file type       >>         03915000
RFTYPE      = (FTYPE = RF'TYPE)#,   << Remote file type      >>         03920000
DSTYPE      = (FTYPE&LSR(1) = 1)#,  << DS file type          >>         03925000
CSTYPE      = (FTYPE&LSR(1) = 2)#,  << CS file type          >>         03930000
KSTYPE      = (FTYPE = KS'TYPE)#,   << KSAM file type        >>         03935000
TTSTYPE     = (FTYPE = TTS'TYPE)#,  << 3270 file type        >>         03940000
MSGTYPE     = (FTYPE = MSG'TYPE)#;  << MSG file type         >>         03945000
                                                                        03950000
<<----------------------------------------------------------->>         03955000
<<                                                           >>         03960000
<<               NS/3000 RFA AFT Defines                     >>         03965000
<<                                                           >>         03970000
<<----------------------------------------------------------->>         03975000
                                                                        03980000
<< -------------------------------------------------------- >>          03985000
<< AFT for RFA:                                             >>          03990000
<< Ftype 9 in general is for iowait ports, but because ds   >>          03995000
<< has to support nowait io using the psuedo-interrupt      >>          04000000
<< facility provided for in iowait ports remote file will   >>          04005000
<< have FTYPE = 9, Subsystem type = 10 (means DSII) and     >>          04010000
<< subsystem subtype = 1 (means RFA)                        >>          04015000
<< -------------------------------------------------------- >>          04020000
<< --------------------------------------------------------             04025000
   RFA Defintions:                                                      04030000
      Remote file AFT:                                                  04035000
      for every remote file open there will be a corresponding          04040000
      AFT on the local stack.  To the user this is the AFT that         04045000
      will match the fnum that the user's fopen will return.            04050000
                                                                        04055000
        ALLOCATED on fopen by filessytem                                04060000
        DEALLOCATED on fclose by filesystem                             04065000
                                                                        04070000
   -------------------------------------------------------- >>          04075000
                                                                        04080000
COMMENT                                                                 04085000
            0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1                             04090000
            0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5                             04095000
           +-------------------------------+                            04100000
         0 | ftype |subsys |subtype|rfatype|                            04105000
           |-------------------------------|                            04110000
         1 | rfa'master #  | lfcb# for rfa |                            04115000
           |-------------------------------|                            04120000
         2 | DSTX for rfa buffers          |                            04125000
           |-------------------------------|                            04130000
         3 | ipcid, n/w RFA| envnum        |                            04135000
           |-------------------------------|                            04140000
         4 |                               |                            04145000
           |-------------------------------|                            04150000
         5 |  IOQX (nowait I/O)            |                            04155000
           +-------------------------------+                            04160000
                                                                        04165000
   ;                                                                    04170000
EQUATE                                                                  04175000
   PXPTRS'SIZE       = 4,                                               04180000
                                                                        04185000
   RFA'FTYPE         = 9,                                               04190000
   RFA'SUBSYS        = 2,                                               04195000
   RFA'SUBTYPE       = 1,                                               04200000
   RFA'WAITED        = 0,                                               04205000
   RFA'NOWAIT        = 1,                                               04210000
   RFA'FAIL          = 1,                                               04215000
   RFA'NOFAIL        = 0;                                               04220000
                                                                        04225000
<< These defines will facilitate access to the aft entry in >>          04230000
<< the stack's pxfile area. The users, however are required >>          04235000
<< to make following declarations:                          >>          04240000
<< LOGICAL qval, dlval, qrelaftx;                            >>         04245000
<< INTEGER aftx;                                            >>          04250000
<< ARRAY aq(*) = Q-0;                                       >>          04255000
                                                                        04260000
DEFINE                                                                  04265000
   ADVNDSRFA         = (AFTE.(0:12) = %(2)100100100001)#;               04270000
                                                                        04275000
DEFINE                                                                  04280000
   RFA'AFT'0         = AQ(QRELAFTX) #,                                  04285000
   RFA'AFT'FTYPE     = AQ(QRELAFTX+0).(0:4) #,                          04290000
   RFA'AFT'SUBSYS    = AQ(QRELAFTX+0).(4:4) #,                          04295000
   RFA'AFT'SUBTYPE   = AQ(QRELAFTX+0).(8:4) #,                          04300000
   RFA'AFT'NOWAIT    = AQ(QRELAFTX+0).(14:1) #,                         04305000
   RFA'AFT'FAILURE   = AQ(QRELAFTX+0).(15:1) #,                         04310000
                                                                        04315000
   RFA'AFT'MASTER    = AQ(QRELAFTX+1).(0:8) #,                          04320000
   RFA'AFT'LFCBBN    = AQ(QRELAFTX+1).(8:8) #,                          04325000
   RFA'AFT'XDS       = AQ(QRELAFTX+2) #,                                04330000
   RFA'AFT'IPCID     = AQ(QRELAFTX+3).(0:8) #,                          04335000
   RFA'AFT'ENVNUM    = AQ(QRELAFTX+3).(8:8) #,                          04340000
   RFA'AFT'PDISP     = AQ(QRELAFTX+4) #,                       <<11609>>04341000
   RFA'AFT'IOQX      = AQ(QRELAFTX+5) #,                                04345000
                                                                        04350000
   << if the failure bit is on these are relevant >>                    04355000
   RFA'AFT'ERRTYPE   = AQ(QRELAFTX+1) #,                                04360000
   RFA'AFT'ERRQUAL   = AQ(QRELAFTX+2) #,                                04365000
                                                                        04370000
   SETAFTACCESS      = PUSH (Q,DL);                                     04375000
                       QRELAFTX := RFA'AFTX*AFTENTRY+PXPTRS'SIZE;       04380000
                       QRELAFTX := -((TOS-TOS)+QRELAFTX); #,            04385000
                                                                        04390000
   RELEASE'RFA'AFT   = AQ(QRELAFTX) := 0;                               04395000
                       AQ(X:=X+1) := 0;                                 04400000
                       AQ(X:=X+1) := 0;                                 04405000
                       AQ(X:=X+1) := 0; #,                              04410000
                                                                        04415000
   INITIALIZE'RFA'AFT= AQ(QRELAFTX) := [4/RFA'FTYPE,                    04420000
                                       4/RFA'SUBSYS,                    04425000
                                       4/RFA'SUBTYPE,                   04430000
                                       2/0,     <<unused now>>          04435000
                                       1/RFA'WAITED,<<default>>         04440000
                                       1/RFA'NOFAIL] #;                 04445000
