aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorjseger <jseger@FreeBSD.org>1998-12-20 11:55:54 +0800
committerjseger <jseger@FreeBSD.org>1998-12-20 11:55:54 +0800
commitfa80aa3e181ffefacab5e673854ff5a10083b053 (patch)
treecc435add682e46459dd28f36ae8bc7c95a714ca1 /sysutils
parent2cde8d4708ef9d0ee1b40cbe5c97b3678d02df18 (diff)
downloadfreebsd-ports-gnome-fa80aa3e181ffefacab5e673854ff5a10083b053.tar.gz
freebsd-ports-gnome-fa80aa3e181ffefacab5e673854ff5a10083b053.tar.zst
freebsd-ports-gnome-fa80aa3e181ffefacab5e673854ff5a10083b053.zip
Import of psmisc-17.
A port of the Linux pstree, killall and pidof commands. Does not include the 'fuser' command. PR: ports/5970 Submitted by: rantapaa@uswest.net
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/psmisc/Makefile20
-rw-r--r--sysutils/psmisc/distinfo1
-rw-r--r--sysutils/psmisc/files/patch-aa68
-rw-r--r--sysutils/psmisc/files/patch-ab63
-rw-r--r--sysutils/psmisc/files/patch-ac72
-rw-r--r--sysutils/psmisc/pkg-comment1
-rw-r--r--sysutils/psmisc/pkg-descr2
-rw-r--r--sysutils/psmisc/pkg-plist3
8 files changed, 230 insertions, 0 deletions
diff --git a/sysutils/psmisc/Makefile b/sysutils/psmisc/Makefile
new file mode 100644
index 000000000000..bb5a85779827
--- /dev/null
+++ b/sysutils/psmisc/Makefile
@@ -0,0 +1,20 @@
+# New ports collection makefile for: psmisc
+# Version required: psmisc-17
+# Date created: 10 March 1998
+# Whom: rantapaa@uswest.net
+#
+# $Id: Makefile,v 1.2 1998/03/10 21:36:52 rantapaa Exp $
+#
+
+DISTNAME= psmisc-17
+CATEGORIES= sysutils
+MASTER_SITES= ftp://ftp.cdrom.com/pub/NetBSD/packages/distfiles/ \
+ ftp://ftp.bitcon.no/pub/NetBSD/packages/distfiles/
+
+MAINTAINER= rantapaa@uswest.net
+
+INSTALL_TARGET= install-all
+MAN1= pidof.1 pstree.1 killall.1
+WRKSRC= ${WRKDIR}/psmisc
+
+.include <bsd.port.mk>
diff --git a/sysutils/psmisc/distinfo b/sysutils/psmisc/distinfo
new file mode 100644
index 000000000000..864c4a36e72f
--- /dev/null
+++ b/sysutils/psmisc/distinfo
@@ -0,0 +1 @@
+MD5 (psmisc-17.tar.gz) = d7ee62a4c936360aa2f87b24c86e4092
diff --git a/sysutils/psmisc/files/patch-aa b/sysutils/psmisc/files/patch-aa
new file mode 100644
index 000000000000..8dbe64fadc8a
--- /dev/null
+++ b/sysutils/psmisc/files/patch-aa
@@ -0,0 +1,68 @@
+--- 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
diff --git a/sysutils/psmisc/files/patch-ab b/sysutils/psmisc/files/patch-ab
new file mode 100644
index 000000000000..70023031f4a0
--- /dev/null
+++ b/sysutils/psmisc/files/patch-ab
@@ -0,0 +1,63 @@
+--- 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;
diff --git a/sysutils/psmisc/files/patch-ac b/sysutils/psmisc/files/patch-ac
new file mode 100644
index 000000000000..f172662ebaae
--- /dev/null
+++ b/sysutils/psmisc/files/patch-ac
@@ -0,0 +1,72 @@
+--- 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;
diff --git a/sysutils/psmisc/pkg-comment b/sysutils/psmisc/pkg-comment
new file mode 100644
index 000000000000..c09919ce080d
--- /dev/null
+++ b/sysutils/psmisc/pkg-comment
@@ -0,0 +1 @@
+A port of the Linux pstree, killall and pidof commands.
diff --git a/sysutils/psmisc/pkg-descr b/sysutils/psmisc/pkg-descr
new file mode 100644
index 000000000000..0e1f582a3fcf
--- /dev/null
+++ b/sysutils/psmisc/pkg-descr
@@ -0,0 +1,2 @@
+A port of the Linux pstree, killall and pidof commands.
+Does not include the 'fuser' command.
diff --git a/sysutils/psmisc/pkg-plist b/sysutils/psmisc/pkg-plist
new file mode 100644
index 000000000000..8b39c511a076
--- /dev/null
+++ b/sysutils/psmisc/pkg-plist
@@ -0,0 +1,3 @@
+bin/killall
+bin/pidof
+bin/pstree