|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
Fsync synchronous data at any time [code]int Main ()
{
Int fd, byteswrite, bytesread;
Char buf[256];
Int length;
Memset (buf,0,256);
Strcpy (buf, "Panorama, this is a test");
Length = strlen (buf);
Fd = creat ( "test.txt," O_RDWR|0777);
Byteswrite = write (fd, buf, length);
Printf ( "byteswrite is %d \n" byteswrite);
If (fsync (fd) ==-1)
Printf ( "fsync error\n");
Memset (buf,0,256);
Bytesread = read (fd, buf, length);
Printf ( "bytesread is %d \n" bytesread);
Printf ( "read result is %s\n", buf);
}[/code]
[code][lrf@localhost File]$ results. /s
Byteswrite is 21
Bytesread is -1
Read result is
[lrf@localhost File]$ [/code]
Write data to document
Then fsync
Then again
What neither read results
Fsync synchronous data at any time? |
Fsync synchronous data at any time What is your understanding of the concept-Synchronous |
Fsync synchronous data at any time They should be immediately included in the disk buffer immediately bar |
Fsync synchronous data at any time TU. Why should you read to the end of the document 呢??
1 to return to the course. |
Fsync synchronous data at any time Man lseek |
Fsync synchronous data at any time -->
Wrote the original document is already in the end
Thank you, ah |
Fsync synchronous data at any time Mq110 Brother
Sorry ah
In the former case to read
T=lseek (fd, 0, SEEK_SET);
Printf ( "t is %d\n", t);
Although the printer is a t 0
But time and the result was just above the same ah
This is how the case? |
Fsync synchronous data at any time T=lseek (fd, (1) *length, SEEK_CUR);
This 呢?? |
Fsync synchronous data at any time T is 0 or a printer
Read or return -1
However, the relevant documents reopened
Then again, no problem |
Fsync synchronous data at any time NOTES
In case the hard disk has write cache enabled, the data may not really be on permanent storage when fsync/fdatasync return.
When an performance of ext2 file system is mounted with the sync option, directory entries are also implicitly synced by fsync.
On kernels before 2.4, fsync on big files can be inefficient. An alternative might be to use the O_SYNC flag to open (2). |
Fsync synchronous data at any time -->
As such it must do these two functions?
What function does not determine the outcome of the actual significance? |
Fsync synchronous data at any time In other words, you should not be the function of the equipment used in the above spirit, other equipment may be serial, parallel and other equipment. |
Fsync synchronous data at any time Oh. Man for a moment. O_SYNC open at the same time using signs. |
Fsync synchronous data at any time This ah
Myself |
Fsync synchronous data at any time I will have to resolve these issues on the reopened only relevant documents? |
Fsync synchronous data at any time Of the document will be closed after the data from the cache into data and then re-opened, it is estimated that you call the fsync, the Wenjianmiaoshufu Handle is invalid. You may have read about the return value using perror detection. |
Fsync synchronous data at any time
| Fsync synchronous data at any time Try a bit
The method can be achieved simultaneously mq110
Really very grateful to her brother ah mq110 |
| |