def validate(self):
        """ Validate pidfile and make it stale if needed"""

        if not self.fname:
            return
        try:
            with open(self.fname, "r") as f:
                wpid = int(f.read() or 0)

                if wpid <= 0:
                    return

                try:
                    os.kill(wpid, 0)
                    return wpid
                except __HOLE__, e:
                    if e[0] == errno.ESRCH:
                        return
                    raise e
        except IOError, e:
            if e[0] == errno.ENOENT:
                return
            raise e

# ---------------------------------------------------
#   Utils
# ---------------------------------------------------

#
#   Logging
#
dataset/ETHPy150Open ownport/pyservice/pyservice.py/Pidfile.validate