Update to the latest version 22.9.
This commit is contained in:
parent
a718302dd5
commit
4b18243f1f
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=247006
@ -6,9 +6,10 @@
|
||||
#
|
||||
|
||||
PORTNAME= psmisc
|
||||
PORTVERSION= 21.9
|
||||
PORTVERSION= 22.9
|
||||
CATEGORIES= sysutils
|
||||
MASTER_SITES= SF
|
||||
MASTER_SITE_SUBDIR= ${PORTNAME}/${PORTNAME}
|
||||
|
||||
MAINTAINER= ports@FreeBSD.org
|
||||
COMMENT= A port of the Linux pstree, killall and pidof commands
|
||||
|
@ -1,3 +1,3 @@
|
||||
MD5 (psmisc-21.9.tar.gz) = 7b21b6bb1e35e7e68b952e86f85c0a1c
|
||||
SHA256 (psmisc-21.9.tar.gz) = 90fd6844a4a527021d2ef3efada0fc5384d0778a09dce91ab11effed4ce34a44
|
||||
SIZE (psmisc-21.9.tar.gz) = 232172
|
||||
MD5 (psmisc-22.9.tar.gz) = c242530de46b951ab10a2237a6048a9c
|
||||
SHA256 (psmisc-22.9.tar.gz) = c98aef4bc379790229c54c8e7d97b1d1ab898346bfffcde54fcf585a3e353edd
|
||||
SIZE (psmisc-22.9.tar.gz) = 316530
|
||||
|
@ -1,10 +1,10 @@
|
||||
--- doc/Makefile.in.orig Tue May 25 02:55:07 2004
|
||||
+++ doc/Makefile.in Sat Sep 10 04:02:32 2005
|
||||
@@ -159,7 +159,7 @@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
-man_MANS = fuser.1 killall.1 pstree.1
|
||||
--- doc/Makefile.in.orig 2009-12-27 16:19:06.000000000 +0900
|
||||
+++ doc/Makefile.in 2010-01-03 00:15:19.879070557 +0900
|
||||
@@ -187,7 +187,7 @@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
-man_MANS = fuser.1 killall.1 peekfd.1 prtstat.1 pstree.1
|
||||
+man_MANS = killall.1 pstree.1
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
all: all-am
|
||||
|
@ -1,62 +1,69 @@
|
||||
--- src/Makefile.in.orig Sat Nov 5 05:18:47 2005
|
||||
+++ src/Makefile.in Wed Nov 16 17:34:55 2005
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
-SOURCES = $(fuser_SOURCES) $(killall_SOURCES) $(oldfuser_SOURCES) $(pstree_SOURCES)
|
||||
+SOURCES = $(killall_SOURCES) $(pstree_SOURCES)
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
@@ -38,8 +38,7 @@
|
||||
--- src/Makefile.in.orig 2009-12-27 16:19:06.000000000 +0900
|
||||
+++ src/Makefile.in 2010-01-03 00:25:56.093987293 +0900
|
||||
@@ -34,8 +34,8 @@
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
-bin_PROGRAMS = fuser$(EXEEXT) killall$(EXEEXT) pstree$(EXEEXT) \
|
||||
- oldfuser$(EXEEXT)
|
||||
+bin_PROGRAMS = killall$(EXEEXT) pstree$(EXEEXT)
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
@@ -75,10 +74,8 @@
|
||||
- prtstat$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
|
||||
+bin_PROGRAMS = killall$(EXEEXT) pstree$(EXEEXT) \
|
||||
+ $(am__EXEEXT_1) $(am__EXEEXT_2) \
|
||||
$(am__EXEEXT_3)
|
||||
@WANT_PEEKFD_I386_TRUE@am__append_1 = peekfd
|
||||
@WANT_PEEKFD_I386_TRUE@am__append_2 = -DI386
|
||||
@@ -81,10 +81,10 @@
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
-SOURCES = $(fuser_SOURCES) $(killall_SOURCES) $(oldfuser_SOURCES) \
|
||||
- $(pstree_SOURCES)
|
||||
-DIST_SOURCES = $(fuser_SOURCES) $(killall_SOURCES) $(oldfuser_SOURCES) \
|
||||
- $(pstree_SOURCES)
|
||||
+SOURCES = $(killall_SOURCES) $(pstree_SOURCES)
|
||||
+DIST_SOURCES = $(killall_SOURCES) $(pstree_SOURCES)
|
||||
-SOURCES = $(fuser_SOURCES) $(killall_SOURCES) $(peekfd_SOURCES) \
|
||||
- $(prtstat_SOURCES) $(pstree_SOURCES)
|
||||
-DIST_SOURCES = $(fuser_SOURCES) $(killall_SOURCES) $(peekfd_SOURCES) \
|
||||
- $(prtstat_SOURCES) $(pstree_SOURCES)
|
||||
+SOURCES = $(killall_SOURCES) \
|
||||
+ $(pstree_SOURCES)
|
||||
+DIST_SOURCES = $(killall_SOURCES) \
|
||||
+ $(pstree_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
@@ -181,9 +178,8 @@
|
||||
oldfuser_SOURCES = oldfuser.c comm.h signals.c signals.h loop.h i18n.h
|
||||
@@ -208,10 +208,10 @@
|
||||
$(am__append_4) $(am__append_6)
|
||||
fuser_SOURCES = fuser.c comm.h signals.c signals.h i18n.h fuser.h
|
||||
killall_SOURCES = killall.c comm.h signals.c signals.h i18n.h
|
||||
-killall_LDADD = @SELINUX_LIB@
|
||||
+killall_LDADD =
|
||||
peekfd_SOURCES = peekfd.c
|
||||
pstree_SOURCES = pstree.c comm.h i18n.h
|
||||
-pstree_LDADD = @TERMCAP_LIB@ @SELINUX_LIB@
|
||||
+pstree_LDADD = @TERMCAP_LIB@
|
||||
prtstat_SOURCES = prtstat.c prtstat.h
|
||||
BUILT_SOURCES = signames.h
|
||||
EXTRA_DIST = signames.c
|
||||
CLEANFILES = signames.h
|
||||
@@ -460,12 +456,11 @@
|
||||
@@ -537,13 +537,20 @@
|
||||
|
||||
signames.h: signames.c Makefile
|
||||
@CPP@ -dM $< |\
|
||||
export LC_ALL=C ; \
|
||||
- @CPP@ -dM $< |\
|
||||
- tr -s '\t ' ' ' | sort -n -k 3 | sed \
|
||||
- 's:#define SIG\([A-Z]\+[0-9]*\) \([0-9]\+\) *\(\|/\*.*\)$$:{\
|
||||
-\2,"\1" },:p;d' | \
|
||||
- 's:#define SIG\([A-Z]\+[0-9]*\) \([0-9]\+\) *\(\|/\*.*\)$$:{\ \2,"\1" },:p;d' | \
|
||||
- grep -v '[0-9][0-9][0-9]' >signames.h || \
|
||||
+ sed 's|\t | |g; s| $$||' | sort -n -k 3 |\
|
||||
+ grep '^#define SIG[A-Z0-9]* [0-9]*$$'|sed 's|#define SIG||'|\
|
||||
+ awk '{print "{" $$2 ",\"" $$1 "\" },"}' >signames.h || \
|
||||
{ rm -f signames.h; exit 1; }
|
||||
- { rm -f signames.h; exit 1; }
|
||||
- grep '^{ 1,"HUP" },$$' signames.h >/dev/null || \
|
||||
+ grep '^{1,"HUP" },$$' signames.h >/dev/null || \
|
||||
{ rm -f signames.h; exit 1; }
|
||||
- { rm -f signames.h; exit 1; }
|
||||
+ @CPP@ -dM $< | {\
|
||||
+ signames=`kill -l | tr a-z A-Z`; \
|
||||
+ while read define name value; do \
|
||||
+ [ "$$define" = '#define' ] || continue; \
|
||||
+ case "$$value" in \
|
||||
+ *[!0-9]*) continue; \
|
||||
+ esac; \
|
||||
+ for signame in $$signames; do \
|
||||
+ if [ "$$name" = "SIG$$signame" ]; then \
|
||||
+ echo "{ $$value, \"$$signame\" },"; \
|
||||
+ fi; \
|
||||
+ done; \
|
||||
+ done; \
|
||||
+ } | sort -n -k 2 > signames.h
|
||||
|
||||
install-exec-hook:
|
||||
cd $(DESTDIR)$(bindir) && \
|
||||
|
@ -1,15 +1,24 @@
|
||||
--- src/killall.c.orig Thu Dec 1 22:32:19 2005
|
||||
+++ src/killall.c Thu Jan 5 23:32:33 2006
|
||||
@@ -59,35 +59,31 @@
|
||||
quiet = 0, wait_until_dead = 0, process_group = 0,
|
||||
--- src/killall.c.orig 2009-12-18 21:45:36.000000000 +0900
|
||||
+++ src/killall.c 2010-01-03 00:37:34.818411284 +0900
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <dirent.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
+#include <limits.h>
|
||||
+#include <locale.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <getopt.h>
|
||||
@@ -83,40 +85,35 @@
|
||||
ignore_case = 0, pidof;
|
||||
static long younger_than = 0, older_than = 0;
|
||||
|
||||
+/*
|
||||
+ * This is the implementation from 21.5, as the one in 21.6 and newer uses
|
||||
+ * Linux specific functions getline() and rpmatch()
|
||||
+ */
|
||||
+ /*
|
||||
+ * This is based on the implementation from 21.5, as the one in 21.6
|
||||
+ * and newer uses Linux specific functions getline() and rpmatch()
|
||||
+ */
|
||||
static int
|
||||
ask (char *name, pid_t pid)
|
||||
ask (char *name, pid_t pid, const int signal)
|
||||
{
|
||||
- int res;
|
||||
- size_t len;
|
||||
@ -19,8 +28,14 @@
|
||||
- len = 0;
|
||||
-
|
||||
- do {
|
||||
- printf (_("Kill %s(%s%d) ? (y/N) "), name, process_group ? "pgid " : "",
|
||||
- pid);
|
||||
- if (signal == SIGTERM)
|
||||
- printf (_("Kill %s(%s%d) ? (y/N) "), name, process_group ? "pgid " : "",
|
||||
- pid);
|
||||
- else
|
||||
- printf (_("Signal %s(%s%d) ? (y/N) "), name, process_group ? "pgid " : "",
|
||||
- pid);
|
||||
+ int ch, c;
|
||||
|
||||
- fflush (stdout);
|
||||
-
|
||||
- if (getline (&line, &len, stdin) < 0)
|
||||
@ -34,12 +49,14 @@
|
||||
- if (res >= 0) {
|
||||
- free(line);
|
||||
- return res;
|
||||
+ int ch, c;
|
||||
+
|
||||
+ do
|
||||
+ {
|
||||
+ printf (_("Kill %s(%s%d) ? (y/n) "), name, process_group ? "pgid " : "",
|
||||
+ pid);
|
||||
+ if (signal == SIGTERM)
|
||||
+ printf (_("Kill %s(%s%d) ? (y/N) "), name, process_group ? "pgid " : "",
|
||||
+ pid);
|
||||
+ else
|
||||
+ printf (_("Signal %s(%s%d) ? (y/N) "), name, process_group ? "pgid " : "",
|
||||
+ pid);
|
||||
+ fflush (stdout);
|
||||
+ do
|
||||
+ if ((ch = getchar ()) == EOF)
|
||||
@ -56,8 +73,8 @@
|
||||
+ return ch == 'y' || ch == 'Y';
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -267,7 +263,7 @@
|
||||
static double
|
||||
@@ -356,7 +353,7 @@
|
||||
}
|
||||
#endif /*WITH_SELINUX*/
|
||||
/* load process name */
|
||||
@ -66,15 +83,16 @@
|
||||
continue;
|
||||
if (!(file = fopen (path, "r")))
|
||||
{
|
||||
@@ -275,72 +271,13 @@
|
||||
@@ -364,7 +361,7 @@
|
||||
continue;
|
||||
}
|
||||
free (path);
|
||||
- okay = fscanf (file, "%*d (%15[^)]", comm) == 1;
|
||||
+ okay = fscanf (file, "%s", comm) == 1;
|
||||
(void) fclose (file);
|
||||
if (!okay)
|
||||
if (!okay) {
|
||||
fclose(file);
|
||||
continue;
|
||||
@@ -386,65 +383,6 @@
|
||||
got_long = 0;
|
||||
command = NULL; /* make gcc happy */
|
||||
length = strlen (comm);
|
||||
@ -140,21 +158,21 @@
|
||||
/* mach by process name */
|
||||
for (j = 0; j < names; j++)
|
||||
{
|
||||
@@ -372,7 +309,7 @@
|
||||
}
|
||||
else
|
||||
@@ -495,7 +433,7 @@
|
||||
{
|
||||
int ok = 1;
|
||||
|
||||
- if (asprintf (&path, PROC_BASE "/%d/exe", pid_table[i]) < 0)
|
||||
+ if (asprintf (&path, PROC_BASE "/%d/file", pid_table[i]) < 0)
|
||||
continue;
|
||||
|
||||
if (stat (path, &st) < 0)
|
||||
@@ -697,7 +634,7 @@
|
||||
fprintf (stderr, _("Maximum number of names is %d\n"), MAX_NAMES);
|
||||
exit (1);
|
||||
}
|
||||
- if (stat("/proc/self/stat", &isproc)==-1)
|
||||
+ if (stat("/proc/curproc/status", &isproc)==-1)
|
||||
{
|
||||
fprintf (stderr, _("%s is empty (not mounted ?)\n"), PROC_BASE);
|
||||
exit (1);
|
||||
@@ -842,7 +780,7 @@
|
||||
fprintf (stderr, _("Maximum number of names is %d\n"), MAX_NAMES);
|
||||
exit (1);
|
||||
}
|
||||
- if (stat("/proc/self/stat", &isproc)==-1) {
|
||||
+ if (stat("/proc/curproc/status", &isproc)==-1) {
|
||||
fprintf (stderr, _("%s is empty (not mounted ?)\n"), PROC_BASE);
|
||||
exit (1);
|
||||
}
|
||||
|
@ -1,109 +1,50 @@
|
||||
--- src/pstree.c.orig Fri Nov 25 23:14:48 2005
|
||||
+++ src/pstree.c Thu Jan 5 23:34:36 2006
|
||||
@@ -590,7 +590,7 @@
|
||||
{
|
||||
if (!(path = malloc (strlen (PROC_BASE) + strlen (de->d_name) + 10)))
|
||||
exit (2);
|
||||
- sprintf (path, "%s/%d/stat", PROC_BASE, pid);
|
||||
+ sprintf (path, "%s/%d/status", PROC_BASE, pid);
|
||||
if ((file = fopen (path, "r")) != NULL)
|
||||
{
|
||||
empty = 0;
|
||||
@@ -608,95 +608,8 @@
|
||||
perror (path);
|
||||
exit (1);
|
||||
}
|
||||
- fread(readbuf, BUFSIZ, 1, file) ;
|
||||
- if (ferror(file) == 0)
|
||||
- {
|
||||
- memset(comm, '\0', COMM_LEN+1);
|
||||
- tmpptr = strrchr(readbuf, ')'); /* find last ) */
|
||||
- /* We now have readbuf with pid and cmd, and tmpptr+2
|
||||
- * with the rest */
|
||||
- /*printf("readbuf: %s\n", readbuf);*/
|
||||
- if (sscanf(readbuf, "%*d (%15[^)]", comm) == 1)
|
||||
- {
|
||||
- /*printf("tmpptr: %s\n", tmpptr+2);*/
|
||||
- if (sscanf(tmpptr+2, "%*c %d", &ppid) == 1)
|
||||
- {
|
||||
-/*
|
||||
- if (fscanf
|
||||
- (file, "%d (%s) %c %d", &dummy, comm, (char *) &dummy,
|
||||
- &ppid) == 4)
|
||||
- */
|
||||
- {
|
||||
- DIR *taskdir;
|
||||
- struct dirent *dt;
|
||||
- char *taskpath;
|
||||
- char *threadname;
|
||||
- int thread;
|
||||
-
|
||||
- if (!(taskpath = malloc(strlen(path) + 10))) {
|
||||
- exit (2);
|
||||
- }
|
||||
- sprintf (taskpath, "%s/task", path);
|
||||
-
|
||||
- if ((taskdir=opendir(taskpath))!=0) {
|
||||
- /* if we have this dir, we're on 2.6 */
|
||||
- if (!(threadname = malloc(strlen(comm) + 3))) {
|
||||
- exit (2);
|
||||
- }
|
||||
- sprintf(threadname,"{%s}",comm);
|
||||
- while ((dt = readdir(taskdir)) != NULL) {
|
||||
- if ((thread=atoi(dt->d_name)) !=0) {
|
||||
- if (thread != pid) {
|
||||
-#ifdef WITH_SELINUX
|
||||
- if (print_args)
|
||||
- add_proc(threadname, thread, pid, st.st_uid, threadname, strlen(threadname)+1, scontext);
|
||||
- else
|
||||
- add_proc(threadname, thread, pid, st.st_uid, NULL, 0, scontext);
|
||||
-#else /*WITH_SELINUX*/
|
||||
- if (print_args)
|
||||
- add_proc(threadname, thread, pid, st.st_uid, threadname, strlen(threadname)+1);
|
||||
- else
|
||||
- add_proc(threadname, thread, pid, st.st_uid, NULL, 0);
|
||||
-#endif /*WITH_SELINUX*/
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- free(threadname);
|
||||
- (void) closedir(taskdir);
|
||||
- }
|
||||
- free(taskpath);
|
||||
- }
|
||||
-
|
||||
- if (!print_args)
|
||||
-#ifdef WITH_SELINUX
|
||||
- add_proc(comm, pid, ppid, st.st_uid, NULL, 0, scontext);
|
||||
-#else /*WITH_SELINUX*/
|
||||
- add_proc (comm, pid, ppid, st.st_uid, NULL, 0);
|
||||
-#endif /*WITH_SELINUX*/
|
||||
- else
|
||||
- {
|
||||
- sprintf (path, "%s/%d/cmdline", PROC_BASE, pid);
|
||||
- if ((fd = open (path, O_RDONLY)) < 0)
|
||||
- {
|
||||
- perror (path);
|
||||
- exit (1);
|
||||
- }
|
||||
- if ((size = read (fd, buffer, (size_t) output_width)) < 0)
|
||||
- {
|
||||
- perror (path);
|
||||
- exit (1);
|
||||
- }
|
||||
- (void) close (fd);
|
||||
- if (size)
|
||||
- buffer[size++] = 0;
|
||||
-#ifdef WITH_SELINUX
|
||||
- add_proc(comm, pid, ppid, st.st_uid, buffer, size, scontext);
|
||||
-#else /*WITH_SELINUX*/
|
||||
- add_proc (comm, pid, ppid, st.st_uid, buffer, size);
|
||||
-#endif /*WITH_SELINUX*/
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ if (fscanf(file, "%s %*d %d", comm, &ppid) == 2) {
|
||||
+ add_proc(comm,pid,ppid,st.st_uid,NULL,0);
|
||||
}
|
||||
(void) fclose (file);
|
||||
}
|
||||
--- src/pstree.c.orig 2009-12-27 15:46:47.000000000 +0900
|
||||
+++ src/pstree.c 2010-01-03 00:52:21.437862505 +0900
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <term.h>
|
||||
#include <termios.h>
|
||||
#include <langinfo.h>
|
||||
+#include <limits.h>
|
||||
#include <assert.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -590,7 +591,11 @@
|
||||
struct dirent *de;
|
||||
FILE *file;
|
||||
struct stat st;
|
||||
+#ifdef __FreeBSD__
|
||||
+ char *path, comm[COMM_LEN + 1];
|
||||
+#else
|
||||
char *path, *comm;
|
||||
+#endif
|
||||
char *buffer;
|
||||
size_t buffer_size;
|
||||
char readbuf[BUFSIZ + 1];
|
||||
@@ -623,7 +628,7 @@
|
||||
if ((pid = (pid_t) atoi(de->d_name)) != 0) {
|
||||
if (! (path = malloc(strlen(PROC_BASE) + strlen(de->d_name) + 10)))
|
||||
exit(2);
|
||||
- sprintf(path, "%s/%d/stat", PROC_BASE, pid);
|
||||
+ sprintf (path, "%s/%d/status", PROC_BASE, pid);
|
||||
if ((file = fopen(path, "r")) != NULL) {
|
||||
empty = 0;
|
||||
sprintf(path, "%s/%d", PROC_BASE, pid);
|
||||
@@ -638,6 +643,10 @@
|
||||
perror(path);
|
||||
exit(1);
|
||||
}
|
||||
+#ifdef __FreeBSD__
|
||||
+ if (fscanf(file, "%s %*d %d", comm, &ppid) == 2)
|
||||
+ add_proc(comm, pid, ppid, st.st_uid, NULL, 0, 0);
|
||||
+#else
|
||||
size = fread(readbuf, 1, BUFSIZ, file);
|
||||
if (ferror(file) == 0) {
|
||||
readbuf[size] = 0;
|
||||
@@ -725,6 +734,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+#endif /*__FreeBSD__*/
|
||||
(void) fclose(file);
|
||||
}
|
||||
free(path);
|
||||
|
Loading…
Reference in New Issue
Block a user