*BSD News Article 70564


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.hawaii.edu!news.uoregon.edu!vixen.cso.uiuc.edu!uwm.edu!rutgers!cbgw3.att.com!news.PBI.net!samba.rahul.net!rahul.net!a2i!mhk.a2i!mhk
From: Mike Humski <mhk@rahul.net>
Newsgroups: comp.unix.programmer,comp.os.linux.development.apps,comp.unix.solaris,comp.unix.bsd
Subject: How to flush write buffer ?
Date: 10 Jun 1996 03:16:59 GMT
Organization: a2i network
Lines: 22
Distribution: world
Message-ID: <4pg43b$hru@samba.rahul.net>
NNTP-Posting-Host: waltz.rahul.net
NNTP-Posting-User: mhk
Xref: euryale.cc.adfa.oz.au comp.unix.programmer:38276 comp.os.linux.development.apps:17384 comp.unix.solaris:71357 comp.unix.bsd:16797


Could some one let me know how to flush the write buffer of kernel?

I know you can flush the buffer at each call of "write" by selecting
O_SYNC as the second argumnet of "open" system call.

But what I would like to do is to flush the buffer when I want to.

Only possibility that I know of is "fcntl" with O_SYNC argumnet. But it
seems to be effective only from the next call of "write" and not to the 
currently pending buffer contents.

By the way I understand that fflush function of the standard lib does just
flushing from the lib's buffer to kernel, not from kernel's buffer.
Am I right ?

I wish to use this technique with Solaris2.x (SunOS5.x), SunOS4.x, BSDs, and
LINUX.

Thank you for your help in advance.

Mike