OPEN or CLOSE (3.x)                              

       command codes = 13 and 14

               ES:BX   pointer
                       length          field

       These calls are designed to give the device information about the
       current file activity on the device if bit 11  of  the  attribute
       word is set. On block devices, these calls can be used  to manage
       local buffering. The device can  keep  a  reference  count. Every
       OPEN causes the device  to  increment  the reference count. Every
       CLOSE causes the device  to  decrement  the reference count. When
       the reference count is 0, if means there are no open files in the
       device. Therefore, the device  should  flush  buffers  inside the
       device  it has written to because now the  user  can  change  the
       media on a removeable media drive. If the media had been changed,
       it  is  advisable  to reset the  reference  count  to  0  without
       flushing  the  buffers.

       This  can  be thought of as "last  close  causes  flush".

       These calls are more useful on character devices.

       The OPEN call can be used to send a device initialization string.
       On a  printer,  this  could  cause a string to be sent to set the
       font,  page  size,  etc. so that the printer would always be in a
       known state in  the  I/O  stream.  Similarly, a CLOSE call can be
       used to send a post string (like a form feed) at  the  end  of an
       I/O  stream.  Using  IOCTL to set  these  pre  and  post  strings
       provides  a  flexible  mechanism  of  serial  I/O  device  stream
       control.

       NOTE:     Since all  processes  have  access  to  STDIN,  STDOUT,
                 STDERR, STDAUX, and  STDPRN (handles 0,1,2,3,and 4) the
                 CON, AUX, and PRN devices are always open.


Copyright © 1985 to 2022 Beta Systems                            Last modified: Wednesday, January 05, 2022 .