Skip to content

Commit

Permalink
Initial revision
Browse files Browse the repository at this point in the history
  • Loading branch information
csmall committed Feb 1, 2002
0 parents commit dcde5b4
Show file tree
Hide file tree
Showing 90 changed files with 20,735 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .cvsignore.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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
81 changes: 81 additions & 0 deletions BUGS
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
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).
339 changes: 339 additions & 0 deletions COPYING

Large diffs are not rendered by default.

481 changes: 481 additions & 0 deletions COPYING.LIB

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
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
220 changes: 220 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
# 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"
Loading

0 comments on commit dcde5b4

Please sign in to comment.