home *** CD-ROM | disk | FTP | other *** search
- kstuff 0.18, 5/6/91, Daniel J. Bernstein.
-
- This code is in alpha test. That means you shouldn't be surprised at
- bugs, annoying restrictions, exceedingly poor documentation, etc.
- However, I don't know of any bugs, and you should feel free to use the
- libraries in other programs. Some of the previous contributors to ofiles
- may want some rights to getdevicename.c, getuser.c, getvmseg.c,
- mntops.c, stattimeout.c, getnode.c, and virtype.c; other than that, this
- is all public-domain. (Nothing here is derived from any AT&T or Berkeley
- or GPL-infected code.) Please send any comments, criticism, or code to
- me at brnstnd@nyu.edu.
-
- Be sure to apply the changes indicated at the top of Makefile for your
- system. Particular thanks to Vic Abell for portability mods, bug fixes,
- and extensive testing.
-
- This package includes, among other things: load, a fast version of
- uptime; pff, an improved replacement for ofiles/fstat; authd, a revised
- version of the RFC 931 server; netstatuids, a version of netstat plus
- usernames on both sides; kmem, nlist, strerr, and u area libraries; the
- authuser library. See README.authd for an updated extract of the
- authd/authuser documentation.
-
- To compile, just make. To install, run INSTALL from a root shell.
- (INSTALL checks each action with you before doing it.) To test, run
- ``make tests'' as any user.
-
- I've included the findinode package here in directory findinode. It's
- entirely independent of kstuff, but pff can make good use of it. You
- probably want to look at that directory, and perhaps make and install
- findinode, before continuing with kstuff.
-
-
- Programs:
-
- load is a fast version of uptime with a slightly different output
- format, meant to illustrate how to use these libraries. I don't know why
- uptime is so slow. Documentation is in load.1.
-
- pff (process-file-file) is a mostly rewritten version of the popular
- ofiles utility. See pff.doc for some documentation. (Man page donations
- would be appreciated. :-)) See OFILES.hist for a history of ofiles.
- Although I think I've included almost every popular feature from the
- Dupuy-Leres ofiles, the Abell ofiles, and the Christiansen fstat, as
- well as some extras, pff should be quite a bit more portable than any of
- its predecessors. pff handles open files (and filesystems), network
- connections, mmaps, process texts, cwds, root directories, and
- controlling ttys. It works over NFS. It even handles process texts on
- the Convex, unlike the Christiansen fstat. Late addition: if you have
- findinode running, pff gives you filenames! Please send me any further
- extensions and portability mods you have. Thanks to all the ofiles and
- fstat authors for lots of code and ideas.
-
- netstatuids uses the RFC 931 authuser library in authuser.c and the
- kernel libraries here to show you all active TCP connections, with the
- usernames on both sides. Naturally, it's faster than netstat -n, though
- I suppose this is excusable since netstat shows more information. Thanks
- to Seth Robertson for suggesting this program and writing a prototype.
-
- authd is a revised version of the RFC 931 authd server (previous version
- available separately). It should be somewhat faster and somewhat more
- portable. Thanks to Kim Hoeglund for comments and code. Documentation is
- in authd.8, tcpuid.8, and tcpuname.8, copied from the authd 3.01
- distribution. (tcpuid and tcpuname should be linked to authd.)
-
-
- Libraries:
-
- kmem.h and nlistlist.h are kmem/nlist libraries meant to provide an
- intuitive yet powerful interface. (mmem.h and smem.h are like kmem.h but
- handle /dev/mem and /dev/drum instead of /dev/kmem.) Intuitive:
- kmemcpy() works just like memcpy() but out of kmem. Powerful: If
- libraries X and Y are developed independently but both need to use kmem
- and nlist, normally they'd open independent descriptors and do separate
- nlist()s. This is horrendously inefficient. These libraries solve the
- problem. See avenrun.c, boottime.c, and load.c for examples.
-
- getuser.h is a reasonably portable library to get the u area of a given
- struct proc. Together with kmem.h and nlistlist.h, getuser.h provides an
- interface about as useful as Sun's kvm library for kernel-reading
- applications but a lot more portable. (Well, I cheated a bit: under
- #ifdef sun, getuser.h just calls kvm_getu. The point is that
- applications don't have to worry whether getuser() is running on a Sun
- or not.)
-
- avenrun.h, boottime.h, filetable.h, getfcred.h, inpcblist.h, and
- proctable.h are straightforward applications of the kmem and nlistlist
- libraries.
-
- netinp.h is an experiment. I will probably eliminate it if inpcblist.h
- turns out to be portable enough. Thanks again to Kim Hoeglund.
-
- strerr.h is another piece of my forthcoming error-handling library. It
- lets you set up libraries or sections of code so that callers can get a
- meaningful error message with a single function call. strerr handles
- recursion, so that if one library forwards an error from another library
- it called, the error message will include an error from the sublibrary.
- But none of the libraries have to worry about malloc()ing space or
- concatenating messages manually. Oh, yeah, and strerr(strerrno) is
- equivalent to ANSI C's strerror(errno) if you don't have ANSI libraries.
-
- struct*.h are meant to keep you (well, me) from going insane when using
- vendor include files. If you #include "structproc.h", then no matter how
- badly structured the vendor's include files are, no matter how many of
- their files neglect to include their dependencies, no matter how many
- files blow up if they are included twice, you should get a working
- struct proc and the definitions necessary to use that struct. (You may
- not understand what struct proc is for, but that's a separate problem.
- :-))
-
- conf*.h form a two-level #include system. Why is it good to have a
- single file for each #define, like confgnode.h for #ifdef GNODE? Among
- other reasons, this opens up the chance of vendors standardizing these
- #include files with the same names and meanings they have here. It also
- insulates the main code from OS changes. Feel free to use conf*.h in
- other packages. I am considering setting up a central registration
- system for files like this.
-
- I know, there are lots of other libraries here... I'll document them
- soon.
-