Home > Archive > Unix Programming > January 2005 > Re: When does the Solaris kernel flush data to a file descriptor that is close()'ed?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: When does the Solaris kernel flush data to a file descriptor that is close()'ed?
|
|
| Casper H.S. Dik 2005-01-14, 8:57 am |
| Matty <matty@daemons.net> writes:
>I have been digging through books for the past few days trying to find
>out how the Solaris kernel handles a close() operation. Given the
>following sequence of system calls:
>fd = open("logfile", O_APPEND);
>write(fd, "blah", 4);
>close(fd);
>exit(0);
>When would "blah" actually get written to the file referenced by fd? Do
>the UFS delayed write algorithms kick in here? Does the close() force
>data to be flushed to the file referenced by fd? I can't seem to find a
>definitive answer for this in the close(2) man page, Solaris Systems
>Programming, or Solaris Kernel Internals (If I missed it, please let me
>know. I will wander off and read).
It's a property of the filesystem; as far as I know, Solaris ufs
decides that on last close the data should be flushed so ti will be
written somewhere in the near future.
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
| |
| Gary Mills 2005-01-14, 3:59 pm |
| In <41e78a47$0$6216$e4fe514c@news.xs4all.nl> Casper H.S. Dik <Casper.Dik@Sun.COM> writes:
>Matty <matty@daemons.net> writes:
[color=darkred]
[color=darkred]
>It's a property of the filesystem; as far as I know, Solaris ufs
>decides that on last close the data should be flushed so ti will be
>written somewhere in the near future.
I'm wondering if the original question was really about how soon
another process could read back the data from the file. In that
case, it should be available immediately after the close() returns,
even though it only resides in memory at the time. I'm assuming
that UFS guarantees this behavior.
--
-Gary Mills- -Unix Support- -U of M Academic Computing and Networking-
| |
| Casper H.S. Dik 2005-01-14, 8:57 pm |
| >mills@cc.umanitoba.ca (Gary Mills) writes:
[color=darkred]
After the write returns, not the close.
Casper
|
|
|
|
|