fopen and non-blocking

E

eyalc1978

Hi
Does someone knows if fopen() is a non-blocking function in a sense
that if there isn't sufficient disk space to open a file in write mode,
then the function will not wait but fail?

I find it difficult to believe that anyone who use this function wants
the program to wait until disk space is enlarged
 
F

Flash Gordon

Hi
Does someone knows if fopen() is a non-blocking function in a sense
that if there isn't sufficient disk space to open a file in write mode,
then the function will not wait but fail?

It's entirely up to the implementation so check in a group dedicated to
your system. The C standard allows it to fail, but it does not give any
conditions under which it must fail rather than waiting.
I find it difficult to believe that anyone who use this function wants
the program to wait until disk space is enlarged

I can think of times when you might possibly want that, but I agree that
it is not what one normally wants.
 
C

Chris Dollin

David said:
But in a system where there is a Hierarchical (excuse spelling) file store
the system manager might want the program to wait until stuff is moved to
tape (or slower disk) to make room for your file. Or for read wait until
it is paged in for input

And in case anyone says that's sheer speculation, IIRC George 3 would
archive inactive files onto tape and reload them when they were opened.
(Well, it asked the operators to do the actual /loading/, but the point
is that opening a "disc" file might take a "long" time.)
 
M

Michael Wojcik

I find it difficult to believe that anyone who use this function wants
the program to wait until disk space is enlarged

But in a system where there is a Hierarchical (excuse spelling) file store
the system manager might want the program to wait until stuff is moved to
tape (or slower disk) to make room for your file.[/QUOTE]

And in a batch processing environment, an implementation could
sensibly have such an fopen cause the program to be suspended until
an operator intervenes. That's typical behavior for exceptional
conditions in batch processing.

Not all the world is interactive computing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,176
Messages
2,570,950
Members
47,500
Latest member
ArianneJsb

Latest Threads

Top