

def __init__(self, pidfile, procname, uuid=None):
    self.pidfile = pidfile
    self.procname = procname
    self.uuid = uuid
    try:
        self.fd = os.open(pidfile, (os.O_CREAT | os.O_RDWR))
        fcntl.flock(self.fd, (fcntl.LOCK_EX | fcntl.LOCK_NB))
    except IOError:
        LOG.exception(_LE('Error while handling pidfile: %s'), pidfile)
        sys.exit(1)

dataset/ETHPy150Open openstack/neutron/neutron/agent/linux/daemon.py Pidfile.__init__/original