Python os.fdatasync() Examples

The following are code examples for showing how to use os.fdatasync(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the exmaples you don't like. You can also save this page to your account.

Example 1
Project: egt   Author: spanezz   File: utils.py    (license) View Source Project 5 votes vote down vote up
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 
Example 2
Project: mkbackup-btrfs   Author: xundeenergie   File: MksnapshotFS.py    (license) View Source Project 5 votes vote down vote up
def fsync(self, isfsyncfile):
            self._fflush()
            if isfsyncfile and hasattr(os, 'fdatasync'):
                os.fdatasync(self.fd)
            else:
                os.fsync(self.fd) 
Example 3
Project: fuse-3ds   Author: ihaveamac   File: mount_sd.py    (license) View Source Project 5 votes vote down vote up
def fsync(self, path, datasync, fh):
        if not common.windows:
            if datasync != 0:
                os.fdatasync(fh)
            else:
                os.fsync(fh) 
Example 4
Project: useradm   Author: redbrick   File: rbuserdb.py    (license) View Source Project 5 votes vote down vote up
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)