Python os 模块,fdatasync() 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用os.fdatasync()

项目:egt    作者:spanezz    | 项目源码 | 文件源码
def __exit__(self, exc_type, exc_val, exc_tb):
        if exc_type is None:
            self.outfd.flush()
            if self.sync: os.fdatasync(self.fd)
            os.fchmod(self.fd, self.osmode)
            os.rename(self.abspath, self.fname)
        else:
            os.unlink(self.abspath)
        self.outfd.close()
        return False
项目:mkbackup-btrfs    作者:xundeenergie    | 项目源码 | 文件源码
def fsync(self, isfsyncfile):
            self._fflush()
            if isfsyncfile and hasattr(os, 'fdatasync'):
                os.fdatasync(self.fd)
            else:
                os.fsync(self.fd)
项目:fuse-3ds    作者:ihaveamac    | 项目源码 | 文件源码
def fsync(self, path, datasync, fh):
        if not common.windows:
            if datasync != 0:
                os.fdatasync(fh)
            else:
                os.fsync(fh)
项目:useradm    作者:redbrick    | 项目源码 | 文件源码
def uidNumber_savenext(self, fd, uidNumber):
        """Save next uidNumber.

        Writes uidNumber to file descriptor fd, which must be the one
        returned by uidNumber_getnext(). Does not write anything if in
        test mode."""

        if not self.opt.test:
            os.lseek(fd, 0, 0)
            os.write(fd, '%s\n' % uidNumber)
            os.fdatasync(fd)