1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-25 09:34:11 +00:00

- Update to 21.5

- Take maintainership
This commit is contained in:
Pav Lucistnik 2005-09-10 02:22:03 +00:00
parent b74c8934e3
commit c3e40d686b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=142329
10 changed files with 280 additions and 212 deletions

View File

@ -6,22 +6,29 @@
#
PORTNAME= psmisc
PORTVERSION= 17
PORTVERSION= 21.5
CATEGORIES= sysutils
MASTER_SITES= ftp://ftp.uni-bremen.de/pub/mirrors/sunsite/system/status/ps/
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= psmisc
MAINTAINER= ports@FreeBSD.org
MAINTAINER= pav@FreeBSD.org
COMMENT= A port of the Linux pstree, killall and pidof commands
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --disable-nls
USE_GMAKE= yes
USE_GETOPT_LONG=yes
CONFLICTS= pstree-2.* \
pidof-*
PLIST_FILES= bin/killall \
bin/pidof \
bin/pstree
bin/pstree bin/pstree.x11
INSTALL_TARGET= install-all
MAN1= pidof.1 pstree.1 killall.1
WRKSRC= ${WRKDIR}/psmisc
MAN1= pstree.1 killall.1
post-install:
@${LN} -sf killall ${PREFIX}/bin/pidof
.include <bsd.port.mk>

View File

@ -1,2 +1,2 @@
MD5 (psmisc-17.tar.gz) = d7ee62a4c936360aa2f87b24c86e4092
SIZE (psmisc-17.tar.gz) = 20330
MD5 (psmisc-21.5.tar.gz) = c62b09ad5129e2f7e4611019d1d3d4b8
SIZE (psmisc-21.5.tar.gz) = 382603

View File

@ -1,68 +0,0 @@
--- Makefile.orig Mon Jul 28 05:28:00 1997
+++ Makefile Sat Dec 19 22:01:20 1998
@@ -3,18 +3,20 @@
-Wall -Wno-parentheses -Wwrite-strings -Wpointer-arith \
# -Wcast-align -Wconversion -g
LDFLAGS=#-s -N #-Xlinker -qmagic
-REAL_CPP=/lib/cpp
-PROGS=killall pstree fuser
-EBINDIR=/bin # essential binaries
-BINDIR=/usr/bin # not so essential ones
-MANDIR=/usr/man/man1 # all man pages
+REAL_CPP=gcc -E
+PROGS=killall pstree # fuser
+EBINDIR=${PREFIX}/bin # essential binaries
+BINDIR=${PREFIX}/bin # not so essential ones
+MANDIR=${PREFIX}/man/man1 # all man pages
+INSTALL_MAN=${BSD_INSTALL_MAN}
+INSTALL_BIN=${BSD_INSTALL_PROGRAM}
all: $(PROGS)
signames.h: /usr/include/signal.h
- $(REAL_CPP) -dM </usr/include/signal.h | \
+ $(REAL_CPP) -dM /usr/include/signal.h | \
tr -s '\t ' ' ' | sort -n +2 | sed \
- 's:#define SIG\([A-Z]\+[0-9]*\) \([0-9]\+\) *\(\|/\*.*\)$$:{\
+ 's:#define SIG\([A-Z][A-Z]*[0-9]*\) \([0-9][0-9]*\).*$$:{\
\2,"\1" },:p;d' \
> signames.h
@@ -25,27 +27,27 @@
fuser: fuser.o signals.o
killall: killall.o signals.o
+ $(CC) $(CFLAGS) $(LDFLAGS) -o killall killall.o signals.o -ltermcap
pstree: pstree.c comm.h Makefile VERSION
$(CC) $(CFLAGS) $(LDFLAGS) -o pstree pstree.c -ltermcap
+install-all: install install-pidof
+
install: $(PROGS)
# EBINDIR is expected to exist, so we don't try to create it
- install -o 0 -g 0 -m 555 fuser $(EBINDIR)
+# install -o 0 -g 0 -m 555 fuser $(EBINDIR)
[ -d $(BINDIR) ] || install -d -o 0 -g 0 -m 755 $(BINDIR)
- install -o 0 -g 0 -m 555 killall $(BINDIR)
- install -o 0 -g 0 -m 555 pstree $(BINDIR)
+ $(INSTALL_BIN) killall $(BINDIR)
+ $(INSTALL_BIN) pstree $(BINDIR)
[ -d $(MANDIR) ] || install -d -o 0 -g 0 -m 755 $(MANDIR)
- install -o 0 -g 0 -m 444 fuser.1 $(MANDIR)
- install -o 0 -g 0 -m 444 killall.1 $(MANDIR)
- install -o 0 -g 0 -m 444 pstree.1 $(MANDIR)
+# install -o 0 -g 0 -m 444 fuser.1 $(MANDIR)
+ $(INSTALL_MAN) killall.1 $(MANDIR)
+ $(INSTALL_MAN) pstree.1 $(MANDIR)
install-pidof:
- @[ -x `echo $(BINDIR)`/killall ] || { \
- echo "Need `echo $(BINDIR)`/killall to install pidof"; \
- exit 1 }
ln -sf killall `echo $(BINDIR)`/pidof
- install -o 0 -g 0 -m 444 pidof.1 $(MANDIR)
+ $(INSTALL_MAN) pidof.1 $(MANDIR)
clean:
rm -f *.o signames.h

