hbase

heirloom base
git clone git://git.2f30.org/hbase
Log | Files | Refs | README

NOTES (2634B)


      1 Notes for the ps utility
      2 ========================
      3 
      4 ps needs to associate /dev device names with dev_t device numbers in order
      5 to print the controlling terminal devices. It does this by examining files
      6 in /dev with stat(2). To accelerate this process, ps normally keeps a cache
      7 file; the data in this file is not secret (it can be collected by any user
      8 by examining /dev himself), but its integrity must be protected. ps thus
      9 normally runs set-user-ID and creates the cache file with its effective
     10 user ID. ps should be run with the credentials of either root or another
     11 trusted user ID; it does not need privilege otherwise on Linux or Solaris
     12 and can be configured in /etc/default/ps to switch to the real user ID
     13 after creating the cache file. The location, permission mode, and group
     14 ownership of the cache file can also be changed in /etc/default/ps (see
     15 the text of that file for details).
     16 
     17 It is also possible to disable the cache file by removing -DUSE_PS_CACHE
     18 from Makefile.mk, and regenerating the Makefile and rebuilding ps after
     19 doing so. If no cache file is used, ps does not need to run set-user-ID
     20 on Linux and Solaris.
     21 
     22 On (native) Open UNIX, ps needs root privileges to read execution times
     23 of child processes, and effective user and group IDs. It will thus be
     24 limited in functionality unless it runs set-user-ID to root, especially
     25 for the SUSv2 version which uses effective user IDs for the -u option
     26 and prints them in the UID column. With the Open UNIX LKP, no privileges
     27 are necessary, just as on Linux, but some files in LKP /proc contain
     28 weird values, causing ps to print weird output.
     29 
     30 On FreeBSD, ps needs privileges for completely correct operation because
     31 some information it has to read (e. g. process flags, priority) is not
     32 available with /proc, but only by examining /dev/kmem with the kvm library.
     33 
     34 The System V-style ps utility and the BSD-style version are two separate
     35 binaries with this toolchest. Moreover, the BSD-style version does not
     36 accept options without a preceding '-' (original BSD implementations do,
     37 but not /usr/ucb/ps on System V which was the model implementation for
     38 this version). If you like the ps utility to switch to BSD-style mode
     39 if the first argument does not start with '-', as procps v2 does, use
     40 a shell script like the following:
     41 
     42 	case $1 in
     43 	-*|'')
     44 		PATH=/usr/5bin:$PATH
     45 		exec ps ${@+"$@"}
     46 		;;
     47 	[0-9]*)
     48 		PATH=/usr/ucb:$PATH
     49 		exec ps "$@"
     50 		;;
     51 	*)
     52 		opt=$1
     53 		shift
     54 		PATH=/usr/ucb:$PATH
     55 		exec ps "-$opt" ${@+"$@"}
     56 		;;
     57 	esac
     58 
     59 Of course, you will have to change the PATH assignments if you installed
     60 the tools in a different location.
     61 
     62 	Gunnar Ritter						4/6/04