def get_pidfile(pidfile):
    '''
    Return the pid from a pidfile as an integer
    '''
    try:
        with salt.utils.files.fopen(pidfile) as pdf:
            pid = pdf.read().strip()
        return int(pid)
    except (OSError, IOError, TypeError, ValueError):
        return -1