(Subject: changed to be more specific.)

On Sun, 10 Nov 2019 08:00:24 -0600, Pierre Fichaud wrote:

>I want to process Unix files in a sub-task.  The files are being written into 
>by applications in other address spaces. I open the file (BPX1OPN).  I need to 
>read all the records. errno EAGAIN seems to say that there are no new records 
>in the file. So I would WAIT and retry.
>
I have done this by issuing a blocking read for a single byte to
perform the wait rather than polling, then non-blocking reads
for remaining available data.

>... Does this make sense ? I also want to know if the file is still being 
>written into. BPX1FST (file status) will return an area. Does the field 
>ST_NLINK tell me how many "OPENs" have been done ? If I'm the only one 
>connected to the file, would ST_NLINK have a value of 1?
>
2, one for the directory link, one for you.  This may be unreliable if
o Multiple directory links exist or another task unlinks the file.
o fork(), spawn(), or dup() may affect the link count.
o A producer task neglects to close the file promptly.

I have done this only with unnamed pipes.  Behavior of regular
files may be different.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to