8 * Given a pointer to an interface in the kernel, return a pointer to a
9 * string which is the interface name.
14 #if SOLARIS || defined(__hpux)
16 # include <sys/mutex.h>
17 # include <sys/condvar.h>
22 # include "../pfil/qif.h"
26 if ((void *)ptr == (void *)-1)
31 if (kmemcpy((char *)&qif, (u_long)ptr, sizeof(qif)) == -1)
33 ifname = strdup(qif.qf_name);
34 if ((ifname != NULL) && (*ifname == '\0')) {
40 # if defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011) || \
41 defined(__OpenBSD__) || \
42 (defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
49 if ((void *)ptr == (void *)-1)
54 if (kmemcpy((char *)&netif, (u_long)ptr, sizeof(netif)) == -1)
56 # if defined(NetBSD) && (NetBSD >= 199905) && (NetBSD < 1991011) || \
57 defined(__OpenBSD__) || defined(linux) || \
58 (defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
59 return strdup(netif.if_xname);
61 if (kstrncpy(buf, (u_long)netif.if_name, sizeof(buf)) == -1)
63 if (netif.if_unit < 10)
65 else if (netif.if_unit < 1000)
67 else if (netif.if_unit < 10000)
71 buf[sizeof(buf) - len] = '\0';
72 sprintf(buf + strlen(buf), "%d", netif.if_unit % 10000);