.title iov I/O vector definition .ident /000013/ ;;******************************* ;;***PL/I-COMPATIBLE VERSION***** ;;******************************* ; ;+ ; ; Index I/O vector definition ; Index I/O error codes ; Index I/O system internal flags and vectors ; Index $$ferr -- File error value ; ; Usage ; ; RSX format: ; typedef struct iov { ; int io_flag; /* Control flags */ ; int io_uget; /* Unget char storage */ ; int io_bcnt; /* Buffer free count */ ; char *io_bptr; /* Buffer free pointer */ ; char *io_rbuf; /* Record buffer start */ ; int io_rbsz; /* Record buffer size */ ; char *io_bbuf; /* Block buffer start */ ; char *io_wild; /* Wildcard lookup buf */ ; int io_uic; /* Binary UIC (PPN) */ ; int io_iosb[2]; /* I/O status block */ ; int io_fdb[0]; /* File data block */ ; } FILE; ; ; RT11 format: ; typedef struct iov { ; int io_flag; /* Control flags */ ; int io_uget; /* Unget char storage */ ; char *io_name; /* File name pointer */ ; char *io_wild; /* Wild card lookup buf */ ; int io_lun; /* RT11 channel number */ ; int io_bcnt; /* Buffer free count */ ; char *io_bptr; /* Buffer free pointer */ ; int io_bnbr; /* Disk block number */ ; char io_bbuf[512]; /* Data buffer */ ; } FILE; ; ; Bits in iov.io_flag: ; #define IO_OPN 0100000 /* Open file */ ; #define IO_REC 0040000 /* Record device */ ; #define IO_TTY 0020000 /* Console terminal */ ; #define IO_EOF 0010000 /* EOF seen */ ; #define IO_ERR 0004000 /* Error seen */ ; #define IO_FIL 0002000 /* Disk file */ ; #define IO_NLH 0001000 /* No newlines hack bit */ ; #define IO_NOS 0000400 /* No newlines needed */ ; #define IO_UBF 0000200 /* User does buffering */ ; #define IO_BZY 0000100 /* Buffer write needed */ ; #define IO_WF1 0000040 /* fwild "first time" */ ; #define IO_VER 0000020 /* fwild version hack */ ; #define IO_VM1 0000010 /* version ;-1 */ ; #define IO_WLD 0000004 /* file is wild */ ; #define IO_MOD 0000003 /* Open mode mask */ ; /* read = 0 */ ; /* write = 1 */ ; /* append = 2 */ ; /* Non-zero = output */ ; ; #define IO_EOR (IO_ERR | IO_EOF) ; ; extern int $$ferr; /* Error word */ ; extern FILE *stdin; /* Standard input file */ ; extern FILE *stdout; /* Standard output file */ ; extern FILE *stderr; /* User's command tty */ ; ; Internal ; ; extern FILE *$$luns[]; /* IOV pointer table */ ; extern FILE *$$lune; /* IOV table end */ ; extern (int)(char *$$lmax); /* RSX $$luns dim. */ ; extern char **$$ifil; /* -> stdin file name */ ; extern char **$$ofil; /* -> stdout file name */ ; extern int $$nlun; /* RSX: Number of luns */ ; FILE *$$eiov; /* RSX: Stderr iov */ ; ; Description ; ; Define the I/O vector structure used for communication by ; all I/O routines in the C library. Note that it is slightly ; different for RSX and RT11 modes. Note also that certain bits ; in IO_FLAG are only meaningful for one flavor of I/O. ; ; The RSX-mode IOV contains an entire file data block (FDB). ; Also, 'io_uic' contains the binary UIC of the directory ; via which the file is being accessed, not the 'owner' UIC. ; It is this UIC which is given when fgetname() is called. ; ; The RT11-mode IOV contains only enough information to read and ; write files plus a pointer to an Ascii string with the file ; name argument to fopen(). The file name is needed for fgetname() ; and to allow deleting files given the IOV pointer. ; ; The following files are defined here: ; ; stdin The standard input file. ; ; stdout The standard output file. ; ; stderr The error output file. Note: on RSX ; systems, stderr is opened on LUN 1. ; ; $$ferr (error word) is also defined here. This is set non-zero ; if an error occurred when performing I/O. On RSX, the standard ; I/O error code is returned. On RT11, an error code compatible ; with RSTS/E usage is returned: ; ; Global Value Meaning ; E$$ILF 02. 002 Illegal file name ; E$$NOR 04. 004 No room for user on device ; E$$FNF 05. 005 Can't find file or account ; E$$NOD 06. 006 Not a valid device ; E$$ILU 07. 007 I/O channel in use ; E$$NOO 09. 011 I/O channel not open ; E$$EOF 11. 013 End of file on device ; E$$FAT 12. 014 Fatal system I/O failure ; E$$ERR 13. 015 User data error on device ; E$$FND 16. 020 File already found (protected) ; E$$NOC 17. 021 Too many open files on unit. ; E$$NSP 32. 040 No memory space for buffer ; ; Error 12 is set only if an "impossible" error occurs. While this ; may indicate a bug in the RT11 library, it is more likely to be ; a user programming error (like passing garbage to an I/O routine). ; ; Error 7 is set if fopen tries to open a channel that is already ; in use. ; ; Internal ; ; In RSX, buffering is done by the RSX file-management services ; (FCS). The block buffer pointer is unused (but reserved for ; anybody who cares to add random access). ; ; In RT11, buffers are managed by the C support package, functions ; $$putc, $$flsh, $$getc, and $$get. In these packages, the ; buffer control words are used as follows: ; ; If IO_BPTR equals zero, the buffer is unused. IO_BCNT will ; also equal zero and the get block ($$get) routine will be called ; to fill the first buffer, setting up all other pointers/counters. ; In all other cases, the following pertains: ; ; IO_BCNT Contains the number of bytes that can be ; inserted into the buffer before it must ; be written onto the disk file. ; ; IO_BPTR Contains the address of the first free ; location in the buffer. ; ; IO_BNBR When writing, this contains the number ; of the block to write when this block ; fills. ; ; When reading, it contains the number of ; the next block, which is read when this ; block empties. ; ; Bugs ; ;- ; ; Edit history ; 000001 24-Jul-79 MM Initial edit ; 000002 11-Mar-80 MM Conversion for the newer C library ; 000003 18-Mar-80 MM Rewritten to add RT11 support ; 000004 10-Jun-80 MM Added VF$VER, VF$VM1, WF$MOD ; 000005 26-Jun-80 MM Added V$WILD ; 000006 27-Jun-80 MM Reorganized -- version numbers removed ; 000008 18-Jul-80 MM Added E$$ILU and E$$FND, redid globalization ; 000009 01-Aug-80 MM Removed VF$OUT, added VF$WF1, moved VF$OPN ; 000010 17-Aug-80 RBD Added IO_WLD/VF$WLD for RT-11 fwild() support. ; (VF$WLD is set for RSX wild-card files, too.) ; 000011 15-Sep-80 RBD Added IO_UIC/V$UIC to RSX IOV for proper UIC ; handling under native RSX. ; 000012 ?? ?? ; 000013 17-Feb-81 MM No newlines hack for wildcard files ;;***000014 01-OCT-82 WE PL/I-COMPATIBLE VERSION .iif ndf rsx rsx = 1 ;Assume RSX ; The IOV is the communication area for all I/O functions. ; Note that, when referred to by ASM routines (??????.S), ; "$" is written using the forbidden tilde. ; .psect .data. ; .if ne rsx .mcall FDOF$L, FDBDF$, FDAT$A, FDRC$A, FDOP$A, NMBLK$ FDOF$L .endc VF$OPN == 100000 ;Really open ;09 VF$REC == 040000 ;Record device VF$TTY == 020000 ;Terminal device VF$EOF == 010000 ;Input device at EOF VF$ERR == 004000 ;Error seen VF$FIL == 002000 ;File accessed VF$NLH == 001000 ;No newlines hack bit for VMS ;13 VF$NOS == 000400 ;No newlines (output) VF$UBF == 000200 ;Unbuffered VF$BZY == 000100 ;Buffer busy (RT11) VF$WF1 == 000040 ;Wild card "first" flag ;09 VF$VER == 000020 ;Version nbr ;0 or ;-1 VF$VM1 == 000010 ;Version number is ;0 VF$WLD == 000004 ;File is wild -- MUST BE IN LOW-BYTE ;10 VF$MOD == 000003 ;Open mode mask VF$EOR == VF$EOF+VF$ERR ;End of input mask ; ; Note: VF$WLD must be in the low byte for RT11 (native) fwild to work. ; .if ne rsx ; ; Allocate the error IOV and, by the way, define the offsets ; $$EIOV:: V$FLAG == .-$$EIOV ;V$FLAG I/O flags -- MUST BE FIRST .word VF$OPN+VF$REC+VF$TTY+$$WMOD ;Open, record, term., write ;09 V$UGET == .-$$EIOV .word -1 ;V$UGET Ungetc character V$BCNT == .-$$EIOV .word 0 ;V$BCNT current byte counter V$BPTR == .-$$EIOV .word $$erec ;V$BPTR -> error line (free byte) V$RBUF == .-$$EIOV .word $$erec ;V$RBUF -> error line start V$RBSZ == .-$$EIOV .word $$esiz ;V$RBSZ := error line size V$BBUF == .-$$EIOV .word 0 ;V$BBUF No block buffer V$WILD == .-$$EIOV .word 0 ;V$WILD No wild card buffer V$UIC == .-$$EIOV .word 0 ;V$UIC set to task UIC for stderr ;11 V$IOSB == .-$$EIOV .blkw 2 ;V$IOSB I/O status buffer V$FDB == .-$$EIOV $$EFDB:: FDBDF$ ;File data block FDAT$A R.VAR,FD.CR ;Variable-length, do carriage-control FDRC$A ;Use GET$/PUT$ FDOP$A 1,,$$EFNB ;Output default filename buffer ;Note: lun 1 V$SIZE == .-$$EIOV ;Globally define FDB size V$LUN == V$FDB+F.LUN ;LUN location in FDB. $$EFNB:: NMBLK$ ERROUT,TXT,,TI ;Default output to TI:ERROUT.TXT ;Note: on VMS, this is changed to ; CO:ERROUT.TXT .iff ; ; Define the RT11 IOV offsets ; $$EIOV:: V$FLAG == .-$$EIOV ;Flags .word VF$OPN+VF$TTY+VF$UBF+$$WMOD ;09 V$UGET == .-$$EIOV ;Ungetc character .word -1 V$FDB == .-$$EIOV ;File data block V$NAME == .-$$EIOV ;File name pointer .word tty V$WILD == .-$$EIOV ;Wild card lookup status buffer .word 0 ;Note: the following must remain in order V$LUN == .-$$EIOV ;Channel number .word -1 ;Fake for stderr V$BCNT == .-$$EIOV ;Number of characters left in buffer .word 0 V$BPTR == .-$$EIOV ;Pointer to next character .word 0 V$BNBR == .-$$EIOV ;Block number (next block to read) .word 0 V$BUFF == .-$$EIOV ;The buffer starts here V$SIZE == .-$$EIOV+512. ;IOV size ; ; Define the RT11 error codes ; E$$ILF == 02. ;Illegal file name E$$NOR == 04. ;No room for user on device E$$FNF == 05. ;Can't find file or account E$$NOD == 06. ;Not a valid device E$$ILU == 07. ;I/O channel in use E$$NOO == 09. ;I/O channel not open E$$EOF == 11. ;End of file on device E$$FAT == 12. ;Fatal system I/O failure E$$ERR == 13. ;User data error on device E$$FND == 16. ;File already found E$$NOC == 17. ;Too many open files on unit. E$$NSP == 32. ;No memory space left .endc ;03- .iif ne V$FLAG .error V$FLAG must be first ; ; Allocate other file data ; $$ferr:: .word 0 ;Error control word ;;***.if ne rsx ;;***$$nlun:: ;;*** .word 0 ;Number of luns ;;***.nluns:: ;;*** .blkw 1 ;Set (by linker) to number of user luns ;;***.endc $$ifil:: .word tty ;Stdin file name $$ofil:: .word tty ;Stdout file name $$erec:: .blkw 41. ;Stderr buffer (also used by GTSK) $$esiz == .-$$erec ;Error record size ;;*** ;;***$$lmax == 20. ;Max number of user luns ;;*** stdin:: .word 0 ;Stdin ioptr stdout:: ;;*** .word 0 ;Stdout ioptr ; ; Note: stderr must be located just before $$luns ; as it is assigned to LUN 1 on RSX, and to channel -1 on RT11 ; $$luns[0] is LUN 2 on RSX, and channel 0 on RT11 ; stderr:: .word $$eiov ;Stderr ioptr (lun 1 or -1) ;;*** ;;***$$luns:: ;;*** .blkw $$lmax ;Ioptrs on a per lun basis ;;***$$lune == . ;End of Ioptr table tty: .if ne rsx .asciz /ti:/ ;Standard (command) input/standard output .iff .asciz /tt:/ ;Standard input/standard output .endc .END