Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linprocfs/linprocfs.c
Show All 33 Lines | |||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
* | * | ||||
* @(#)procfs_status.c 8.4 (Berkeley) 6/15/94 | * @(#)procfs_status.c 8.4 (Berkeley) 6/15/94 | ||||
*/ | */ | ||||
#include "opt_compat.h" | |||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/blist.h> | #include <sys/blist.h> | ||||
#include <sys/conf.h> | #include <sys/conf.h> | ||||
#include <sys/exec.h> | #include <sys/exec.h> | ||||
Show All 11 Lines | |||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/ptrace.h> | #include <sys/ptrace.h> | ||||
#include <sys/resourcevar.h> | #include <sys/resourcevar.h> | ||||
#include <sys/sbuf.h> | #include <sys/sbuf.h> | ||||
#include <sys/sem.h> | #include <sys/sem.h> | ||||
#include <sys/smp.h> | #include <sys/smp.h> | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/sysent.h> | |||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/time.h> | #include <sys/time.h> | ||||
#include <sys/tty.h> | #include <sys/tty.h> | ||||
#include <sys/user.h> | #include <sys/user.h> | ||||
#include <sys/uuid.h> | #include <sys/uuid.h> | ||||
#include <sys/vmmeter.h> | #include <sys/vmmeter.h> | ||||
#include <sys/vnode.h> | #include <sys/vnode.h> | ||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <net/if.h> | #include <net/if.h> | ||||
#include <net/if_var.h> | #include <net/if_var.h> | ||||
#include <net/vnet.h> | #include <net/if_types.h> | ||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/vm_extern.h> | #include <vm/vm_extern.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#include <vm/vm_map.h> | #include <vm/vm_map.h> | ||||
#include <vm/vm_param.h> | #include <vm/vm_param.h> | ||||
#include <vm/vm_object.h> | #include <vm/vm_object.h> | ||||
#include <vm/swap_pager.h> | #include <vm/swap_pager.h> | ||||
#include <machine/clock.h> | #include <machine/clock.h> | ||||
#include <geom/geom.h> | #include <geom/geom.h> | ||||
#include <geom/geom_int.h> | #include <geom/geom_int.h> | ||||
#if defined(__i386__) || defined(__amd64__) | #if defined(__i386__) || defined(__amd64__) | ||||
#include <machine/cputypes.h> | #include <machine/cputypes.h> | ||||
#include <machine/md_var.h> | #include <machine/md_var.h> | ||||
#endif /* __i386__ || __amd64__ */ | #endif /* __i386__ || __amd64__ */ | ||||
#ifdef COMPAT_FREEBSD32 | |||||
#include <compat/freebsd32/freebsd32_util.h> | |||||
#endif | |||||
#include <compat/linux/linux_ioctl.h> | |||||
#include <compat/linux/linux_mib.h> | #include <compat/linux/linux_mib.h> | ||||
#include <compat/linux/linux_misc.h> | #include <compat/linux/linux_misc.h> | ||||
#include <compat/linux/linux_util.h> | #include <compat/linux/linux_util.h> | ||||
#include <fs/pseudofs/pseudofs.h> | #include <fs/pseudofs/pseudofs.h> | ||||
#include <fs/procfs/procfs.h> | #include <fs/procfs/procfs.h> | ||||
/* | /* | ||||
* Various conversion macros | * Various conversion macros | ||||
▲ Show 20 Lines • Show All 1,005 Lines • ▼ Show 20 Lines | linprocfs_doprocmaps(PFS_FILL_ARGS) | ||||
} | } | ||||
vm_map_unlock_read(map); | vm_map_unlock_read(map); | ||||
vmspace_free(vm); | vmspace_free(vm); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Criteria for interface name translation | |||||
*/ | |||||
#define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER) | |||||
static int | |||||
linux_ifname(struct ifnet *ifp, char *buffer, size_t buflen) | |||||
{ | |||||
struct ifnet *ifscan; | |||||
int ethno; | |||||
IFNET_RLOCK_ASSERT(); | |||||
/* Short-circuit non ethernet interfaces */ | |||||
if (!IFP_IS_ETH(ifp)) | |||||
return (strlcpy(buffer, ifp->if_xname, buflen)); | |||||
/* Determine the (relative) unit number for ethernet interfaces */ | |||||
ethno = 0; | |||||
TAILQ_FOREACH(ifscan, &V_ifnet, if_link) { | |||||
if (ifscan == ifp) | |||||
return (snprintf(buffer, buflen, "eth%d", ethno)); | |||||
if (IFP_IS_ETH(ifscan)) | |||||
ethno++; | |||||
} | |||||
return (0); | |||||
} | |||||
/* | |||||
* Filler function for proc/net/dev | * Filler function for proc/net/dev | ||||
*/ | */ | ||||
static int | static int | ||||
linprocfs_donetdev(PFS_FILL_ARGS) | linprocfs_donetdev(PFS_FILL_ARGS) | ||||
{ | { | ||||
char ifname[16]; /* XXX LINUX_IFNAMSIZ */ | char ifname[16]; /* XXX LINUX_IFNAMSIZ */ | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
static int | static int | ||||
linprocfs_doscsiscsi(PFS_FILL_ARGS) | linprocfs_doscsiscsi(PFS_FILL_ARGS) | ||||
{ | { | ||||
return (0); | return (0); | ||||
} | } | ||||
extern struct cdevsw *cdevsw[]; | |||||
/* | /* | ||||
* Filler function for proc/devices | * Filler function for proc/devices | ||||
*/ | */ | ||||
static int | static int | ||||
linprocfs_dodevices(PFS_FILL_ARGS) | linprocfs_dodevices(PFS_FILL_ARGS) | ||||
{ | { | ||||
char *char_devices; | char *char_devices; | ||||
sbuf_printf(sb, "Character devices:\n"); | sbuf_printf(sb, "Character devices:\n"); | ||||
▲ Show 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | |||||
linprocfs_uninit(PFS_INIT_ARGS) | linprocfs_uninit(PFS_INIT_ARGS) | ||||
{ | { | ||||
/* nothing to do, pseudofs will GC */ | /* nothing to do, pseudofs will GC */ | ||||
return (0); | return (0); | ||||
} | } | ||||
PSEUDOFS(linprocfs, 1, 0); | PSEUDOFS(linprocfs, 1, 0); | ||||
#if defined(__amd64__) | |||||
MODULE_DEPEND(linprocfs, linux_common, 1, 1, 1); | |||||
#else | |||||
MODULE_DEPEND(linprocfs, linux, 1, 1, 1); | MODULE_DEPEND(linprocfs, linux, 1, 1, 1); | ||||
#endif | |||||
MODULE_DEPEND(linprocfs, procfs, 1, 1, 1); | MODULE_DEPEND(linprocfs, procfs, 1, 1, 1); | ||||
MODULE_DEPEND(linprocfs, sysvmsg, 1, 1, 1); | MODULE_DEPEND(linprocfs, sysvmsg, 1, 1, 1); | ||||
MODULE_DEPEND(linprocfs, sysvsem, 1, 1, 1); | MODULE_DEPEND(linprocfs, sysvsem, 1, 1, 1); |