'Write PID and host data to the file, recording old values.'

def _write_lock_data(self):

    self.old_pid = self.pid
    self.old_host = self.host
    self.pid = os.getpid()
    self.host = socket.getfqdn()
    self._file.seek(0)
    self._file.write(('pid=%s,host=%s' % (self.pid, self.host)))
    self._file.truncate()
    self._file.flush()
    os.fsync(self._file.fileno())
