Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
* File descriptor equivalent of fflush?
@ 1996-01-29  5:00 Anthony Lee
  1996-01-29  5:00 ` Kazimir Kylheku
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Anthony Lee @ 1996-01-29  5:00 UTC (permalink / raw)


Dear all,

I am trying to find an equivalent of fflush for file descriptors
in ULTRIX and OSF.  

-- 
Anthony Lee        These are my opinions and not SEQEB.
SEQEB                                            
150 Charlotte Street                   ..--  __o 
Brisbane                          ....--   _ \<,_               
Qld 4000                         ____     (_)/ (_)                       
Australia
voice:+61 7 3407 4541            Death to the Daleks!!!!
fax:  +61 7 3407 4607
email: AL012@svtstu.seqeb.gov.au




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: File descriptor equivalent of fflush?
  1996-01-29  5:00 File descriptor equivalent of fflush? Anthony Lee
  1996-01-29  5:00 ` Kazimir Kylheku
@ 1996-01-29  5:00 ` ua302aa
  1996-01-30  5:00   ` John Hascall
  1996-01-29  5:00 ` (Summary of response) " Anthony Lee
  1996-01-30  5:00 ` Curt Smith
  3 siblings, 1 reply; 6+ messages in thread
From: ua302aa @ 1996-01-29  5:00 UTC (permalink / raw)


al012@svtstu.seqeb.gov.au (Anthony Lee) writes:

>Dear all,

>I am trying to find an equivalent of fflush for file descriptors
>in ULTRIX and OSF.  

flushing buffers in not very meaningful for unbuffered i/o. If "low 
level" i/o is buffered in ULTIRX or "OSF", try to find an answer
in a system specific group.

Kurt
--
| Kurt Watzka                             Phone : +49-89-2180-6254
| watzka@stat.uni-muenchen.de
| ua302aa@sunmail.lrz-muenchen.de




^ permalink raw reply	[flat|nested] 6+ messages in thread

* (Summary of response) Re: File descriptor equivalent of fflush?
  1996-01-29  5:00 File descriptor equivalent of fflush? Anthony Lee
  1996-01-29  5:00 ` Kazimir Kylheku
  1996-01-29  5:00 ` ua302aa
@ 1996-01-29  5:00 ` Anthony Lee
  1996-01-30  5:00 ` Curt Smith
  3 siblings, 0 replies; 6+ messages in thread
From: Anthony Lee @ 1996-01-29  5:00 UTC (permalink / raw)


In article <DLxHsx.7Ko@un.seqeb.gov.au>, al012@svtstu.seqeb.gov.au says...
>
>Dear all,
>
>I am trying to find an equivalent of fflush for file descriptors
>in ULTRIX and OSF.  
>

Many thanks to all those people who send me replies.
Two people told me that I don't need to flush because
read and write are not buffered.

But then the man pages for write on ULTRIX had this

>By default, write does asynchronous writes.  That is, after the data is
>written to a buffer cache, control returns to the program.  The actual
>write to a device takes place after control returns.  However, if you
>use an open or fcntl call to open a file for synchronous writes, control
>does not return to the program until after the buffer cache has been
>written to the device.

Several people suggested that I use fsync but be aware that on
ULTRIX fsync will flush all buffers.

-- 
Anthony Lee        These are my opinions and not SEQEB.
SEQEB                                            
150 Charlotte Street                   ..--  __o 
Brisbane                          ....--   _ \<,_               
Qld 4000                         ____     (_)/ (_)                         
Australia
voice:+61 7 3407 4541            Death to the Daleks!!!!
fax:  +61 7 3407 4607
email: AL012@svtstu.seqeb.gov.au




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: File descriptor equivalent of fflush?
  1996-01-29  5:00 File descriptor equivalent of fflush? Anthony Lee
@ 1996-01-29  5:00 ` Kazimir Kylheku
  1996-01-29  5:00 ` ua302aa
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Kazimir Kylheku @ 1996-01-29  5:00 UTC (permalink / raw)


In article <DLxHsx.7Ko@un.seqeb.gov.au>,
Anthony Lee <al012@svtstu.seqeb.gov.au> wrote:
>Dear all,
>
>I am trying to find an equivalent of fflush for file descriptors
>in ULTRIX and OSF.  

All you can do is open the file with the O_SYNC flag. If the underlying file
system supports it, the write() calls will exit only when the blocks affected
by write() have been committed to disk.

You can also call fsync() on the file descriptor, which will cause all the
unwritten cache blocks belonging to that file to be queued for writing, though
I'm not sure whether fsync() will wait for the writing to take place. 

>-- 
>Anthony Lee        These are my opinions and not SEQEB.
>SEQEB                                            
>150 Charlotte Street                   ..--  __o 
>Brisbane                          ....--   _ \<,_               
>Qld 4000                         ____     (_)/ (_)                       
>Australia
>voice:+61 7 3407 4541            Death to the Daleks!!!!
>fax:  +61 7 3407 4607
>email: AL012@svtstu.seqeb.gov.au
>


-- 




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: File descriptor equivalent of fflush?
  1996-01-29  5:00 ` ua302aa
@ 1996-01-30  5:00   ` John Hascall
  0 siblings, 0 replies; 6+ messages in thread
From: John Hascall @ 1996-01-30  5:00 UTC (permalink / raw)


 <ua302aa@lrz-muenchen.de> wrote:
}al012@svtstu.seqeb.gov.au (Anthony Lee) writes:
}>I am trying to find an equivalent of fflush for file descriptors
}>in ULTRIX and OSF.  
}
}flushing buffers in not very meaningful for unbuffered i/o. If "low 
}level" i/o is buffered in ULTIRX or "OSF", try to find an answer
}in a system specific group.

    That's not a great answer...
     + flushing buffers is meaningful for unbuffered i/o.
     + it isn't specific to Ultrix or OSF

    The answer is:

       status = fsync(fd);

John
-- 
John Hascall                ``An ill-chosen word is the fool's messenger.''
Moderator, comp.unix.wizards
Systems Software Engineer, ISU Comp Center + Ames, IA  50011 + 515/294-9551
<a href="http://www.cc.iastate.edu/staff/systems/john/">My Homepage</a>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: File descriptor equivalent of fflush?
  1996-01-29  5:00 File descriptor equivalent of fflush? Anthony Lee
                   ` (2 preceding siblings ...)
  1996-01-29  5:00 ` (Summary of response) " Anthony Lee
@ 1996-01-30  5:00 ` Curt Smith
  3 siblings, 0 replies; 6+ messages in thread
From: Curt Smith @ 1996-01-30  5:00 UTC (permalink / raw)


Anthony Lee (al012@svtstu.seqeb.gov.au) wrote:
: Dear all,
: 
: I am trying to find an equivalent of fflush for file descriptors
: in ULTRIX and OSF.  

To my knowledge, the only mechanism available to a task that opened
an fd without O_SYNC, to assure the last bunch of write()s are on
disk is:  fsync(fd).  See man 2 fsync.  Or sync() if all writes to
a file system are to be written.

Curt Smith
curts@compgen.com




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1996-01-30  5:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-01-29  5:00 File descriptor equivalent of fflush? Anthony Lee
1996-01-29  5:00 ` Kazimir Kylheku
1996-01-29  5:00 ` ua302aa
1996-01-30  5:00   ` John Hascall
1996-01-29  5:00 ` (Summary of response) " Anthony Lee
1996-01-30  5:00 ` Curt Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox