Commit 03a9b5a3 authored by csmall's avatar csmall

procps 010114

parents
diff -Naur procps-2.0.6/.cvsignore procps-2.0.7/.cvsignore
--- procps-2.0.6/.cvsignore Wed Dec 31 19:00:00 1969
+++ procps-2.0.7/.cvsignore Fri Jul 14 16:45:01 2000
@@ -0,0 +1,14 @@
+skill
+kill
+oldps
+uptime
+tload
+free
+w
+top
+vmstat
+watch
+snice
+pgrep
+pkill
+sysctl
BUG REPORTS
Please read this file before sending in a bug report or patch.
Also, PLEASE read the documentation first. 90% of the mail I get
complaining about procps is due to the sender not having read the
documentation!
Where to send
=============
Send comments, bug reports, patches, etc., to acahalan@cs.uml.edu
What to send
============
It is much more useful to me if a program really crases to recompile it
with make "CC=gcc -ggdb -O", run it with "gdb prog" and "run" and send
me a stack trace ('bt' command). That said, any bug report is still
better than none.
It might be nice to get rid of miscellaneous compiler warnings, but
don't bend over backwards to do it.
Kernel-Dependent Patches
========================
If you send me patches which are specific to *running* with a particular
kernel version of /proc, please condition them with the runtime determined
variable `linux_version_code' from libproc/kvers.c. It is the same
number as the macro LINUX_VERSION_CODE for which the kernel /proc fs
code was compiled.
A macro is provide in libproc/version.h to construct the code from its
components, e.g.
if (linux_version_code < LINUX_VERSION(1,1,30))
/* tty field is only a minor */
A startup call to set_linux_version may also be necessary.
Of course, if a bug is due to a change in kernel file formats, it would
be best to first try to generalize the parsing, since the code is then
more resilient against future change.
If you send me patches which are specific to *compiling* on a particular
version of Linux include a "#if LINUX_VERSION_CODE > 1*0x10000+3*0x100+54"
markup of the patch so that the package may be compiled with older
kernels as well as the "latest and greatest". LINUX_VERSION_CODE is
#define'd in <linux/version.h>.
Note that you should not make patches specific to *compiling* on a
particular version of Linux unless there is nothing else you can do.
Also unified diffs (diff -u) are my preference, context diffs (diff -c )
are kind of usable, and standard diffs (diff) are more useless than a
generic text description of what you did. Just use
diff -u oldfile newfile
or
diff -Naur old-procps-dir new-procps-dir
to create your diffs and you will make me happy. Also make sure to
include a description of what the diff is for or I'm likely to ignore
it because of general lack of time...
Code Structure
==============
My ultimate goal for this package is to be compilable with any kernel
headers and to be able to run under any kernel's /proc. (Don't bother
telling me that I'm not especially close to my ultimate goal... who
is? :-)
Anyhow, another goal is to encapsulate *all* parsing dependent on /proc
file formats into the libproc library. If the API is general enough
it can hopefully stabilize and then /proc changes might only require
updating libproc.so. Beyond that having the set of utilities be simple
command lines parsers and output formatters and encapsulating all kernel
divergence in libproc is the way to go.
Hence if you are submitting a new program or are fixing an old one, keep
in mind that adding files to libproc which encapsulate such things is
more desirable than patching the actual driver program. (well, except
to move it toward the API of the library).
This diff is collapsed.
This diff is collapsed.
INSTALL for procps version 2.0.1
================================
Please read the NEWS and BUGS files, also.
==========================================
Re-compiling the package
========================
You want to examine the first 30 or so lines of the Makefile (up to the
configurability note). The destinations of various things attempt FSSTND
compliance, and are pretty standard. The CC/LD flags and which libraries you
use for curses/termcap are here also. It is all annotated there and in a
readily understood format: directories, program to installdir mapping,
sub-packages to build, and compilation options. A few extra points worth
mentioning are:
o The SUBDIRS variable is essentially just a list of subdirectories to
perform a recursive make or make install in. Right now that's just
ps; the old xproc has been removed because it was entirely redundant.
o There is also an option to build and link against a libproc.so which
reduces 'ps' and 'top' sizes by a large fraction. It is on by default,
so change the value of SHARED if you want.
o 'make libinstall' will install the library and header files into standard
system directories for developers of /proc utilities. There are no
library man pages yet, but the headers are fairly well documented.
o You may need to change the INCDIRS definition if your system is
not very standard. The current definition has been tested to work
on several different systems, though.
Once you are satisfied with the top-level Makefile options (and possibly those
in subdirectories) you compile and install the package like so:
(ignore innocuous `rcsid' defined-but-not-used warnings.)
make distclean # clean-out everything to re-make from scratch
make # takes about 0.75 minutes on a PPro 200 with SCSI
su # for write/chown-perms on sys dirs
make install
ldconfig -v # update ld.so to use new libproc if SHARED=1
exit
make distclean # remove anything that can be rebuilt
Miscellaneous Notes
===================
COMPATIBILITY
This code is intended for use with Linux 2.0.xx and 2.2.xx.
Both libc 5 and libc 6 should work.
PS/TOP WCHAN FIELD
In past releases, in order to get WCHAN output for ps, you had to
have a psdatabase for each zImage kernel that you generated from
the vmlinux unstripped binary with /sbin/psupdate. With this release,
you should use the System.map automatically generated by Linus' makefile.
'ps' and 'top' will first use the contents of an environment variable
"PS_SYSTEM_MAP" and then look for System.map files along
the followin search path:
/boot/System.map-V, /boot/System.map, /lib/modules/V/System.map,
Here 'V' is the output of "uname -r" and looks like "2.2.0".
Don't forget the dash! In those same locations, remove psdatabase* files.
PARTIAL INSTALLATION
If you just want to install one program use the targets
install_progname and install_progname.X (where X is the man section)
instead. E.g.
make install_ps install_ps.1
Likewise for component packages, e.g.
make install_psmisc
# Makefile for procps. Chuck Blake.
# Portions of this are highly dependent upon features specific to GNU make
export PREFIX = #proc# prefix for program names
export DESTDIR = /
export MANDIR = /usr/man
export MAN1DIR = $(DESTDIR)$(MANDIR)/man1
export MAN5DIR = $(DESTDIR)$(MANDIR)/man5
export MAN8DIR = $(DESTDIR)$(MANDIR)/man8
export BINDIR = $(DESTDIR)/bin
export SBINDIR = $(DESTDIR)/sbin
export XBINDIR = $(DESTDIR)/usr/X11R6/bin
export USRBINDIR = $(DESTDIR)/usr/bin
export PROCDIR = $(DESTDIR)/usr/bin# /usr/proc/bin for Solaris devotees
export APPLNK = $(DESTDIR)/etc/X11/applnk/Utilities
export OWNERGROUP = --owner 0 --group 0
export INSTALLBIN = install --mode a=rx --strip
export INSTALLSCT = install --mode a=rx
export INSTALLMAN = install --mode a=r
BPROG = kill # -> BINDIR
UPROG = oldps uptime tload free w top vmstat watch skill snice # -> USRBINDIR
PPROG = pgrep pkill# -> PROCDIR
SPROG = sysctl
MAN1 = oldps.1 uptime.1 tload.1 free.1 w.1 top.1 watch.1 skill.1 kill.1 snice.1 pgrep.1 pkill.1
MAN5 = sysctl.conf.5
MAN8 = vmstat.8 sysctl.8
DESKTOP = top.desktop
XSCPT = XConsole # -> XBINDIR
SUBDIRS = ps # sub-packages to build/install
# easy to command-line override
export INCDIRS = -I/usr/include/ncurses -I/usr/X11R6/include
export CC = gcc #-ggdb # this gets compiling and linking :-)
export OPT = -O2
export CFLAGS = -D_GNU_SOURCE $(OPT) -I$(shell pwd) $(INCDIRS) -W -Wall -Wstrict-prototypes -Wshadow -Wcast-align -Wmissing-prototypes
export SHARED = 1# build/install both a static and ELF shared library
export SHLIBDIR = $(DESTDIR)/lib# where to install the shared library
export LDFLAGS = -Wl,-warn-common #-s recommended for ELF systems
#LDFLAGS = -qmagic -s# recommended for a.out systems
#LDFLAGS = -Xlinker -qmagic -s# older a.out systems may need this
#LDFLAGS = -N -s# still older a.out systems use this
#BFD_CAPABLE = -DBFD_CAPABLE
#AOUT_CAPABLE = #-DAOUT_CAPABLE
#ELF_CAPABLE = #-DELF_CAPABLE
#LIBBFD = -lbfd -liberty
LIBCURSES = -lncurses# watch is the only thing that needs this
#LIBCURSES = -lcurses -ltermcap# BSD Curses requires termcap
LIBTERMCAP = -lncurses# provides perfectly good termcap support
#LIBTERMCAP = -ltermcap
EXTRALIBS = # -lshadow
W_SHOWFROM = -DW_SHOWFROM# show remote host users are logged in from.
#----------------------------------------------------#
# End of user-configurable portion of the Makefile. #
# You should not need to modify anything below this. #
#----------------------------------------------------#
BUILD = $(BPROG) $(UPROG) $(PPROG) $(SPROG) $(SUBDIRS) $(DESKTOP)
# BUILD LIBRARIES + PROGRAMS
all: $(BUILD)
# INSTALL PROGRAMS + DOCS
install: $(patsubst %,install_%,$(BUILD) $(XSCPT) $(MAN1) $(MAN5) $(MAN8))
ifeq ($(SHARED),1)
install $(OWNERGROUP) --mode a=rx $(LIB_TGT) $(SHLIBDIR)
endif
# INSTALL LIBRARIES + HEADERS (OPTIONAL)
libinstall:
$(MAKE) -C proc install $(LIBPROCPASS)
clean:
$(RM) -f $(OBJ) $(BPROG) $(UPROG) $(PPROG) $(SPROG)
for i in proc $(SUBDIRS); do $(MAKE) -C $$i clean; done
distclean: clean
for i in proc $(SUBDIRS); do $(MAKE) -C $$i clean; done
$(RM) -f $(OBJ) $(BPROG) $(UPROG) $(SPROG) \
proc/.depend
#-----------------------------------------------------#
# End of user-callable make targets. #
# You should not need to read anything below this. #
#-----------------------------------------------------#
.PHONY: all install libinstall clean distclean
.PHONY: $(patsubst %,install_%, $(BPROG) $(UPROG) $(SPROG))
.PHONY: proc ps
.PHONY: $(patsubst %,build_%, proc ps)
.PHONY: $(patsubst %,install_%, proc ps)
VERSION = $(shell awk '/^%define major_version/ { print $$3 }' < procps.spec)
SUBVERSION = $(shell awk '/^%define minor_version/ { print $$3 }' < procps.spec)
MINORVERSION = $(shell awk '/^%define revision/ { print $$3 }' < procps.spec)
# Note: LIBVERSION may be less than $(VERSION).$(SUBVERSION).$(MINORVERSION)
# LIBVERSION is only set to current $(VERSION).$(SUBVERSION).$(MINORVERSION)
# when an incompatible change is made in libproc.
LIBVERSION = 2.0.7
ifdef MINORVERSION
LIBPROCPASS = SHARED=$(SHARED) SHLIBDIR=$(SHLIBDIR) VERSION=$(VERSION) SUBVERSION=$(SUBVERSION) MINORVERSION=$(MINORVERSION) LIBVERSION=$(LIBVERSION)
else
LIBPROCPASS = SHARED=$(SHARED) SHLIBDIR=$(SHLIBDIR) VERSION=$(VERSION) SUBVERSION=$(SUBVERSION) LIBVERSION=$(LIBVERSION)
endif
# libproc setup
ifeq ($(SHARED),1)
LIB_TGT = proc/libproc.so.$(LIBVERSION)
else
LIB_TGT = proc/libproc.a
endif
$(LIB_TGT): $(wildcard proc/*.[ch])
$(MAKE) -C proc `basename $(LIB_TGT)` $(LIBPROCPASS)
# component package setup -- the pattern should be obvious: A build rule and
# unified executable+documentation install rule. (An extra makefile rule is
# needed for those packages which use Imake.)
ps: build_ps
build_ps: ; $(MAKE) -C ps
install_ps: ps ; $(MAKE) -C ps install
# executable dependencies
oldps kill skill snice top w uptime tload free vmstat utmp : $(LIB_TGT)
# static pattern build/link rules:
%.o : %.c
$(strip $(CC) $(CFLAGS) -c $^)
oldps w uptime tload free vmstat utmp pgrep: % : %.o
$(strip $(CC) $(LDFLAGS) -o $@ $< $(LIB_TGT) $(EXTRALIBS))
# special instances of link rules (need extra libraries/objects)
top: % : %.o
$(strip $(CC) $(LDFLAGS) -o $@ $^ $(LIB_TGT) $(LIBTERMCAP) $(EXTRALIBS))
watch: % : %.o
$(strip $(CC) $(SLDFLAGS) -o $@ $< $(LIBCURSES) $(EXTRALIBS))
# special instances of compile rules (need extra defines)
w.o: w.c
$(strip $(CC) $(CFLAGS) $(W_SHOWFROM) -c $<)
top.o: top.c
$(strip $(CC) $(CFLAGS) -fwritable-strings -c $<)
skill.o: skill.c
$(strip $(CC) $(CFLAGS) -DSYSV -c $<)
snice: skill
ln -f skill snice
kill: skill
ln -f skill kill
pkill: pgrep
ln -f pgrep pkill
# static pattern installation rules
$(patsubst %,install_%,$(BPROG)): install_%: %
$(INSTALLBIN) $< $(BINDIR)/$(PREFIX)$<
$(patsubst %,install_%,$(SPROG)): install_%: %
$(INSTALLBIN) $< $(SBINDIR)/$(PREFIX)$<
$(patsubst %,install_%,$(UPROG)): install_%: %
$(INSTALLBIN) $< $(USRBINDIR)/$(PREFIX)$<
$(patsubst %,install_%,$(PPROG)): install_%: %
$(INSTALLBIN) $< $(PROCDIR)/$(PREFIX)$<
$(patsubst %,install_%,$(XSCPT)): install_%: %
$(INSTALLSCT) $< $(XBINDIR)/$(PREFIX)$<
$(patsubst %,install_%,$(MAN1)) : install_%: %
$(INSTALLMAN) $< $(MAN1DIR)/$(PREFIX)$<
$(patsubst %,install_%,$(MAN5)) : install_%: %
$(INSTALLMAN) $< $(MAN5DIR)/$(PREFIX)$<
$(patsubst %,install_%,$(MAN8)) : install_%: %
$(INSTALLMAN) $< $(MAN8DIR)/$(PREFIX)$<
$(patsubst %,install_%,$(DESKTOP)) : install_%: %
$(INSTALLSCT $< $(APPLNK)/$(PREFIX)$<
# special case install rules
install_snice: snice install_skill
cd $(USRBINDIR) && ln -f skill snice
install_kill: snice install_skill
cd $(USRBINDIR) && ln -f skill kill
install_pkill: pgrep install_pgrep
cd $(USRBINDIR) && ln -f pgrep pkill
# Find all the source and object files in this directory
SRC = $(sort $(wildcard *.c))
OBJ = $(SRC:.c=.o)
CVSTAG = ps_$(VERSION)_$(SUBVERSION)_$(MINORVERSION)
FILEVERSION = $(VERSION).$(SUBVERSION).$(MINORVERSION)
dist: archive
archive:
@cvs -Q tag -F $(CVSTAG)
@rm -rf /tmp/procps
@cd /tmp; cvs -Q -d $(CVSROOT) export -r$(CVSTAG) procps || echo GRRRrrrrr -- ignore [export aborted]
@mv /tmp/procps /tmp/procps-$(FILEVERSION)
@cd /tmp; tar czSpf procps-$(FILEVERSION).tar.gz procps-$(FILEVERSION)
@cd /tmp; cp procps-$(FILEVERSION)/procps.lsm procps-$(FILEVERSION).lsm
@rm -rf /tmp/procps-$(FILEVERSION)
@echo "The final archive is /tmp/procps-$(FILEVERSION).tar.gz"
This diff is collapsed.
-------------------------- general ------------------------
Implement /usr/proc/bin tools like Solaris has.
The main Makefile is broken. Try 'touch top.h' to see.
The Makefile is too clever, so it's still not fixed.
Don't these really belong in the procps package?
killall pstree fuser lsof who
(they are maintained elsewhere, which causes version problems)
Cache results of dev_to_tty.
---------------------- kernel -------------------------
Add an "adopted child" flag to mark processes that are not
natural children of init. This can make --forest work better.
Add a thread group ID, to be shared by all tasks that are related by
the clone() system call. This ID might be made unique from boot to
shutdown, perhaps being a 16-bit CPU number and 48-bit per-CPU
serial number.
Make the kernel group /proc listing output by thread group.
Without this, a thread-aware ps must always sort processes.
Supply the task ID (the "PID"/"TID") of the thread group leader.
I define "leader" as the first process of a thread group.
Don't reuse the task ID of a thread group leader until all threads
are dead. Better yet, don't let the leader exit.
Supply better data for top's CPU state display. Currently top has
to subtract old numbers from new numbers and divide that result by
the number of processors. The kernel won't even supply the number
of processors in a portable way.
Mark threads, and supply a list of other threads.
Supply data for the ADDR and JOBC fields.
Support & supply data for SL and RE.
Add a /proc/*/tty symlink to eliminate guessing when /proc/*/fd is
not accessable.
Put unique ID at the top of System.map and in /proc, to make sure
there is never a mismatch.
Maybe just put the symbols in the kernel like some other systems do.
Raul Miller writes: You might want to implement this as user data which just
happens to come from a wierd source -- instead of just freeing the memory
(like happens with init code), you want it to wind up in the buffer cache.
Add /proc/*/.bindata files to avoid string parsing. It should be an array
of 64-bit values on all machines. New entries go on the end and obsolete
ones get filled in with something logical -- entries must never be deleted!
Add all the stuff Solaris has. This would also replace ptrace.
The kernel should report these task_struct members:
has_cpu
processor
---------------------- w --------------------------
The LOGIN@ column sometimes has a space in it. This makes correct
scripting difficult.
Verify that DNS control does not give a user the power to specify
arbitrary data for the FROM column. (could set root's VGA color map!)
---------------------- vmstat --------------------------
Extract /proc/stat parsing from vmstat into libproc somewhere.
--------------------- libproc ----------------------
Stop storing fields with duplicate info (often different
units: kB and pages, seconds and jiffies) in the proc_t struct.
---------------------- top -------------------------
Share more stuff with ps.
---------------- ps for now, maybe move to libproc ------------------
With forest output and a tty named /dev/this_is_my_tty, the position
of the command name gets messed up. (we print too many spaces) (fixed?)
Fix missing stuff for these formats: FB_j FB_l FB_v HP_f HP_*_ HP_fl JFMT OL_m
(jobc,cpu,sl,re,cpu,prmgrp,cp,m_size,m_swap,m_share,vm_lib,m_dt)
Note that "cpu" has two meanings.
Add Beowulf support. This is ugly, since the current patches use a
daemon to collect info and add a HOST field after the PID field.
Query optimizer, put cheap/required process selection first.
Avoid reading both /proc/*/status and /proc/*/stat. Actually, avoid
reading lots of stuff! Avoidance got disabled. (at least don't read the
environment!!!)
Maybe ps should put a 'C' in front of fields when they are affected
by cumulative mode. Debian ps did that. (move flag to common.h...)
Support printing the client hostname (the FROM that w(1) uses) in place
of a pty. Maybe do this when PS_PERSONALITY=linux.
Disgusting color support, for completeness. (Debian ps had it)
Disambiguate narrow tty info. (/dev/tty7 == /dev/pts/7 now)
1------8 1--4
ttyS2 S2
ttyI31 I31
pts/7 7 Short form could be /999.
pts/9999 9999 Short form could just be trunctuated to /999.
tty7 7 Short form could be vc-7.
tty63 63 Short form could be vc63.
Internationalization, as specified by XPG3, Volume 1, Commands and Utilities.
(and suggested by Unix98) LC_TIME affects date format.
----------------------- ps -----------------------
Solve the "ps reports wrong date" bug. (recent processes on an SMP system
are reported as being 5 days old, while boot processes look normal)
(reported for procps-2.0.2 in May 1999)
Show real-time priorities. (type & number)
Add an option to select all processes that a user can kill.
(related to RUID, EUID, tty, etc. -- but maybe ignore root power)
Add a nice display option for killing things.
ruser,euser,ppid,pid,pmem,stime,args isn't too bad
Make the column alignment algorithm support this:
FOO BAR
8 44444
453 45
45 2989
63666 0
34 333
(useful for the UNIX tty and time values, since the time might look
like 100-10:40:32 for old processes and the tty might have extra room)
Improve long sort/format specifiers documentation and fill in the missing
code as much as the kernel can support. Make sure that memory amounts are in
pages when they should be and in kB when they should be, not backwards.
output encoding: UTF8 --nul --null
Make BSD formats use non-standard BSD time format, at least when it
doesn't violate the "no whitespace" rule.
Try to make -jl fit in 80 columns. Do we need more than 1000 pty devices,
9 flag bits, etc.? (hmmm, Linux supports 2048 pty devices now, and we
might also want to steal whitespace there when the time column overflows)
When not in strict Unix98 mode, let foo=8 specify that foo is 8
characters wide. Debian did that. Then foo=8=bar and foo=bar=8
could change both header and width.
Better unmangling of '?' as a tty. The shell destroys '?' when there
is a filename that matches. If the argument seems like garbage,
check for a file that might have screwed up the '?'.
If the 'O' option is given something already implied by 'O',
assume the user wanted a sorting option.
Conflict:
Digital THREAD is user,pcpu,pri,scnt,wchan,usertime,systime
AIX THREAD is uname,pid,ppid,tid,S,C,PRI,scount,WCHAN,F,tty,bnd,comm
AIX looks like this:
USER PID PPID TID S C PRI SC WCHAN FLAG TTY BND CMD
#!/bin/sh
# xconsole is capable of doing everything XConsole did, and is maintained...
# it is not setuid root, so we just exit if called as non-root
[ $(id -u) = 0 ] || exit 0
exec xconsole -file /proc/kmsg "$@"
.\" -*-Nroff-*-
.\" This page Copyright (C) 1993 Matt Welsh, mdw@sunsite.unc.edu.
.\" Freely distributable under the terms of the GPL
.TH FREE 1 "20 Mar 1993 " "Cohesive Systems" "Linux User's Manual"
.SH NAME
free \- Display amount of free and used memory in the system
.SH SYNOPSIS
.BR "free " [ "\-b" " | " "\-k" " | " "\-m" "] [" "\-o" "] [" "\-s"
.I delay
.RB "] [" "\-t" "] [" "\-V" ]
.SH DESCRIPTION
\fBfree\fP displays the total amount of free and used physical and swap
memory in the system, as well as the buffers used by the kernel.
The shared memory column should be ignored; it is obsolete.
.SS Options
The \fB-b\fP switch displays the amount of memory in bytes; the
\fB-k\fP switch (set by default) displays it in kilobytes; the \fB-m\fP
switch displays it in megabytes.
.PP
The \fB-t\fP switch displays a line containing the totals.
.PP
The \fB-o\fP switch disables the display of a "buffer adjusted" line. Unless
specified \fBfree\fP subtracts/adds buffer memory from/to the used/free memory
reports (respectively!).
.PP
The \fB-s\fP switch activates continuous polling \fIdelay\fP seconds apart. You
may actually specify any floating point number for \fIdelay\fP,
.BR usleep (3)
is used for microsecond resolution delay times.
.PP
The \fB\-V\fP displays version information.
.SH FILES
.ta
.IR /proc/meminfo "\-\- memory information"
.fi
.SH "SEE ALSO"
.BR ps (1),
.BR top(1)
.SH AUTHORS
Written by Brian Edmonds.
Send bug reports to <acahalan@cs.uml.edu>
/* free.c - a /proc implementation of free */
/* Dec14/92 by Brian Edmonds */
/* Thanks to Rafal Maszkowski for the Total line */
#include "proc/sysinfo.h"
#include "proc/version.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <getopt.h>
#define S(X) ( ((unsigned long long)(X) << 10) >> byteshift)
static int byteshift = 10;
static int total = 0;
int main(int argc, char *argv[]){
int i;
int old_fmt = 0;
int rtime = 0;
/* check startup flags */
while( (i = getopt(argc, argv, "bkmos:tV") ) != -1 )
switch (i) {
case 'b': byteshift = 0; break;
case 'k': byteshift = 10; break;
case 'm': byteshift = 20; break;
case 'o': old_fmt = 1; break;
case 's': rtime = 1000000 * atof(optarg); break;
case 't': total = 1; break;
case 'V': display_version(); exit(0);
default:
fprintf(stderr, "usage: %s [-b|-k|-m] [-o] [-s delay] [-t] [-V]\n", argv[0]);
return 1;
}
do {
meminfo();
printf(" total used free shared buffers cached\n");
printf(
"%-7s %10Ld %10Ld %10Ld %10Ld %10Ld %10Ld\n", "Mem:",
S(kb_main_total),
S(kb_main_used),
S(kb_main_free),
S(kb_main_shared),
S(kb_main_buffers),
S(kb_main_cached)
);
if(!old_fmt){
printf(
"-/+ buffers/cache: %10Ld %10Ld\n",
S(kb_main_used-kb_main_buffers-kb_main_cached),
S(kb_main_free+kb_main_buffers+kb_main_cached)
);
}
printf(
"%-7s %10Ld %10Ld %10Ld\n", "Swap:",
S(kb_swap_total),
S(kb_swap_used),
S(kb_swap_free)
);
if(total == 1){
printf(
"%-7s %10Ld %10Ld %10Ld\n", "Total:",
S(kb_main_total + kb_swap_total),
S(kb_main_used + kb_swap_used),
S(kb_main_free + kb_swap_free)
);
}
if(rtime){
fputc('\n', stdout);
fflush(stdout);
usleep(rtime);
}
} while(rtime);
return 0;
}
Return-Path: <qpliu@ulch.Princeton.EDU>
Date: Wed, 24 Feb 93 23:37:45 -0500
From: qpliu@ulch.Princeton.EDU (Quowong P Liu)
To: johnsonm@stolaf.edu
Subject: Suggestions for procps
Reply-To: qpliu@princeton.edu
[...]
Since you are collecting programs that use the proc-fs, I have included
some patches to GNU finger that allow it to read the proc information
that it uses.
[...]
Here the diffs for GNU finger begin.
-------------BEGIN---------------
diff -ru finger-1.37.orig/lib/os.c finger-1.37/lib/os.c
--- finger-1.37.orig/lib/os.c Thu Oct 22 17:01:10 1992
+++ finger-1.37/lib/os.c Mon Feb 8 00:56:32 1993
@@ -23,7 +23,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
+#ifndef linux
#include <sys/acct.h>
+#endif
#include <time.h>
#include <packet.h>
@@ -43,9 +45,11 @@
#ifdef HAVE_PROC_FS
#include <sys/signal.h>
+#ifndef linux
#include <sys/fault.h>
#include <sys/syscall.h>
#include <sys/procfs.h>
+#endif /*linux*/