GDSX Manual
Design and Development
Extended General Device Support (GDSX) Manual–134303
2-90
I/O Involving $RECEIVE
The DEVICE^HANDLER Task Calls ^READUPDATE
At this point in time, the DEVICE^HANDLER task to receive the request may or may
not have a ^READUPDATE posted on its pseudo $RECEIVE. When a
DEVICE^HANDLER task calls ^READUPDATE(0,...), the following happens:
•
The task’s completed I/O list is searched to determine whether the task already has a
new request. If so, the task’s E^IMSG event is caused, the state of the IOCB is set
to 5 (pending), iocb.mytag is set to the caller’s tag parameter (if any), and
^READUPDATE returns.
•
If the task has no request on its completed I/O list, the task’s TCB is modified as
follows:
TSCODE Queues the IOCB
After TSCODE sets up the IOCB, it does the following:
•
If tcb.rcvsz is greater than 0 but tcb.rcvbuf is equal to 0 (the task has a
^READUPDATE posted but did not pass a buffer to ^READUPDATE), an attempt is
made to obtain a buffer in the buffer pool. The size of this buffer is the maximum
value of iocb.cnt and iocb.iocnt. If a buffer is obtained, its address is stored in
iocb.bufaddr and the state of the IOCB is set to 8.
•
If a buffer cannot be obtained or the task had no ^READUPDATE, an attempt is
made to allocate space in extended segment 1024. The size of this buffer is
iocb.iocnt. If space is not allocated, the request is deferred to the listener task to
wait for buffer space. If the allocation is successful, the address of the area is stored
in iocb.xbufaddr and iocb.state is set to 1. (If iocb.iocnt is 0, no extended buffer is
allocated and iocb.xbufaddr is set to 0D.)
•
Data is moved from the GDSX $RECEIVE buffer to the buffer addressed by
iocb.bufaddr (or xbufaddr).
•
The IOCB is inserted at the end of the receiving task’s completed I/O list and onto
the end of the RCB’s IOCB list (using iocb.fcblink).
•
If tcb.rcvsz is greater than 0:
°
The sign of tcb.rcvsz is inverted.
°
An E^IMSG event is posted against the receiving task.
•
Rcvtbl[iocb.msgtag] is set to @IOCB.
The DEVICE^HANDLER Task Calls ^AWAITIO
After the DEVICE^HANDLER task’s call to ^READUPDATE, when the task calls
^AWAITIO with the file parameter 0 or -1:
tcb.rcbsz Read count, if passed; otherwise recvsz
tcb.rcvbuf Buffer address, if passed; otherwise 0
tcb.rcvtag Caller’s tag parameter, if passed; otherwise -1D