View File

@ -1,63 +0,0 @@
--- killall.c.orig Tue Feb 17 15:05:21 1998
+++ killall.c Sat Dec 19 22:01:20 1998
@@ -12,6 +12,7 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/param.h>
#include "comm.h"
#include "signals.h"
@@ -50,7 +51,6 @@
struct stat st,sts[MAX_NAMES];
int *name_len;
char path[PATH_MAX+1],comm[COMM_LEN];
- char command_buf[PATH_MAX+1];
char *command;
pid_t *pid_table,pid,self,*pid_killed;
int empty,i,j,okay,length,got_long,error;
@@ -103,33 +103,15 @@
exit(1);
}
for (i = 0; i < pids; i++) {
- sprintf(path,"%s/%d/stat",PROC_BASE,pid_table[i]);
+ sprintf(path,"%s/%d/status",PROC_BASE,pid_table[i]);
if (!(file = fopen(path,"r"))) continue;
empty = 0;
- okay = fscanf(file,"%*d (%[^)]",comm) == 1;
+ okay = fscanf(file,"%s",comm) == 1;
(void) fclose(file);
if (!okay) continue;
got_long = 0;
command = NULL; /* make gcc happy */
length = strlen(comm);
- if (length == COMM_LEN-1) {
- sprintf(path,"%s/%d/cmdline",PROC_BASE,pid_table[i]);
- if (!(file = fopen(path,"r"))) continue;
- okay = fscanf(file,"%s",command_buf) == 1;
- (void) fclose(file);
- if (exact && !okay) {
- if (verbose)
- fprintf(stderr,"skipping partial match %s(%d)\n",comm,
- pid_table[i]);
- continue;
- }
- got_long = okay;
- if (okay) {
- command = strrchr(command_buf,'/');
- if (command) command++;
- else command = command_buf;
- }
- }
for (j = 0; j < names; j++) {
if (!sts[j].st_dev) {
if (length != COMM_LEN-1 || name_len[j] < COMM_LEN-1) {
@@ -139,7 +121,7 @@
strncmp(namelist[j],comm,COMM_LEN-1)) continue;
}
else {
- sprintf(path,"%s/%d/exe",PROC_BASE,pid_table[i]);
+ sprintf(path,"%s/%d/file",PROC_BASE,pid_table[i]);
if (stat(path,&st) < 0) continue;
if (sts[j].st_dev != st.st_dev || sts[j].st_ino != st.st_ino)
continue;

View File

@ -1,72 +0,0 @@
--- pstree.c.orig Tue Aug 26 12:09:05 1997
+++ pstree.c Sat Dec 19 22:01:20 1998
@@ -9,7 +9,6 @@
#include <ctype.h>
#include <unistd.h>
#include <fcntl.h>
-#include <getopt.h>
#include <pwd.h>
#include <dirent.h>
#include <termios.h>
@@ -17,6 +16,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#include <sys/param.h>
#include "comm.h"
@@ -387,8 +387,7 @@
char path[PATH_MAX+1],comm[COMM_LEN+1];
char *buffer;
pid_t pid,ppid;
- int fd,size;
- int empty,dummy;
+ int empty;
if (!print_args) buffer = NULL;
else if (!(buffer = malloc((size_t) (output_width+1)))) {
@@ -402,31 +401,15 @@
empty = 1;
while (de = readdir(dir))
if (pid = atoi(de->d_name)) {
- sprintf(path,"%s/%d/stat",PROC_BASE,pid);
+ sprintf(path,"%s/%d/status",PROC_BASE,pid);
if (file = fopen(path,"r")) {
empty = 0;
if (fstat(fileno(file),&st) < 0) {
perror(path);
exit(1);
}
- if (fscanf(file,"%d (%[^)]) %c %d",&dummy,comm,(char *) &dummy,
- &ppid) == 4) {
- if (!print_args) add_proc(comm,pid,ppid,st.st_uid,NULL,0);
- 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;
- add_proc(comm,pid,ppid,st.st_uid,buffer,size);
- }
+ if (fscanf(file,"%s %*d %d",comm,&ppid) == 2) {
+ add_proc(comm,pid,ppid,st.st_uid,NULL,0);
}
(void) fclose(file);
}
@@ -500,7 +483,7 @@
while ((c = getopt(argc,argv,"acGhnpluUV")) != EOF)
switch (c) {
case 'a':
- print_args = 1;
+ /* print_args = 1; */
break;
case 'c':
compact = 0;

View File

@ -0,0 +1,11 @@
--- 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
+man_MANS = killall.1 pstree.1
EXTRA_DIST = $(man_MANS)
all: all-am

View File

@ -0,0 +1,60 @@
--- src/Makefile.in.orig Tue May 25 02:55:10 2004
+++ src/Makefile.in Sat Sep 10 02:45:34 2005
@@ -15,7 +15,7 @@
@SET_MAKE@
-SOURCES = $(fuser_SOURCES) $(killall_SOURCES) $(pstree_SOURCES)
+SOURCES = $(killall_SOURCES) $(pstree_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@@ -38,7 +38,7 @@
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = @host@
-bin_PROGRAMS = fuser$(EXEEXT) killall$(EXEEXT) pstree$(EXEEXT)
+bin_PROGRAMS = killall$(EXEEXT) pstree$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -75,8 +75,8 @@
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(fuser_SOURCES) $(killall_SOURCES) $(pstree_SOURCES)
-DIST_SOURCES = $(fuser_SOURCES) $(killall_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)
@@ -193,9 +193,9 @@
bin_SCRIPTS = pstree.x11
fuser_SOURCES = fuser.c comm.h signals.c signals.h loop.h
killall_SOURCES = killall.c comm.h signals.c signals.h
-killall_LDADD = @FLASK_LIB@
+killall_LDADD = @FLASK_LIB@ $(LIBINTL)
pstree_SOURCES = pstree.c comm.h
-pstree_LDADD = @TERMCAP_LIB@ @FLASK_LIB@
+pstree_LDADD = @TERMCAP_LIB@ @FLASK_LIB@ $(LIBINTL)
BUILT_SOURCES = signames.h
EXTRA_DIST = signames.c
CLEANFILES = signames.h pstree.x11
@@ -504,12 +504,11 @@
signames.h: signames.c Makefile
@CPP@ -dM $< |\
- tr -s '\t ' ' ' | sort -n -k 3 | sed \
- '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; }
- grep '^{ 1,"HUP" },$$' signames.h >/dev/null || \
+ grep '^{1,"HUP" },$$' signames.h >/dev/null || \
{ rm -f signames.h; exit 1; }
Makefile: signames.h

View File

@ -0,0 +1,11 @@
--- src/comm.h.orig Thu Dec 14 00:43:10 2000
+++ src/comm.h Sat Sep 10 03:55:27 2005
@@ -11,7 +11,7 @@
#define COMM_LEN sizeof(dummy.comm)
extern struct task_struct dummy;
#else
-#define COMM_LEN 16 /* synchronize with size of comm in struct task_struct in
+#define COMM_LEN 254 /* synchronize with size of comm in struct task_struct in
/usr/include/linux/sched.h */
#endif

View File

@ -0,0 +1,111 @@
--- src/killall.c.orig Fri Apr 23 15:51:26 2004
+++ src/killall.c Sat Sep 10 03:55:48 2005
@@ -80,7 +80,7 @@
struct dirent *de;
FILE *file;
struct stat st, sts[MAX_NAMES];
- int *name_len;
+ int *name_len = 0;
char *path, comm[COMM_LEN];
char *command_buf;
char *command;
@@ -171,7 +171,7 @@
}
for (i = 0; i < pids; i++)
{
- if (asprintf (&path, PROC_BASE "/%d/stat", pid_table[i]) < 0)
+ if (asprintf (&path, PROC_BASE "/%d/status", pid_table[i]) < 0)
continue;
if (!(file = fopen (path, "r")))
{
@@ -180,72 +180,13 @@
}
free (path);
empty = 0;
- okay = fscanf (file, "%*d (%[^)]", comm) == 1;
+ okay = fscanf (file, "%s", comm) == 1;
(void) fclose (file);
if (!okay)
continue;
got_long = 0;
command = NULL; /* make gcc happy */
length = strlen (comm);
- if (length == COMM_LEN - 1)
- {
- if (asprintf (&path, PROC_BASE "/%d/cmdline", pid_table[i]) < 0)
- continue;
- if (!(file = fopen (path, "r"))) {
- free (path);
- continue;
- }
- free (path);
- while (1) {
- /* look for actual command so we skip over initial "sh" if any */
- char *p;
- int cmd_size = 128;
- command_buf = (char *)malloc (cmd_size);
- if (!command_buf)
- exit (1);
-
- /* 'cmdline' has arguments separated by nulls */
- for (p=command_buf; ; p++) {
- int c;
- if (p == (command_buf + cmd_size))
- {
- int cur_size = cmd_size;
- cmd_size *= 2;
- command_buf = (char *)realloc(command_buf, cmd_size);
- if (!command_buf)
- exit (1);
- p = command_buf + cur_size;
- }
- c = fgetc(file);
- if (c == EOF || c == '\0') {
- *p = '\0';
- break;
- } else {
- *p = c;
- }
- }
- if (strlen(command_buf) == 0) {
- okay = 0;
- break;
- }
- p = strrchr(command_buf,'/');
- p = p ? p+1 : command_buf;
- if (strncmp(p, comm, COMM_LEN-1) == 0) {
- okay = 1;
- command = p;
- break;
- }
- }
- (void) fclose(file);
- if (exact && !okay)
- {
- if (verbose)
- fprintf (stderr, _("skipping partial match %s(%d)\n"), comm,
- pid_table[i]);
- continue;
- }
- got_long = okay;
- }
for (j = 0; j < names; j++)
{
pid_t id;
@@ -279,7 +220,7 @@
}
else
{
- if (asprintf (&path, PROC_BASE "/%d/exe", pid_table[i]) < 0)
+ if (asprintf (&path, PROC_BASE "/%d/file", pid_table[i]) < 0)
continue;
#ifdef FLASK_LINUX
if (stat_secure(path,&st,&lsid) < 0) {
@@ -355,6 +296,7 @@
fprintf (stderr, _("%s: no process killed\n"), namelist[i]);
if (pidof)
putchar ('\n');
+ return 0;
error = found == ((1 << (names - 1)) | ((1 << (names - 1)) - 1)) ? 0 : 1;
/*
* We scan all (supposedly) killed processes every second to detect dead

View File

@ -0,0 +1,71 @@
--- src/pstree.c.orig Sat Apr 24 14:44:27 2004
+++ src/pstree.c Sat Sep 10 03:02:07 2005
@@ -604,7 +604,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;
@@ -618,57 +618,9 @@
perror (path);
exit (1);
}
- fread(readbuf, BUFSIZ, 1, file) ;
- if (ferror(file) == 0)
- {
- memset(comm, '\0', COMM_LEN+1);
- tmpptr = strrchr(readbuf, ')'); /* find last ) */
- *tmpptr = '\0';
- /* We now have readbuf with pid and cmd, and tmpptr+2
- * with the rest */
- /*printf("readbuf: %s\n", readbuf);*/
- if (sscanf(readbuf, "%*d (%15c", 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)
- */
- if (!print_args)
-#ifdef FLASK_LINUX
- add_proc(comm, pid, ppid, st.st_uid, NULL, 0, sid);
-#else /*FLASK_LINUX*/
- add_proc (comm, pid, ppid, st.st_uid, NULL, 0);
-#endif /*FLASK_LINUX*/
- 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 FLASK_LINUX
- add_proc(comm, pid, ppid, st.st_uid, buffer, size, sid);
-#else /*FLASK_LINUX*/
- add_proc (comm, pid, ppid, st.st_uid, buffer, size);
-#endif /*FLASK_LINUX*/
- }
- }
- }
+ if (fscanf(file, "%s %*d %d", comm, &ppid) == 2) {
+ add_proc(comm,pid,ppid,st.st_uid,NULL,0);
}
- (void) fclose (file);
}
free (path);
}