Commit 4acae285 authored by albert's avatar albert

misc

parent 792358ba
procps-3.2.3 --> procps-3.2.4
ps: more room for some columns
procps-3.2.2 --> procps-3.2.3
avoid truncating long usernames
......
......@@ -26,3 +26,14 @@ s signal format
u user-oriented format
--forest ASCII art forest (process hierarchy)
c show true command name
List of man page translators:
de Wed Jan 10 19:09:15 2001 by Martin Schulze <joey@infodrom.ffis.de>
es 19 Jan 1999 by Diego Sevilla Ruiz (dsevilla@ditec.um.es)
fr 09/06/1997 par Christophe Blaess (ccb@club-internet.fr)
hu Horv#th Andr#s (the '#' is 'a' w/ '/') <horvatha@rs1.szif.hu>
it Traduzione in italiano di Giovanni Bortolozzo <borto@dei.unipd.it>
it Revisione parziale di Daniele Giacomini <daniele@evo.it> 30/03/1999
ja Tue Nov 14 2000 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
nl <manpages-nl@nl.linux.org>
......@@ -119,6 +119,8 @@
#define PER_SANE_USER 0x0200
#define PER_HPUX_x 0x0400
#define PER_SVR4_x 0x0800
#define PER_BSD_COLS 0x1000
#define PER_UNIX_COLS 0x2000
/* Simple selections by bit mask */
#define SS_B_x 0x01
......
......@@ -16,6 +16,9 @@
#include <pwd.h>
#include <grp.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "common.h"
......@@ -95,24 +98,48 @@ static void reset_selection_list(void){
selection_list = NULL;
}
/* The rules:
* 1. Defaults are implementation-specific. (ioctl,termcap,guess)
* 2. COLUMNS and LINES override the defaults. (standards compliance)
* 3. Command line options override everything else.
* 4. Actual output may be more if the above is too narrow.
*/
// The rules:
// 1. Defaults are implementation-specific. (ioctl,termcap,guess)
// 2. COLUMNS and LINES override the defaults. (standards compliance)
// 3. Command line options override everything else.
// 4. Actual output may be more if the above is too narrow.
//
// SysV tends to spew semi-wide output in all cases. The args
// will be limited to 64 or 80 characters, without regard to
// screen size. So lines of 120 to 160 chars are normal.
// Tough luck if you want more or less than that! HP-UX has a
// new "-x" option for 1024-char args in place of comm that
// we'll implement at some point.
//
// BSD tends to make a good effort, then fall back to 80 cols.
// Use "ww" to get infinity. This is nicer for "ps | less"
// and "watch ps". It can run faster too.
static void set_screen_size(void){
struct winsize ws;
char *columns; /* Unix98 environment variable */
char *lines; /* Unix98 environment variable */
if(ioctl(1, TIOCGWINSZ, &ws) != -1 && ws.ws_col>0 && ws.ws_row>0){
screen_cols = ws.ws_col;
screen_rows = ws.ws_row;
}else{ /* TODO: ought to do tgetnum("co") and tgetnum("li") now */
screen_cols = 80;
screen_rows = 24;
}
do{
int fd;
if(ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) != -1 && ws.ws_col>0 && ws.ws_row>0) break;
if(ioctl(STDERR_FILENO, TIOCGWINSZ, &ws) != -1 && ws.ws_col>0 && ws.ws_row>0) break;
if(ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1 && ws.ws_col>0 && ws.ws_row>0) break;
fd = open("/dev/tty", O_NOCTTY|O_NONBLOCK|O_RDONLY);
if(fd != -1){
int ret = ioctl(fd, TIOCGWINSZ, &ws);
close(fd);
if(ret != -1 && ws.ws_col>0 && ws.ws_row>0) break;
}
// TODO: ought to do tgetnum("co") and tgetnum("li") here
ws.ws_col = 80;
ws.ws_row = 24;
}while(0);
screen_cols = ws.ws_col; // hmmm, NetBSD subtracts 1
screen_rows = ws.ws_row;
// TODO: delete this line
if(!isatty(STDOUT_FILENO)) screen_cols = OUTBUF_SIZE;
columns = getenv("COLUMNS");
if(columns && *columns){
long t;
......@@ -120,6 +147,7 @@ static void set_screen_size(void){
t = strtol(columns, &endptr, 0);
if(!*endptr && (t>0) && (t<(long)OUTBUF_SIZE)) screen_cols = (int)t;
}
lines = getenv("LINES");
if(lines && *lines){
long t;
......@@ -127,6 +155,7 @@ static void set_screen_size(void){
t = strtol(lines, &endptr, 0);
if(!*endptr && (t>0) && (t<(long)OUTBUF_SIZE)) screen_rows = (int)t;
}
if((screen_cols<9) || (screen_rows<2))
fprintf(stderr,"Your %dx%d screen size is bogus. Expect trouble.\n",
screen_cols, screen_rows
......
......@@ -1218,9 +1218,9 @@ static const format_struct format_array[] = {
{"rgid", "RGID", pr_rgid, sr_rgid, 5, 0, XXX, ET|RIGHT},
{"rgroup", "RGROUP", pr_rgroup, sr_rgroup, 8, GRP, U98, ET|USER}, /* was 8 wide */
{"rlink", "RLINK", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT},
{"rss", "RSS", pr_rss, sr_rss, 4, 0, XXX, PO|RIGHT}, /* was 5 wide */
{"rssize", "RSS", pr_rss, sr_vm_rss, 4, 0, DEC, PO|RIGHT}, /*rsz*/
{"rsz", "RSZ", pr_rss, sr_vm_rss, 4, 0, BSD, PO|RIGHT}, /*rssize*/
{"rss", "RSS", pr_rss, sr_rss, 5, 0, XXX, PO|RIGHT}, /* was 5 wide */
{"rssize", "RSS", pr_rss, sr_vm_rss, 5, 0, DEC, PO|RIGHT}, /*rsz*/
{"rsz", "RSZ", pr_rss, sr_vm_rss, 5, 0, BSD, PO|RIGHT}, /*rssize*/
{"rtprio", "RTPRIO", pr_rtprio, sr_rtprio, 6, 0, BSD, TO|RIGHT},
{"ruid", "RUID", pr_ruid, sr_ruid, 5, 0, XXX, ET|RIGHT},
{"ruser", "RUSER", pr_ruser, sr_ruser, 8, USR, U98, ET|USER},
......@@ -1244,7 +1244,7 @@ static const format_struct format_array[] = {
{"sigcatch", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, XXX, TO|SIGNAL}, /*caught*/
{"sigignore", "IGNORED", pr_sigignore,sr_nop, 9, 0, XXX, TO|SIGNAL}, /*ignored*/
{"sigmask", "BLOCKED", pr_sigmask, sr_nop, 9, 0, XXX, TO|SIGNAL}, /*blocked*/
{"size", "SZ", pr_swapable, sr_swapable, 1, 0, SCO, PO|RIGHT},
{"size", "SZ", pr_swapable, sr_swapable, 5, 0, SCO, PO|RIGHT},
{"sl", "SL", pr_nop, sr_nop, 3, 0, XXX, AN|RIGHT},
{"spid", "SPID", pr_thread, sr_tid, 5, 0, SGI, TO|PIDMAX|RIGHT},
{"stackp", "STACKP", pr_stackp, sr_start_stack, 8, 0, LNX, PO|RIGHT}, /*start_stack*/
......@@ -1301,8 +1301,8 @@ static const format_struct format_array[] = {
{"vm_lib", "LIB", pr_nop, sr_vm_lib, 5, 0, LNx, PO|RIGHT},
{"vm_lock", "LCK", pr_nop, sr_vm_lock, 3, 0, LNx, PO|RIGHT},
{"vm_stack", "STACK", pr_nop, sr_vm_stack, 5, 0, LNx, PO|RIGHT},
{"vsize", "VSZ", pr_vsz, sr_vsize, 5, 0, DEC, PO|RIGHT}, /*vsz*/
{"vsz", "VSZ", pr_vsz, sr_vm_size, 5, 0, U98, PO|RIGHT}, /*vsize*/
{"vsize", "VSZ", pr_vsz, sr_vsize, 6, 0, DEC, PO|RIGHT}, /*vsz*/
{"vsz", "VSZ", pr_vsz, sr_vm_size, 6, 0, U98, PO|RIGHT}, /*vsize*/
{"wchan", "WCHAN", pr_wchan, sr_wchan, 6, WCH, XXX, TO|WCHAN}, /* BSD n forces this to nwchan */ /* was 10 wide */
{"wname", "WCHAN", pr_wname, sr_nop, 6, WCH, SGI, TO|WCHAN}, /* opposite of nwchan */
{"xstat", "XSTAT", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT},
......
......@@ -218,10 +218,16 @@ parse_error:
static const char *parse_sysv_option(void){
const char *arg;
const char *err;
flagptr = ps_argv[thisarg];
while(*++flagptr){
/* Find any excuse to ignore stupid Unix98 misfeatures. */
// Find any excuse to ignore stupid Unix98 misfeatures.
//
// This list of options is ONLY for those defined by the
// "IEEE Std 1003.1, 2004 Edition", "ISO/IEC 9945:2003",
// or "Version 2 of the Single Unix Specification".
if(!strchr("aAdefgGlnoptuU", *flagptr)) not_pure_unix = 1;
switch(*flagptr){
case 'A':
trace("-A selects all processes.\n");
......
......@@ -60,26 +60,6 @@ displays information about a selection of the active processes.
If you want a repetitive update of the selection and the
displayed information, use\ \fItop\fR(1) instead.
.P
By default, \fBps\fR selects all processes with the same effective user
ID (EUID) as the curent user and associated with the same terminal as the
invoker. It displays the process ID (PID), the terminal (tty) associated
with the process (TTY), the cumulated CPU time in [dd\-]hh:mm:ss format
(TIME), and the executable name (CMD). The use of BSD\-style options
will add process state (STAT) to the default display. The use of BSD\-style
options will also change the process selection to include processes
on other terminals (TTYs) that are owned by you; alternately, this may
be described as setting the selection to be the set of all processes
filtered to exclude processes owned by other users or not on a terminal.
Output is unsorted by default.
.P
Except as described below, process selection options are additive.
The default selection is discarded, and then the selected processes
are added to the set of processes to be displayed.
A\ process will thus be shown if it meets any of the selection
criteria.
.PP
.PP
.SH "COMMAND\-LINE OPTIONS"
This version of \fBps\fR accepts several kinds of options:
.PD 0
.IP 1 4
......@@ -103,6 +83,29 @@ not exist, this \fBps\fR may interpret the command as "\fBps\ aux\fR"
instead and print a warning. This behavior is intended to aid in
transitioning old scripts and habits. It is fragile, subject to change,
and thus should not be relied upon.
.P
By default, \fBps\fR selects all processes with the same effective user
ID (EUID) as the curent user and associated with the same terminal as the
invoker. It displays the process ID (PID), the terminal associated
with the process (TTY), the cumulated CPU time in [dd\-]hh:mm:ss format
(TIME), and the executable name (CMD). Output is unsorted by default.
.P
The use of BSD\-style options will add process state (STAT) to the
default display and show the command args (COMMAND) instead of the
executable name. You can override this with the \fBPS_FORMAT\fR
environment variable. The use of BSD\-style options will also change the
process selection to include processes on other terminals (TTYs) that
are owned by you; alternately, this may be described as setting the
selection to be the set of all processes filtered to exclude
processes owned by other users or not on a terminal. These effects
are not considered when options are described as being "identical" below,
so \fB\-M\fR will be considered identical to \fBZ\fR and so on.
.P
Except as described below, process selection options are additive.
The default selection is discarded, and then the selected processes
are added to the set of processes to be displayed.
A\ process will thus be shown if it meets any of the given
selection criteria.
.PP
.\" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.SH "EXAMPLES"
......@@ -138,8 +141,8 @@ To get security info:
.br
.B ps\ -eM
.TP
To see every process except those running as root (real\ &\ effective\ ID)
.B ps\ \-U\ root\ \-u\ root\ \-N
To see every process running as root (real\ &\ effective\ ID) in user format:
.B ps\ \-U\ root\ \-u\ root\ u
.TP
To see every process with a user\-defined format:
.B ps\ \-eo\ pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
......@@ -148,9 +151,6 @@ To see every process with a user\-defined format:
.br
.B ps\ \-eopid,tt,user,fname,tmout,f,wchan
.TP
Odd display with AIX field descriptors:
.B ps\ \-o\ "%u\ :\ %U\ :\ %p\ :\ %a"
.TP
Print only the process IDs of syslogd:
.B ps\ \-C\ syslogd\ \-o\ pid=
.TP
......@@ -167,6 +167,7 @@ Select all processes. Identical to \fB\-e\fR.
.TP
.B \-N
Select all processes except those that fulfill the specified conditions.
(negates the selection) Identical to \fB\-\-deselect\fR.
.opt T
Select all processes associated with this terminal. Identical to the
......@@ -225,6 +226,7 @@ or to list all processes when used together with the \fBa\fR option.
.TP
.B \-\-deselect
Select all processes except those that fulfill the specified conditions.
(negates the selection) Identical to \fB\-N\fR.
.\" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.PD
......@@ -409,7 +411,7 @@ BSD\ personality.
.TP
.B \-M
Add a column of security data. (for\ SE\ Linux)
Add a column of security data. Identical to \fBZ\fR. (for\ SE\ Linux)
.TP
.B X
......@@ -417,7 +419,7 @@ Register format.
.TP
.B Z
Add a column of security data. (for\ SE\ Linux)
Add a column of security data. Identical to \fB\-M\fR. (for\ SE\ Linux)
.TP
.B \-c
......@@ -429,6 +431,8 @@ does full\-format listing. This option can be combined with many
other UNIX\-style options to add additional columns. It also causes
the command arguments to be printed. When used with \fB\-L\fR, the
NLWP (number of threads) and LWP (thread ID) columns will be added.
See the \fBc\fR option, the format keyword \fBargs\fR, and the
format keyword \fBcomm\fR.
.TP
.B j
......@@ -548,6 +552,8 @@ parent process repeatedly forks off short\-lived children to do work.
Show the true command name. This is derived from the name of the
executable file, rather than from the argv value which could be
modified by a user. Command arguments are not shown.
See the \fB\-f\fR option, the format keyword \fBargs\fR, and the
format keyword \fBcomm\fR.
.TP
.B e
......@@ -928,9 +934,21 @@ the machine, expressed as a percentage. (alias\ \fBpmem\fR).
T}
args COMMAND T{
command with all its arguments as a string. May chop as desired.
Modifications to the arguments are not shown. The output in this column
may contain spaces. (alias\ \fBcmd\fR,\ \fBcommand\fR).
command with all its arguments as a string. Modifications to the arguments
may be shown. The output in this column may contain spaces.
A\ process marked <defunct> is partly dead, waiting
to be fully destroyed by its parent. Sometimes the process args
will be unavailable; when this happens, \fBps\fR will instead
print the executable name in brackets.
(alias\ \fBcmd\fR,\ \fBcommand\fR). See also the \fBcomm\fR format
keyword, the \fB\-f\fR option, and the \fBc\fR option.
.br
When specified last, this column will extend to the edge of the display.
If \fBps\fR can not determine display width, as when output is redirected
(piped) into a file or another command, the width of this column is undefined.
The \fBCOLUMNS\fR environment variable or \fB\-\-cols\fR option may
be used to exactly determine the width in this case.
The \fBw\fR or \fB\-w\fR option may be also be used to adjust width.
T}
blocked BLOCKED T{
......@@ -998,8 +1016,19 @@ see \fBargs\fR. (alias\ \fBargs\fR,\ \fBcommand\fR).
T}
comm COMMAND T{
command name (only\ the executable\ name). The output in this
command name (only\ the executable\ name). Modifications to the command
name will not be shown. A\ process marked <defunct> is partly dead, waiting
to be fully destroyed by its parent. The output in this
column may contain spaces. (alias\ \fBucmd\fR,\ \fBucomm\fR).
See also the \fBargs\fR format
keyword, the \fB\-f\fR option, and the \fBc\fR option.
.br
When specified last, this column will extend to the edge of the display.
If \fBps\fR can not determine display width, as when output is redirected
(piped) into a file or another command, the width of this column is undefined.
The \fBCOLUMNS\fR environment variable or \fB\-\-cols\fR option may
be used to exactly determine the width in this case.
The \fBw\fR or \fB\-w\fR option may be also be used to adjust width.
T}
command COMMAND T{
......@@ -1347,6 +1376,8 @@ T}
sz SZ T{
size in physical pages of the core image of the process.
This includes text, data, and stack space.
Device mappings are currently excluded; this is subject to change.
See \fBvsz\fR and \fBrss\fR.
T}
thcount THCNT T{
......@@ -1402,12 +1433,13 @@ see \fBeuser\fR. (alias\ \fBeuser\fR,\ \fBuname\fR).
T}
vsize VSZ T{
virtual memory usage of entire process.
vm_lib\ +\ vm_exe\ +\ vm_data\ +\ vm_stack
see \fBvsz\fR. (alias\ \fBvsz\fR).
T}
vsz VSZ T{
see \fBvsize\fR. (alias\ \fBvsize\fR).
virtual memory size of the process in KiB (1024\-byte\ units).
Device mappings are currently excluded; this is subject to change.
(alias\ \fBvsize\fR).
T}
wchan WCHAN T{
......@@ -1447,7 +1479,9 @@ Date format.
Not currently supported.
.TP
.B PS_FORMAT
Default output format override.
Default output format override. You may set this to a format
string of the type used for the \fB\-o\fR option.
The \fBDefSysV\fR and \fBDefBSD\fR values are particularly useful.
.TP
.B PS_SYSMAP
Default namelist (System.map) location.
......
# /etc/sysctl.conf - Configuration file for setting system variables
# See sysctl.conf (5) for information.
# you can have the CD-ROM close when you use it, and open
# when you are done.
#dev.cdrom.autoeject = 1
#dev.cdrom.autoclose = 1
# protection from the SYN flood attack
net/ipv4/tcp_syncookies=1
# see the evil packets in your log files
net/ipv4/conf/all/log_martians=1
# makes you vulnerable or not :-)
net/ipv4/conf/all/accept_redirects=0
net/ipv4/conf/all/accept_source_route=0
net/ipv4/icmp_echo_ignore_broadcasts =1
# needed for routing, including masquerading or NAT
#net/ipv4/ip_forward=1
# sets the port range used for outgoing connections
#net.ipv4.ip_local_port_range = 32768 61000
# Broken routers will corrupt the window scaling and ECN
# Broken routers and obsolete firewalls will corrupt the window scaling
# and ECN. Set these values to 0 to disable window scaling and ECN.
# This may, rarely, cause some performance loss when running high-speed
# TCP/IP over huge distances or running TCP/IP over connections with high
# packet loss and modern routers. This sure beats dropped connections.
#net.ipv4.tcp_default_win_scale = 0
#net.ipv4.tcp_ecn = 0
# Swapping too much or not enough? Disks spinning up when you'd
# rather they didn't? Tweak these.
#vm.vfs_cache_pressure = 100
#vm.laptop_mode = 0
#vm.swappiness = 60
......@@ -31,6 +48,7 @@ net/ipv4/icmp_echo_ignore_broadcasts =1
#kernel.sysrq = 1
# Change name of core file to start with the command name
# so you get things like: emacs.core mozilla-bin.core X.core
#kernel.core_pattern = %e.core
# NIS/YP domain (not always equal to DNS domain)
......
......@@ -1513,7 +1513,6 @@ static const char *rc_write_whatever (void) {
FILE *fp = fopen(Rc_name, "w");
if (!fp) return strerror(errno);
// if (Crufty_rcf) rc_write_old(fp);
rc_write_new(fp);
fclose(fp);
return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment