From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 27 Oct 92 17:02:02 GMT From: emery@mitre-bedford.arpa (David Emery) Subject: Re: sequential io with multiple types Message-ID: List-Id: One of the "extensions" provided by the IEEE P1003.5 POSIX Ada Binding is the ability to associate an Ada file object with a given file descriptor, through use of the FORM parameter on Create or Open. This is important to achieve the "sharing" effects that John mentioned. In POSIX, a file descriptor maps to the operating system's record of file access (e.g. the current read/write position in the file.) POSIX/Ada does not guarantee that you can get the "desired effect" by opening two file objects mapped to the same file descriptor. This is due to the possibility of internal file buffering by the Ada IO system. But, if the Ada IO implementation does not do any additional buffering, then this should work: (User must supply the appropriate names/types/etc in .) with POSIX, POSIX_IO, Sequential_IO; procedure demo is fd : POSIX_IO.file_descriptor; package SIO_one is new Sequential_IO (); package SIO_two is new Sequential_IO (); SIO_one_file : SIO_one.file_type; SIO_two_file : SIO_two.file_type; begin fd := POSIX_IO.Open (name => , mode => POSIX_IO.write_only); SIO_one.open (SIO_one_file, form => "File_Descriptor => " & POSIX_IO.file_descriptor'image(fd)); SIO_two.open (SIO_two_file, form => "File_Descriptor => " & POSIX_IO.file_descriptor'image(fd)); -- note that no NAME parameter is provided for the -- Sequential_IO instantiation Open operations -- now both Ada sequential file objects are associated with -- the same underlying POSIX file descriptor. SIO_one.put (SIO_one_file, ); SIO_two.put (SIO_one_file, ); end demo; Yet another feature of POSIX/Ada... dave