ChinaUnix.net
相关文章推荐:

fsync

fsync This function is a cancellation point in multi-threaded programs. This is a problem if the thread allocates some resources (like memory, file descriptors, semaphores or whatever) at the time fsync is called. If the thread gets canceled these resources stay allocated until the program ends. To avoid this, calls to fsync should be protected using cancellation handlers. 这里大概说的是一个这样...

by peidright - C/C++ - 2010-06-29 10:03:09 阅读(1131) 回复(1)

相关讨论

我的程序中调用 fsync 之将程序写的文件刷新到磁盘上, 我想给 fsync 加一个超时限制。 write_timeout.it_value.tv_sec = 3; write_timeout.it_value.tv_usec = 0; write_timeout.it_interval.tv_sec = 0; write_timeout.it_interval.tv_usec = 0; setitimer(ITIMER_REAL,&write_timeout,NULL); signal(SIGALRM, MySigAlarmHandler); ret...

by river617 - Linux环境编程 - 2010-09-09 15:49:47 阅读(2820) 回复(11)

今天看UNIX环境高级编程,第三章关于IO的,不明白为什么fdatasync 使用时间为18.28S,而fsync时间为17.95S

by birdslake - Linux环境编程 - 2014-03-23 13:45:11 阅读(1337) 回复(3)

如题,求教,请各位解惑。

by superwujc - C/C++ - 2012-08-24 15:54:38 阅读(1422) 回复(5)

书中提到,可以用函数fsync()将已经写入到文件描述符fd的数据真正写到磁盘或者其他下层设备中 这里写到磁盘中,到底写到磁盘的哪个地方呢? 我们可以查看到吗? 用查看文件的方法?(linux中都使用文件抽象) 求助大侠。。。

by haibian826 - Linux环境编程 - 2008-05-14 23:47:03 阅读(2399) 回复(2)

[code]int main() { int fd,byteswrite,bytesread; char buf[256]; int length; memset(buf,0,256); strcpy(buf,"hello ,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...

by aaaaal - C/C++ - 2005-09-26 14:00:17 阅读(3778) 回复(17)

fsync调用完之后为什么fd就废了? fsync 之后 调read 时把fd传进去 返回-1 错误打印“Bad file number” 不知道fsync对fd做了什么。。。。。。 代码如下:[code]int main() { int fd,byteswrite,bytesread; char buf[256]; int length; memset(buf,0,256); strcpy(buf,"hello ,this is a test"); length = strlen(buf); fd = creat("test.txt", O_RDWR|0777); ...

by joepayne - C/C++ - 2013-08-08 12:44:05 阅读(4701) 回复(4)

all operating systems give applications a way to force writes from the buffer cache to disk, and PostgreSQL uses those features. (See the 

by prefect - MySQL - 2011-12-21 08:42:51 阅读(1145) 回复(0)

#include #include #include int main() { FILE *fp=NULL; fp=fopen("file1","w"); fputs("11111111111111111111111\n",fp); //fflush(fp); fsync(fileno(fp)); sleep(200); } 在sleep过程中我用 cat file1显示为空,加一个fflush(fp)后,cat file1的内容为111111111111111111111

by 20040925 - C/C++ - 2009-09-18 15:21:10 阅读(1948) 回复(2)

fsync(fp)与fflush(fp)有什么本质区别?

by 20040925 - C/C++ - 2009-09-08 13:14:24 阅读(2237) 回复(4)

fsync函数:将缓冲区数据写回到磁盘文件 相关头文件:#include 函数表达式:int fsync(int fileds); 参数说明:fsync函数的参数filedes表示需要写回到磁盘的文件。 返回值说明:如果成功将文件写回到磁盘上返回0,失败则返回-1. 函数功能详解:fsync函数可以确保文件的实际写出,该函数会阻塞直到修改的盘块写到外存后才返回。 函数使用说明: fsyc函数会将内存中缓冲区中的数据内容回写到磁盘空间,但是是否会达到实际的回...

by 469412293 - Linux文档专区 - 2009-05-22 18:22:16 阅读(2528) 回复(0)