def meminfo():
    '''
    Return the memory info for this minion

    .. versionchanged:: 2016.11.4
        Added support for AIX

    .. versionchanged:: 2018.3.0
        Added support for OpenBSD

    CLI Example:

    .. code-block:: bash

        salt '*' status.meminfo
    '''
    def linux_meminfo():
        '''
        linux specific implementation of meminfo
        '''
        ret = {}
        try:
            with salt.utils.files.fopen('/proc/meminfo', 'r') as fp_:
                stats = salt.utils.stringutils.to_unicode(fp_.read())
        except IOError:
            pass
        else:
            for line in stats.splitlines():
                if not line:
                    continue
                comps = line.split()
                comps[0] = comps[0].replace(':', '')
                ret[comps[0]] = {
                    'value': comps[1],
                }
                if len(comps) > 2:
                    ret[comps[0]]['unit'] = comps[2]
        return ret

    def freebsd_meminfo():
        '''
        freebsd specific implementation of meminfo
        '''
        sysctlvm = __salt__['cmd.run']('sysctl vm').splitlines()
        sysctlvm = [x for x in sysctlvm if x.startswith('vm')]
        sysctlvm = [x.split(':') for x in sysctlvm]
        sysctlvm = [[y.strip() for y in x] for x in sysctlvm]
        sysctlvm = [x for x in sysctlvm if x[1]]  # If x[1] not empty

        ret = {}
        for line in sysctlvm:
            ret[line[0]] = line[1]
        # Special handling for vm.total as it's especially important
        sysctlvmtot = __salt__['cmd.run']('sysctl -n vm.vmtotal').splitlines()
        sysctlvmtot = [x for x in sysctlvmtot if x]
        ret['vm.vmtotal'] = sysctlvmtot
        return ret

    def aix_meminfo():
        '''
        AIX specific implementation of meminfo
        '''
        ret = {}
        ret['svmon'] = []
        ret['vmstat'] = []
        procn = None
        fields = []
        pagesize_flag = False
        for line in __salt__['cmd.run']('svmon -G').splitlines():
            # Note: svmon is per-system
            #               size       inuse        free         pin     virtual   mmode
            #memory      1048576     1039740        8836      285078      474993     Ded
            #pg space     917504        2574
            #
            #               work        pers        clnt       other
            #pin          248379           0        2107       34592
            #in use       474993           0      564747
            #
            #PageSize   PoolSize       inuse        pgsp         pin     virtual
            #s    4 KB         -      666956        2574       60726      102209
            #m   64 KB         -       23299           0       14022       23299
            if not line:
                continue

            if re.match(r'\s', line):
                # assume fields line
                fields = line.split()
                continue

            if line.startswith('memory') or line.startswith('pin'):
                procn = len(ret['svmon'])
                ret['svmon'].append({})
                comps = line.split()
                ret['svmon'][procn][comps[0]] = {}
                for i in range(0, len(fields)):
                    if len(comps) > i + 1:
                        ret['svmon'][procn][comps[0]][fields[i]] = comps[i+1]
                continue

            if line.startswith('pg space') or line.startswith('in use'):
                procn = len(ret['svmon'])
                ret['svmon'].append({})
                comps = line.split()
                pg_space = '{0} {1}'.format(comps[0], comps[1])
                ret['svmon'][procn][pg_space] = {}
                for i in range(0, len(fields)):
                    if len(comps) > i + 2:
                        ret['svmon'][procn][pg_space][fields[i]] = comps[i+2]
                continue

            if line.startswith('PageSize'):
                fields = line.split()
                pagesize_flag = False
                continue

            if pagesize_flag:
                procn = len(ret['svmon'])
                ret['svmon'].append({})
                comps = line.split()
                ret['svmon'][procn][comps[0]] = {}
                for i in range(0, len(fields)):
                    if len(comps) > i:
                        ret['svmon'][procn][comps[0]][fields[i]] = comps[i]
                continue

        for line in __salt__['cmd.run']('vmstat -v').splitlines():
            # Note: vmstat is per-system
            if not line:
                continue

            procn = len(ret['vmstat'])
            ret['vmstat'].append({})
            comps = line.lstrip().split(' ', 1)
            ret['vmstat'][procn][comps[1]] = comps[0]

        return ret

    def openbsd_meminfo():
        '''
        openbsd specific implementation of meminfo
        '''
        vmstat = __salt__['cmd.run']('vmstat').splitlines()
        # We're only interested in memory and page values which are printed
        # as subsequent fields.
        fields = ['active virtual pages', 'free list size', 'page faults',
                  'pages reclaimed', 'pages paged in', 'pages paged out',
                  'pages freed', 'pages scanned']
        data = vmstat[2].split()[2:10]
        ret = dict(zip(fields, data))
        return ret

    # dict that return a function that does the right thing per platform
    get_version = {
        'Linux': linux_meminfo,
        'FreeBSD': freebsd_meminfo,
        'OpenBSD': openbsd_meminfo,
        'AIX': aix_meminfo,
    }

    errmsg = 'This method is unsupported on the current operating system!'
    return get_version.get(__grains__['kernel'], lambda: errmsg)()