FreeBSD Bugzilla – Attachment 14507 Details for
Bug 27253
linprocfs does not implement the loadavg file.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.79 KB, created by
Jim.Pirzyk
on 2001-05-10 19:10:03 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Jim.Pirzyk
Created:
2001-05-10 19:10:03 UTC
Size:
3.79 KB
patch
obsolete
>*** ./sys/i386/linux/linprocfs/linprocfs.h.orig Mon Oct 30 11:57:04 2000 >--- ./sys/i386/linux/linprocfs/linprocfs.h Tue May 8 09:09:50 2001 >*************** >*** 57,62 **** >--- 57,63 ---- > Pstat, /* kernel/system statistics */ > Puptime, /* system uptime */ > Pversion, /* system version */ >+ Ploadavg, /* system load average */ > } pfstype; > > /* >*************** >*** 132,137 **** >--- 133,139 ---- > int linprocfs_doversion __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio)); > int linprocfs_doprocstat __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio)); > int linprocfs_doprocstatus __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio)); >+ int linprocfs_doloadavg __P((struct proc *, struct proc *, struct pfsnode *pfsp, struct uio *uio)); > > /* functions to check whether or not files should be displayed */ > int linprocfs_validfile __P((struct proc *)); >*** ./sys/i386/linux/linprocfs/linprocfs_misc.c.orig Thu Dec 7 05:17:55 2000 >--- ./sys/i386/linux/linprocfs/linprocfs_misc.c Tue May 8 16:09:17 2001 >*************** >*** 495,498 **** >--- 495,531 ---- > ps = psbuf + uio->uio_offset; > xlen = imin(xlen, uio->uio_resid); > return (xlen <= 0 ? 0 : uiomove(ps, xlen, uio)); >+ } >+ >+ int >+ linprocfs_doloadavg(curp, p, pfs, uio) >+ struct proc *curp; >+ struct proc *p; >+ struct pfsnode *pfs; >+ struct uio *uio; >+ { >+ char *ps, psbuf[512]; >+ int xlen; >+ extern int nextpid; >+ >+ ps=psbuf; >+ >+ ps += sprintf(ps, >+ "%d.%02d %d.%02d %d.%02d %d/%d %d\n", >+ (int)(averunnable.ldavg[0] / averunnable.fscale), >+ (int)(averunnable.ldavg[0] * 100 / averunnable.fscale % 100), >+ (int)(averunnable.ldavg[1] / averunnable.fscale), >+ (int)(averunnable.ldavg[1] * 100 / averunnable.fscale % 100), >+ (int)(averunnable.ldavg[2] / averunnable.fscale), >+ (int)(averunnable.ldavg[2] * 100 / averunnable.fscale % 100), >+ 1, /* number of running tasks */ >+ -1, /* number of tasks */ >+ nextpid /* The last pid */ >+ ); >+ >+ xlen = ps - psbuf; >+ xlen -= uio->uio_offset; >+ ps = psbuf + uio->uio_offset; >+ xlen = imin(xlen, uio->uio_resid); >+ return (xlen <= 0 ? 0 : uiomove(ps, xlen, uio)); > } >*** ./sys/i386/linux/linprocfs/linprocfs_subr.c.orig Mon Oct 30 11:57:04 2000 >--- ./sys/i386/linux/linprocfs/linprocfs_subr.c Tue May 8 09:13:20 2001 >*************** >*** 184,189 **** >--- 184,190 ---- > case Pstat: > case Puptime: > case Pversion: >+ case Ploadavg: > pfs->pfs_mode = (VREAD) | > (VREAD >> 3) | > (VREAD >> 6); >*************** >*** 275,280 **** >--- 276,284 ---- > break; > case Pversion: > rtval = linprocfs_doversion(curp, p, pfs, uio); >+ break; >+ case Ploadavg: >+ rtval = linprocfs_doloadavg(curp, p, pfs, uio); > break; > default: > rtval = EOPNOTSUPP; >*** ./sys/i386/linux/linprocfs/linprocfs_vnops.c.orig Mon Oct 30 11:57:04 2000 >--- ./sys/i386/linux/linprocfs/linprocfs_vnops.c Tue May 8 09:14:47 2001 >*************** >*** 529,534 **** >--- 529,535 ---- > case Pstat: > case Puptime: > case Pversion: >+ case Ploadavg: > vap->va_bytes = vap->va_size = 0; > vap->va_uid = 0; > vap->va_gid = 0; >*************** >*** 706,711 **** >--- 707,714 ---- > return (linprocfs_allocvp(dvp->v_mount, vpp, 0, Puptime)); > if (CNEQ(cnp, "version", 7)) > return (linprocfs_allocvp(dvp->v_mount, vpp, 0, Pversion)); >+ if (CNEQ(cnp, "loadavg", 7)) >+ return (linprocfs_allocvp(dvp->v_mount, vpp, 0, Ploadavg)); > > pid = atopid(pname, cnp->cn_namelen); > if (pid == NO_PID) >*************** >*** 901,906 **** >--- 904,917 ---- > bcopy("version", dp->d_name, 8); > dp->d_type = DT_REG; > break; >+ >+ case 8: >+ dp->d_fileno = PROCFS_FILENO(0, Ploadavg); >+ dp->d_namlen = 7; >+ bcopy("loadavg", dp->d_name, 8); >+ dp->d_type = DT_REG; >+ break; >+ > > default: > while (pcnt < i) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 27253
: 14507