FreeBSD/sbin/atm/atmconfig/diag.c
/*
 * Fetch the table of open vccs
 */
Fetch the table of open vccs
Fetch the table of open vccs
void
diagif_fetch_vcc(struct diagif *aif, int fd)
{
	struct ifreq ifr;
	if (aif->vtab != NULL)
		return;
	strncpy(ifr.ifr_name, aif->ifname, IFNAMSIZ);
	ifr.ifr_name[IFNAMSIZ - 1] = '\0';
	aif->vtab = malloc(sizeof(*aif->vtab) + sizeof(aif->vtab->vccs[0]) *
	    aif->mib.max_vccs);
	if (aif->vtab == NULL)
		err(1, NULL);
	ifr.ifr_data = (caddr_t)aif->vtab;
	if (ioctl(fd, SIOCATMGVCCS, &ifr) == -1)
		err(1, "SIOCATMGVCCS");
}
void diagif_fetch_vcc ( struct diagif * aif , int fd ) { struct ifreq ifr ; if ( aif -> vtab != NULL ) return ; strncpy ( ifr . ifr_name , aif -> ifname , IFNAMSIZ ) ; ifr . ifr_name [ IFNAMSIZ - 1 ] = ' \0 ' ; aif -> vtab = malloc ( sizeof ( * aif -> vtab ) + sizeof ( aif -> vtab -> vccs [ 0 ] ) * aif -> mib . max_vccs ) ; if ( aif -> vtab == NULL ) err ( 1 , NULL ) ; ifr . ifr_data = ( caddr_t ) aif -> vtab ; if ( ioctl ( fd , SIOCATMGVCCS , & ifr ) == -1 ) err ( 1 , " " ) ; }
Fetch the table of open vccs
Fetch the table of open vccs