warning directs users to the FAQ

This commit is contained in:
albert 2003-02-18 03:51:03 +00:00
parent 4a54e25aca
commit cc5c6955be
7 changed files with 28 additions and 15 deletions

7
NEWS
View File

@ -1,14 +1,19 @@
procps-3.1.6 --> procps-3.1.7
ps: warning directs users to the FAQ
procps-3.1.5 --> procps-3.1.6 procps-3.1.5 --> procps-3.1.6
handle the 2.5.61 kernel handle the 2.5.61 kernel
top: memory leak fixed top: memory leak fixed
ps: new --ppid option selects by PPID ps: new --ppid option selects by PPID
watch: new --no-title option #179862 watch: new --no-title option #179862
handle SPARC Linux badness handle SPARC Linux badness
rare crash fixed rare crash fixed
compile with gcc 2.91.xx again compile with gcc 2.91.xx again
more informative "ps --info" more informative "ps --info"
README update README update
ps: compare more with "ps -C verylongname" #178127
procps-3.1.4 --> procps-3.1.5 procps-3.1.4 --> procps-3.1.5

View File

@ -235,20 +235,21 @@ ENTER(0x220);
P->fgid = strtol(S,&S,10); P->fgid = strtol(S,&S,10);
continue; continue;
case_Name:{ case_Name:{
int i = 0; unsigned u = 0;
while(i < sizeof P->cmd - 1){ while(u < sizeof P->cmd - 1u){
int c = *S++; int c = *S++;
if(unlikely(c=='\n')) break; if(unlikely(c=='\n')) break;
if(unlikely(c=='\0')) return; // should never happen if(unlikely(c=='\0')) break; // should never happen
if(unlikely(c=='\\')){ if(unlikely(c=='\\')){
c = *S++; c = *S++;
if(c=='\n') break; // should never happen if(c=='\n') break; // should never happen
if(!c) break; // should never happen if(!c) break; // should never happen
if(c=='n') c='\n'; // else we assume it is '\\' if(c=='n') c='\n'; // else we assume it is '\\'
} }
P->cmd[i++] = c; P->cmd[u++] = c;
} }
P->cmd[i] = '\0'; P->cmd[u] = '\0';
S--; // put back the '\n' or '\0'
continue; continue;
} }
case_PPid: case_PPid:

View File

@ -1,15 +1,15 @@
Begin4 Begin4
Title: procps Title: procps
Version: 3.1.6 Version: 3.1.6
Entered-date: 2002-12-14 Entered-date: 2003-2-17
Description: Linux system utilities Description: Linux system utilities
Keywords: procps /proc libproc sysctl pmap Keywords: procps /proc libproc sysctl pmap
ps uptime tload free w top vmstat watch skill snice kill pgrep pkill ps uptime tload free w top vmstat watch skill snice kill pgrep pkill
Author: Albert Cahalan, Michael K. Johnson, Jim Warner, etc. Author: Albert Cahalan, Michael K. Johnson, Jim Warner, etc.
Maintained-by: various <procps-feedback@lists.sf.net> Maintained-by: various <procps-feedback@lists.sf.net>
Primary-site: http://procps.sf.net/ Primary-site: http://procps.sf.net/
236kB procps-3.1.6.tar.gz 238kB procps-3.1.6.tar.gz
Alternate-site: http://www.debian.org/Packages/unstable/base/procps.html Alternate-site: http://www.debian.org/Packages/unstable/base/procps.html
236kB procps-3.1.6.tar.gz 238kB procps-3.1.6.tar.gz
Copying-policy: mixed Copying-policy: mixed
End End

View File

@ -148,7 +148,7 @@ typedef union sel_union {
uid_t uid; uid_t uid;
gid_t gid; gid_t gid;
dev_t tty; dev_t tty;
char cmd[8]; /* this is _not_ \0 terminated */ char cmd[16]; /* this is _not_ \0 terminated */
} sel_union; } sel_union;
typedef struct selection_node { typedef struct selection_node {

View File

@ -246,7 +246,6 @@ static void simple_spew(void){
exit(1); exit(1);
} }
memset(&buf, '#', sizeof(proc_t)); memset(&buf, '#', sizeof(proc_t));
/* use "ps_" prefix to catch library mismatch */
while(ps_readproc(ptp,&buf)){ while(ps_readproc(ptp,&buf)){
if(want_this_proc(&buf)) show_one_proc(&buf); if(want_this_proc(&buf)) show_one_proc(&buf);
if(buf.cmdline) free((void*)*buf.cmdline); // ought to reuse if(buf.cmdline) free((void*)*buf.cmdline); // ought to reuse

View File

@ -121,7 +121,7 @@ static const char *parse_gid(char *str, sel_union *ret){
} }
static const char *parse_cmd(char *str, sel_union *ret){ static const char *parse_cmd(char *str, sel_union *ret){
strncpy(ret->cmd, str, 8); /* strncpy pads to end */ strncpy(ret->cmd, str, sizeof ret->cmd); // strncpy pads to end
return 0; return 0;
} }
@ -1130,8 +1130,17 @@ try_bsd:
err2 = select_bits_setup(); err2 = select_bits_setup();
if(err2) goto total_failure; if(err2) goto total_failure;
// Feel a need to patch this out? First of all, read the FAQ.
// Second of all, talk to me. Without this warning, people can
// get seriously confused. Ask yourself if users would freak out
// about "ps -aux" suddenly changing behavior if a user "x" were
// added to the system.
if(!(personality & PER_FORCE_BSD)) if(!(personality & PER_FORCE_BSD))
fprintf(stderr, "Bad syntax, perhaps a bogus '-'?\n"); fprintf(stderr, "Warning: bad '-'? See http://procps.sf.net/faq.html\n");
// Remember: contact albert@users.sf.net or procps-feedback@lists.sf.net
// if you should feel tempted. Be damn sure you understand all
// the issues. The same goes for other stuff too, BTW. Please ask.
// I'm happy to justify various implementation choices.
choose_dimensions(); choose_dimensions();
return 0; return 0;

View File

@ -106,9 +106,8 @@ static int proc_was_listed(proc_t *buf){
break; case SEL_TTY : return_if_match(tty,tty); break; case SEL_TTY : return_if_match(tty,tty);
break; case SEL_SESS: return_if_match(session,pid); break; case SEL_SESS: return_if_match(session,pid);
/* TODO Should use a long long cast for performance */
break; case SEL_COMM: i=sn->n; while(i--) break; case SEL_COMM: i=sn->n; while(i--)
if(!strncmp( buf->cmd, (*(sn->u+i)).cmd, 8 )) return 1; if(!strncmp( buf->cmd, (*(sn->u+i)).cmd, 15 )) return 1;