🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5908

Re: Testing I/O success

#5908
From: John F. Haugh II
Date: Fri, 21 Apr 1989 00:33
19 lines
1692 bytes
In article <8038@boring.cwi.nl> siebren@cwi.nl (Siebren van der Zee) writes:
>In article <8019@boring.cwi.nl>, I, siebren@cwi.nl (Siebren van der Zee) wrote:
>> You *CANNOT* detect disk-full always on unix, since I/O is lazy.
>
>As several people pointed out to me, I was wrong. Even though the actual
>write may take place by the time that the program has exited, the disk-
>blocks are allocated immediately. Only when the write fails, you won't
>be notified, unless you call fsync(int fd).
>This is true for 4.3 BSD, SunOS 3.5, Ultrix 2.2; every unix I could check.

Part wrong still.  The disk blocks aren't allocated until stdio has flushed
it's buffers and called write(), etc.  A common problem is programs which
never fclose() their buffered files and rely on exit() to do so.  ALWAYS
flush after writes which must check for I/O success.
-- 
John F. Haugh II                        +-Quote of the Week:-------------------
VoiceNet: (214) 250-3311   Data: -6272  | "When everyone else complies
InterNet: jfh@rpp386.Dallas.TX.US       |  I will too ..."
UucpNet : <backbone>!killer!rpp386!jfh  +-------------------  -- Doug Davis  --
Technical Details
Message-ID: <15944@rpp386.Dallas.TX.US>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!xanth!ames!elroy!gryphon!vector!rpp386!jfh
References: <12144@haddock.ima.isc.com> <12593@haddock.ima.isc.com> <8019@boring.cwi.nl> <8038@boring.cwi.nl>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!xanth!ames!elroy!gryphon!vector!rpp386!jfh
From: jfh@rpp386.Dallas.TX.US (John F. Haugh II)
Newsgroups: comp.std.c
Subject: Re: Testing I/O success
Message-ID: <15944@rpp386.Dallas.TX.US>
Date: 21 Apr 89 00:33:58 GMT
References: <12144@haddock.ima.isc.com> <12593@haddock.ima.isc.com> <8019@boring.cwi.nl> <8038@boring.cwi.nl>
Reply-To: jfh@rpp386.Dallas.TX.US (John F. Haugh II)
Organization: River Parishes Programming, Dallas TX
Lines: 19