svr4_sockio.c (105360) | svr4_sockio.c (108172) |
---|---|
1/* 2 * Copyright (c) 1998 Mark Newton 3 * Copyright (c) 1995 Christos Zoulas 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * | 1/* 2 * Copyright (c) 1998 Mark Newton 3 * Copyright (c) 1995 Christos Zoulas 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/compat/svr4/svr4_sockio.c 105360 2002-10-17 22:27:21Z robert $ | 28 * $FreeBSD: head/sys/compat/svr4/svr4_sockio.c 108172 2002-12-22 05:35:03Z hsu $ |
29 */ 30 31#include <sys/param.h> 32#include <sys/proc.h> 33#include <sys/systm.h> 34#include <sys/file.h> 35#include <sys/filedesc.h> 36#include <sys/sockio.h> --- 58 unchanged lines hidden (view full) --- 95 * + addresses like ifconf() does, because this number 96 * is used by code that will call SVR4_SIOCGIFCONF to 97 * find the space needed for SVR4_SIOCGIFCONF. So we 98 * count the number of ifreq entries that the next 99 * SVR4_SIOCGIFCONF will return. Maybe a more correct 100 * fix is to make SVR4_SIOCGIFCONF return only one 101 * entry per physical interface? 102 */ | 29 */ 30 31#include <sys/param.h> 32#include <sys/proc.h> 33#include <sys/systm.h> 34#include <sys/file.h> 35#include <sys/filedesc.h> 36#include <sys/sockio.h> --- 58 unchanged lines hidden (view full) --- 95 * + addresses like ifconf() does, because this number 96 * is used by code that will call SVR4_SIOCGIFCONF to 97 * find the space needed for SVR4_SIOCGIFCONF. So we 98 * count the number of ifreq entries that the next 99 * SVR4_SIOCGIFCONF will return. Maybe a more correct 100 * fix is to make SVR4_SIOCGIFCONF return only one 101 * entry per physical interface? 102 */ |
103 | 103 IFNET_RLOCK(); |
104 TAILQ_FOREACH(ifp, &ifnet, if_link) 105 if (TAILQ_FIRST(&ifp->if_addrhead) == NULL) 106 ifnum++; 107 else 108 TAILQ_FOREACH(ifa, &ifp->if_addrhead, 109 ifa_link) 110 ifnum++; | 104 TAILQ_FOREACH(ifp, &ifnet, if_link) 105 if (TAILQ_FIRST(&ifp->if_addrhead) == NULL) 106 ifnum++; 107 else 108 TAILQ_FOREACH(ifa, &ifp->if_addrhead, 109 ifa_link) 110 ifnum++; |
111 112 | 111 IFNET_RUNLOCK(); |
113 DPRINTF(("SIOCGIFNUM %d\n", ifnum)); 114 return copyout(&ifnum, data, sizeof(ifnum)); 115 } 116 117 case SVR4_SIOCGIFFLAGS: 118 { 119 struct ifreq br; 120 struct svr4_ifreq sr; --- 46 unchanged lines hidden --- | 112 DPRINTF(("SIOCGIFNUM %d\n", ifnum)); 113 return copyout(&ifnum, data, sizeof(ifnum)); 114 } 115 116 case SVR4_SIOCGIFFLAGS: 117 { 118 struct ifreq br; 119 struct svr4_ifreq sr; --- 46 unchanged lines hidden --- |