FreeBSD/lib/libprocstat/libprocstat.c
/*
 * kinfo types to filestat translation.
 */
kinfo types to filestat translation.
kinfo types to filestat translation .
static int
kinfo_type2fst(int kftype)
{
	static struct {
		int	kf_type;
		int	fst_type;
	} kftypes2fst[] = {
		{ KF_TYPE_CRYPTO, PS_FST_TYPE_CRYPTO },
		{ KF_TYPE_FIFO, PS_FST_TYPE_FIFO },
		{ KF_TYPE_KQUEUE, PS_FST_TYPE_KQUEUE },
		{ KF_TYPE_MQUEUE, PS_FST_TYPE_MQUEUE },
		{ KF_TYPE_NONE, PS_FST_TYPE_NONE },
		{ KF_TYPE_PIPE, PS_FST_TYPE_PIPE },
		{ KF_TYPE_PTS, PS_FST_TYPE_PTS },
		{ KF_TYPE_SEM, PS_FST_TYPE_SEM },
		{ KF_TYPE_SHM, PS_FST_TYPE_SHM },
		{ KF_TYPE_SOCKET, PS_FST_TYPE_SOCKET },
		{ KF_TYPE_VNODE, PS_FST_TYPE_VNODE },
		{ KF_TYPE_UNKNOWN, PS_FST_TYPE_UNKNOWN }
	};
#define NKFTYPES	(sizeof(kftypes2fst) / sizeof(*kftypes2fst))
	unsigned int i;
	for (i = 0; i < NKFTYPES; i++)
		if (kftypes2fst[i].kf_type == kftype)
			break;
	if (i == NKFTYPES)
		return (PS_FST_TYPE_UNKNOWN);
	return (kftypes2fst[i].fst_type);
}
static int kinfo_type2fst ( int kftype ) { static struct { int kf_type ; int fst_type ; } kftypes2fst [ ] = { { KF_TYPE_CRYPTO , PS_FST_TYPE_CRYPTO } , { KF_TYPE_FIFO , PS_FST_TYPE_FIFO } , { KF_TYPE_KQUEUE , PS_FST_TYPE_KQUEUE } , { KF_TYPE_MQUEUE , PS_FST_TYPE_MQUEUE } , { KF_TYPE_NONE , PS_FST_TYPE_NONE } , { KF_TYPE_PIPE , PS_FST_TYPE_PIPE } , { KF_TYPE_PTS , PS_FST_TYPE_PTS } , { KF_TYPE_SEM , PS_FST_TYPE_SEM } , { KF_TYPE_SHM , PS_FST_TYPE_SHM } , { KF_TYPE_SOCKET , PS_FST_TYPE_SOCKET } , { KF_TYPE_VNODE , PS_FST_TYPE_VNODE } , { KF_TYPE_UNKNOWN , PS_FST_TYPE_UNKNOWN } } ; #define NKFTYPES 	(sizeof(kftypes2fst) / sizeof(*kftypes2fst)) unsigned int i ; for ( i = 0 ; i < NKFTYPES ; i ++ ) if ( kftypes2fst [ i ] . kf_type == kftype ) break ; if ( i == NKFTYPES ) return ( PS_FST_TYPE_UNKNOWN ) ; return ( kftypes2fst [ i ] . fst_type ) ; }
kinfo types to filestat translation.
kinfo types to filestat translation .