linprocfs.c (189106) | linprocfs.c (190445) |
---|---|
1/*- 2 * Copyright (c) 2000 Dag-Erling Co��dan Sm��rgrav 3 * Copyright (c) 1999 Pierre Beyssac 4 * Copyright (c) 1993 Jan-Simon Pendry 5 * Copyright (c) 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by --- 29 unchanged lines hidden (view full) --- 38 * 39 * @(#)procfs_status.c 8.4 (Berkeley) 6/15/94 40 */ 41 42#include "opt_route.h" 43#include "opt_compat.h" 44 45#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 Dag-Erling Co��dan Sm��rgrav 3 * Copyright (c) 1999 Pierre Beyssac 4 * Copyright (c) 1993 Jan-Simon Pendry 5 * Copyright (c) 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by --- 29 unchanged lines hidden (view full) --- 38 * 39 * @(#)procfs_status.c 8.4 (Berkeley) 6/15/94 40 */ 41 42#include "opt_route.h" 43#include "opt_compat.h" 44 45#include <sys/cdefs.h> |
46__FBSDID("$FreeBSD: head/sys/compat/linprocfs/linprocfs.c 189106 2009-02-27 14:12:05Z bz $"); | 46__FBSDID("$FreeBSD: head/sys/compat/linprocfs/linprocfs.c 190445 2009-03-26 17:14:22Z ambrisko $"); |
47 48#include <sys/param.h> 49#include <sys/queue.h> 50#include <sys/blist.h> 51#include <sys/conf.h> 52#include <sys/exec.h> 53#include <sys/fcntl.h> 54#include <sys/filedesc.h> --- 15 unchanged lines hidden (view full) --- 70#include <sys/sysctl.h> 71#include <sys/systm.h> 72#include <sys/time.h> 73#include <sys/tty.h> 74#include <sys/user.h> 75#include <sys/vmmeter.h> 76#include <sys/vnode.h> 77#include <sys/vimage.h> | 47 48#include <sys/param.h> 49#include <sys/queue.h> 50#include <sys/blist.h> 51#include <sys/conf.h> 52#include <sys/exec.h> 53#include <sys/fcntl.h> 54#include <sys/filedesc.h> --- 15 unchanged lines hidden (view full) --- 70#include <sys/sysctl.h> 71#include <sys/systm.h> 72#include <sys/time.h> 73#include <sys/tty.h> 74#include <sys/user.h> 75#include <sys/vmmeter.h> 76#include <sys/vnode.h> 77#include <sys/vimage.h> |
78#include <sys/bus.h> |
|
78 79#include <net/if.h> 80#include <net/route.h> 81#include <net/vnet.h> 82 83#include <vm/vm.h> 84#include <vm/vm_extern.h> 85#include <vm/pmap.h> 86#include <vm/vm_map.h> 87#include <vm/vm_param.h> 88#include <vm/vm_object.h> 89#include <vm/swap_pager.h> 90 91#include <machine/clock.h> 92 | 79 80#include <net/if.h> 81#include <net/route.h> 82#include <net/vnet.h> 83 84#include <vm/vm.h> 85#include <vm/vm_extern.h> 86#include <vm/pmap.h> 87#include <vm/vm_map.h> 88#include <vm/vm_param.h> 89#include <vm/vm_object.h> 90#include <vm/swap_pager.h> 91 92#include <machine/clock.h> 93 |
94#include <geom/geom.h> 95#include <geom/geom_int.h> 96 |
|
93#if defined(__i386__) || defined(__amd64__) 94#include <machine/cputypes.h> 95#include <machine/md_var.h> 96#endif /* __i386__ || __amd64__ */ 97 98#ifdef COMPAT_LINUX32 /* XXX */ 99#include <machine/../linux32/linux.h> 100#else --- 253 unchanged lines hidden (view full) --- 354 mntfrom = fstype = "proc"; 355 else if (strcmp(fstype, "procfs") == 0) 356 continue; 357 358 if (strcmp(fstype, "linsysfs") == 0) { 359 sbuf_printf(sb, "/sys %s sysfs %s", mntto, 360 mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw"); 361 } else { | 97#if defined(__i386__) || defined(__amd64__) 98#include <machine/cputypes.h> 99#include <machine/md_var.h> 100#endif /* __i386__ || __amd64__ */ 101 102#ifdef COMPAT_LINUX32 /* XXX */ 103#include <machine/../linux32/linux.h> 104#else --- 253 unchanged lines hidden (view full) --- 358 mntfrom = fstype = "proc"; 359 else if (strcmp(fstype, "procfs") == 0) 360 continue; 361 362 if (strcmp(fstype, "linsysfs") == 0) { 363 sbuf_printf(sb, "/sys %s sysfs %s", mntto, 364 mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw"); 365 } else { |
366 /* For Linux msdosfs is called vfat */ 367 if (strcmp(fstype, "msdosfs") == 0) 368 fstype = "vfat"; |
|
362 sbuf_printf(sb, "%s %s %s %s", mntfrom, mntto, fstype, 363 mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw"); 364 } 365#define ADD_OPTION(opt, name) \ 366 if (mp->mnt_stat.f_flags & (opt)) sbuf_printf(sb, "," name); 367 ADD_OPTION(MNT_SYNCHRONOUS, "sync"); 368 ADD_OPTION(MNT_NOEXEC, "noexec"); 369 ADD_OPTION(MNT_NOSUID, "nosuid"); --- 8 unchanged lines hidden (view full) --- 378 } 379 mtx_unlock(&mountlist_mtx); 380 if (flep != NULL) 381 free(flep, M_TEMP); 382 return (error); 383} 384 385/* | 369 sbuf_printf(sb, "%s %s %s %s", mntfrom, mntto, fstype, 370 mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw"); 371 } 372#define ADD_OPTION(opt, name) \ 373 if (mp->mnt_stat.f_flags & (opt)) sbuf_printf(sb, "," name); 374 ADD_OPTION(MNT_SYNCHRONOUS, "sync"); 375 ADD_OPTION(MNT_NOEXEC, "noexec"); 376 ADD_OPTION(MNT_NOSUID, "nosuid"); --- 8 unchanged lines hidden (view full) --- 385 } 386 mtx_unlock(&mountlist_mtx); 387 if (flep != NULL) 388 free(flep, M_TEMP); 389 return (error); 390} 391 392/* |
393 * Filler function for proc/partitions 394 * 395 */ 396static int 397linprocfs_dopartitions(PFS_FILL_ARGS) 398{ 399 struct g_class *cp; 400 struct g_geom *gp; 401 struct g_provider *pp; 402 struct nameidata nd; 403 const char *lep; 404 char *dlep, *flep; 405 size_t lep_len; 406 int error; 407 int major, minor; 408 409 /* resolve symlinks etc. in the emulation tree prefix */ 410 NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, linux_emul_path, td); 411 flep = NULL; 412 error = namei(&nd); 413 lep = linux_emul_path; 414 if (error == 0) { 415 if (vn_fullpath(td, nd.ni_vp, &dlep, &flep) == 0) 416 lep = dlep; 417 vrele(nd.ni_vp); 418 VFS_UNLOCK_GIANT(NDHASGIANT(&nd)); 419 } 420 lep_len = strlen(lep); 421 422 g_topology_lock(); 423 error = 0; 424 sbuf_printf(sb, "major minor #blocks name rio rmerge rsect " 425 "ruse wio wmerge wsect wuse running use aveq\n"); 426 427 LIST_FOREACH(cp, &g_classes, class) { 428 if (strcmp(cp->name, "DISK") == 0 || 429 strcmp(cp->name, "PART") == 0) 430 LIST_FOREACH(gp, &cp->geom, geom) { 431 LIST_FOREACH(pp, &gp->provider, provider) { 432 if (linux_driver_get_major_minor( 433 pp->name, &major, &minor) != 0) { 434 major = 0; 435 minor = 0; 436 } 437 sbuf_printf(sb, "%d %d %lld %s " 438 "%d %d %d %d %d " 439 "%d %d %d %d %d %d\n", 440 major, minor, 441 (long long)pp->mediasize, pp->name, 442 0, 0, 0, 0, 0, 443 0, 0, 0, 0, 0, 0); 444 } 445 } 446 } 447 g_topology_unlock(); 448 449 if (flep != NULL) 450 free(flep, M_TEMP); 451 return (error); 452} 453 454 455/* |
|
386 * Filler function for proc/stat 387 */ 388static int 389linprocfs_dostat(PFS_FILL_ARGS) 390{ 391 struct pcpu *pcpu; 392 long cp_time[CPUSTATES]; 393 long *cp; --- 807 unchanged lines hidden (view full) --- 1201#if 0 1202 pfs_create_file(root, "modules", &linprocfs_domodules, 1203 NULL, NULL, NULL, PFS_RD); 1204#endif 1205 pfs_create_file(root, "mounts", &linprocfs_domtab, 1206 NULL, NULL, NULL, PFS_RD); 1207 pfs_create_file(root, "mtab", &linprocfs_domtab, 1208 NULL, NULL, NULL, PFS_RD); | 456 * Filler function for proc/stat 457 */ 458static int 459linprocfs_dostat(PFS_FILL_ARGS) 460{ 461 struct pcpu *pcpu; 462 long cp_time[CPUSTATES]; 463 long *cp; --- 807 unchanged lines hidden (view full) --- 1271#if 0 1272 pfs_create_file(root, "modules", &linprocfs_domodules, 1273 NULL, NULL, NULL, PFS_RD); 1274#endif 1275 pfs_create_file(root, "mounts", &linprocfs_domtab, 1276 NULL, NULL, NULL, PFS_RD); 1277 pfs_create_file(root, "mtab", &linprocfs_domtab, 1278 NULL, NULL, NULL, PFS_RD); |
1279 pfs_create_file(root, "partitions", &linprocfs_dopartitions, 1280 NULL, NULL, NULL, PFS_RD); |
|
1209 pfs_create_link(root, "self", &procfs_docurproc, 1210 NULL, NULL, NULL, 0); 1211 pfs_create_file(root, "stat", &linprocfs_dostat, 1212 NULL, NULL, NULL, PFS_RD); 1213 pfs_create_file(root, "uptime", &linprocfs_douptime, 1214 NULL, NULL, NULL, PFS_RD); 1215 pfs_create_file(root, "version", &linprocfs_doversion, 1216 NULL, NULL, NULL, PFS_RD); --- 72 unchanged lines hidden --- | 1281 pfs_create_link(root, "self", &procfs_docurproc, 1282 NULL, NULL, NULL, 0); 1283 pfs_create_file(root, "stat", &linprocfs_dostat, 1284 NULL, NULL, NULL, PFS_RD); 1285 pfs_create_file(root, "uptime", &linprocfs_douptime, 1286 NULL, NULL, NULL, PFS_RD); 1287 pfs_create_file(root, "version", &linprocfs_doversion, 1288 NULL, NULL, NULL, PFS_RD); --- 72 unchanged lines hidden --- |