* fuser -ki now tells user default is N Closes Debian: #197356
* pstree -a doesn't print space at end of line Closes Debian: #182099
* Works with new sort flags +2 -> -k 3 Thankyou Andrew Walrond
+ * pstree.x11 now just pstree with a trick Closes Debian: #201042
+ * Icons for pstree, thankyou Tatlin! Closes Debian: #192636
Changes in 21.3
===============
supported then let me know, all it takes is translating one file in
a certain manner.
+Icons
+-----
+The pstree icons were drawn by Tatlin at Coresis who has given permission
+for them to be used for psmisc.
+
- Craig
of psmisc. Since version 20 Craig Small <csmall@small.dropbear.id.au>
can be blamed.
.SH "SEE ALSO"
-.BR kill (1), fuser (1), pgrep (1), pidof (1), ps (1), kill (2)
+.BR kill (1), fuser (1), pgrep (1), pidof (1), pkill (1), ps (1), kill (2)
.\"{{{}}}
pstree \- display a tree of processes
.SH SYNOPSIS
.ad l
-.B pstree
+.B pstree
.RB [ \-a ]
.RB [ \-c ]
.RB [ \-h | \-H \fIpid\fB ]
init\-\-\-4*[getty]
.sp
.fi
+.PP
+If \fBpstree\fR is called as \fBpstree.x11\fR then it will prompt the user
+at the end of the line to press return and will not return until that
+has happened. This is useful for when \fBpstree\fR is run in a xterminal.
+
.SH OPTIONS
.IP \fB\-a\fP
Show command line arguments. If the command line of a process is swapped out,
.nf
/proc location of the proc file system
.fi
-.SH AUTHOR
+.SH AUTHORS
Werner Almesberger <Werner.Almesberger@epfl.ch>
+Craig Small <csmall@small.dropbear.id.au>
.SH "SEE ALSO"
ps(1), top(1)
.\"{{{}}}
--- /dev/null
+/* XPM */
+static char * icon_16x16_xpm[] = {
+"16 16 31 1",
+" c None",
+". c #4E1C0D",
+"+ c #A1CDA4",
+"@ c #73F91C",
+"# c #D4880C",
+"$ c #8D320A",
+"% c #DE8F69",
+"& c #67FC03",
+"* c #AA6D53",
+"= c #99F56C",
+"- c #AA9177",
+"; c #AA4509",
+"> c #6CF10A",
+", c #CB7502",
+"' c #3B7529",
+") c #D06938",
+"! c #A5610F",
+"~ c #86D83B",
+"{ c #CC8346",
+"] c #B97428",
+"^ c #864909",
+"/ c #7FF432",
+"( c #C65707",
+"_ c #709081",
+": c #BD300E",
+"< c #68FC04",
+"[ c #A44C36",
+"} c #757408",
+"| c #60E804",
+"1 c #927136",
+"2 c #6D473C",
+" ",
+" ",
+" ,,, _ ",
+" ,#%{,): ",
+" ###,]!({ ",
+" %#{#,*;(:) ",
+" ##{]][^]$$; ",
+" ,,{]#{());$:$1 ",
+" {,*:!^22:^%)$- ",
+" {)$-)^;:!$2.%1 ",
+" !(2._[!$$.*((+ ",
+" {[*1}$..$!- ",
+" ^. ",
+" .' ",
+" _'.'' ",
+" "};
--- /dev/null
+/* XPM */
+static char * icon_32x32_xpm[] = {
+"32 32 31 1",
+" c None",
+". c #4E1C0D",
+"+ c #A1CDA4",
+"@ c #73F91C",
+"# c #D4880C",
+"$ c #8D320A",
+"% c #DE8F69",
+"& c #67FC03",
+"* c #AA6D53",
+"= c #99F56C",
+"- c #AA9177",
+"; c #AA4509",
+"> c #6CF10A",
+", c #CB7502",
+"' c #3B7529",
+") c #D06938",
+"! c #A5610F",
+"~ c #86D83B",
+"{ c #CC8346",
+"] c #B97428",
+"^ c #864909",
+"/ c #7FF432",
+"( c #C65707",
+"_ c #709081",
+": c #BD300E",
+"< c #68FC04",
+"[ c #A44C36",
+"} c #757408",
+"| c #60E804",
+"1 c #927136",
+"2 c #6D473C",
+" ",
+" ",
+" ",
+" ",
+" ! - - ",
+" ,(,,,) _ ",
+" ],{#{,,,) ]:1 ",
+" ,###%{{#,()(:: ",
+" ###{###],,,(($1 ",
+" ######,]]]!](;{ 1 ",
+" %%##{{#,(;)*;;([[:_ ",
+" %%%##{###,)*;;;(;::)- ",
+" %%###%){,)))$^!);;:$;: ",
+" %####{{]{]*[$^*];$$$;;$ ",
+" -]%)####,,!!!{1!]];:;^;;$:{ ",
+" -,,,({]]]##{,()){);;;$$:;$;1 ",
+" +{,,,!,]*]!!]])(;;;)$22:*^[+ ",
+" {,,!**:$!1^.2-2[:!^[%{):$[- ",
+" {))$*--[[1.$.[;!;^$[[$$.[$1 ",
+" {%)[$1-))[^[;;:;!:$22..*%11 ",
+" {#)[{-;$22$!$;(;;;$[_22[::-+ ",
+" #!(((2$.__.[$!!$$$$.$*)(:({+ ",
+" }^*;$![.[!$!$$2...$::(;^}}1 ",
+" #{_[[*21#}$$....^$$!2- ",
+" },:11} }2..2+ __ _ ",
+" ^.. ",
+" }^^} ",
+" '..' ",
+" '.'''' ",
+" _ ''.''''' + ",
+" +++___''''_+++_+++ ",
+" "};
bin_PROGRAMS = fuser killall pstree
+bin_SCRIPTS = pstree.x11
+
fuser_SOURCES = fuser.c comm.h signals.c signals.h signames.h loop.h
killall_SOURCES = killall.c comm.h signals.c signals.h signames.h
BUILT_SOURCES = signames.h
-EXTRA_DIST = signames.c
+EXTRA_DIST = signames.c pstree.x11
CLEANFILES = signames.h
return ch == 'y' || ch == 'Y';
}
-#define MAX_PATHNAME (NAME_MAX * 2 + 14 + 1)
-#define MAX_TESTPATH (NAME_MAX + 14 + 1)
-int getuserprocs(int mysignal, int names, char **namelist)
-{
- int i;
- int j;
- int waitpid = 0;
- DIR *dir;
- pid_t pidkilled;
- pid_t* killedarray;
- struct dirent *de;
- char pathname[MAX_PATHNAME + 1];
- char testpath[MAX_TESTPATH + 1 ]; /* /proc//environ\0 15 chars */
- struct stat statbuf;
- int maxnum = 100;
- char answer;
-
- if(!namelist) exit(1);
- if(!(killedarray = malloc( 100 * sizeof(pid_t) )))
- {
- perror("malloc");
- exit(1);
- }
- for ( i = 0; i < names; i++)
- {
- if (exact)
- {
- for(j = 0; j < strlen(namelist[i]); j++)
- {
- if ( (namelist[i][j] == '*') || (namelist[i][j] =='?') )
- {
- printf("Error, cannot match wildcards in exact mode\n");
- exit(1);
- }
- }
- }
- if (!(dir = opendir (PROC_BASE)))
- {
- perror (PROC_BASE);
- exit (1);
- }
- while ( (de = readdir(dir)) != NULL)
- {
- snprintf(testpath, NAME_MAX+14, "/proc/%s/environ", de->d_name);
- if (!stat(testpath, &statbuf) )
- {
- if(S_ISREG(statbuf.st_mode) )
- {
- sprintf(pathname, "cat /proc/%s/environ | grep LOGNAME=%s > /dev/null ", de->d_name, namelist[i]);
- if ( system (pathname) == 0)
- {
- pidkilled = (pid_t)atoi(de->d_name);
- killedarray[waitpid++] = pidkilled;
- if ( waitpid == maxnum)
- {
- maxnum *= 2;
- if (!(killedarray = realloc(killedarray, maxnum * sizeof(pid_t))))
- {
- perror("realloc");
- exit(1);
- }
- }
- }
- }
- }
- }
- }
- closedir(dir);
- for (i = 0; i < waitpid; i++)
- {
- if (interactive)
- {
- printf("Kill %d (y/n)?", (int)killedarray[i]);
- scanf("%s", &answer);
- }
- if ( ( (interactive) && ( (answer == 'y') || (answer == 'Y') ) ) || !(interactive) )
- {
- if(kill (process_group? -killedarray[i]: killedarray[i], mysignal ) == 0)
- {
- if(verbose) printf("Pid %d killed with signal %d\n", (int)killedarray[i], mysignal);
- if(wait_until_dead)
- {
- kill(process_group? -killedarray[i]: killedarray[i], mysignal);
- sleep(1);
- }
-
- }
- }
- }
- free(killedarray);
- return 0;
-
-}
#ifdef FLASK_LINUX
static int
kill_all(int signal, int names, char **namelist, security_id_t sid )
static PROC *list = NULL;
static int width[MAX_DEPTH], more[MAX_DEPTH];
static int print_args = 0, compact = 1, user_change = 0, pids = 0, by_pid = 0,
- trunc = 1;
+ trunc = 1, wait_end = 0;
#ifdef FLASK_LINUX
static int show_sids = 0;
static int show_scontext = 0;
pid_t pid, highlight;
char termcap_area[1024];
int c;
+ char *tmpstr;
if (ioctl (1, TIOCGWINSZ, &winsz) >= 0)
if (winsz.ws_col)
setlocale(LC_ALL, "");
+ if ( (tmpstr = strrchr(argv[0],'/'))) {
+ tmpstr++;
+ if (strcmp(tmpstr, "pstree.x11") ==0)
+ wait_end=1;
+ }
+
+
#ifdef FLASK_LINUX
while ((c = getopt (argc, argv, "acGhH:npluUVsx")) != EOF)
#else /*FLASK_LINUX*/
return 1;
}
}
+ if (wait_end == 1) {
+ fprintf(stderr, "Press return to close\n");
+ (void)getchar();
+ }
+
return 0;
}