sys/net/if_clone.c
int
if_clone_list(struct if_clonereq *ifcr)
{
	char outbuf[IFNAMSIZ], *dst;
	struct if_clone *ifc;
	int count, error = 0;

	ifcr->ifcr_total = if_cloners_count;
	if ((dst = ifcr->ifcr_buffer) == NULL) {
		/* Just asking how many there are. */
		return (0);
	}

	if (ifcr->ifcr_count < 0)
		return (EINVAL);

	count = (if_cloners_count < ifcr->ifcr_count) ?
	    if_cloners_count : ifcr->ifcr_count;

	for (ifc = LIST_FIRST(&if_cloners); ifc != NULL && count != 0;
	     ifc = LIST_NEXT(ifc, ifc_list), count--, dst += IFNAMSIZ) {
		strlcpy(outbuf, ifc->ifc_name, IFNAMSIZ);
		error = copyout(outbuf, dst, IFNAMSIZ);
		if (error)
			break;
	}

	return (error);
}
/*
 * Provide list of interface cloners to userspace.
 */
Provide list of interface cloners to userspace.
Provide list of interface cloners to userspace .
int
if_clone_list(struct if_clonereq *ifcr)
{
	char outbuf[IFNAMSIZ], *dst;
	struct if_clone *ifc;
	int count, error = 0;
	ifcr->ifcr_total = if_cloners_count;
	if ((dst = ifcr->ifcr_buffer) == NULL) {
		return (0);
	}
	if (ifcr->ifcr_count < 0)
		return (EINVAL);
	count = (if_cloners_count < ifcr->ifcr_count) ?
	    if_cloners_count : ifcr->ifcr_count;
	for (ifc = LIST_FIRST(&if_cloners); ifc != NULL && count != 0;
	     ifc = LIST_NEXT(ifc, ifc_list), count--, dst += IFNAMSIZ) {
		strlcpy(outbuf, ifc->ifc_name, IFNAMSIZ);
		error = copyout(outbuf, dst, IFNAMSIZ);
		if (error)
			break;
	}
	return (error);
}
int if_clone_list ( struct if_clonereq * ifcr ) { char outbuf [ IFNAMSIZ ] , * dst ; struct if_clone * ifc ; int count , error = 0 ; ifcr -> ifcr_total = if_cloners_count ; if ( ( dst = ifcr -> ifcr_buffer ) == NULL ) { return ( 0 ) ; } if ( ifcr -> ifcr_count < 0 ) return ( EINVAL ) ; count = ( if_cloners_count < ifcr -> ifcr_count ) ? if_cloners_count : ifcr -> ifcr_count ; for ( ifc = LIST_FIRST ( & if_cloners ) ; ifc != NULL && count != 0 ; ifc = LIST_NEXT ( ifc , ifc_list ) , count -- , dst += IFNAMSIZ ) { strlcpy ( outbuf , ifc -> ifc_name , IFNAMSIZ ) ; error = copyout ( outbuf , dst , IFNAMSIZ ) ; if ( error ) break ; } return ( error ) ; }
Provide list of interface cloners to userspace.
Provide list of interface cloners to userspace .
/* Just asking how many there are. */