Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions

9
sysutils/psmisc/DESCR Normal file
View File

@@ -0,0 +1,9 @@
This package contains three little utilities that use the proc FS:
killall kills processes by name, e.g. killall -HUP named
pidof like killall, buts lists PIDs instead of killing processes
pstree shows the currently running processes as a tree
The Linux version includes "fuser" for listing processes' open files,
but NetBSD's procfs doesn't have the facilities for this (use
fstat(1) or the lsof package instead).

9
sysutils/psmisc/MESSAGE Normal file
View File

@@ -0,0 +1,9 @@
===========================================================================
$NetBSD: MESSAGE,v 1.1 2001/10/31 22:53:38 zuntum Exp $
To use ${PKGNAME}, the following things must exist on the system:
(1) a kernel configured with the PROCFS option, and
(2) a procfs filesystem mounted on /proc.
===========================================================================

31
sysutils/psmisc/Makefile Normal file
View File

@@ -0,0 +1,31 @@
# $NetBSD: Makefile,v 1.27 2013/05/29 14:57:43 wiz Exp $
DISTNAME= psmisc-20.1
CATEGORIES= sysutils
PKGREVISION= 2
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=psmisc/}
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://psmisc.sourceforge.net/
COMMENT= Miscellaneous procfs tools: killall, pidof, and pstree
LICENSE= gnu-gpl-v2
CONFLICTS+= pstree<=2.16
PKG_INSTALLATION_TYPES= overwrite pkgviews
GNU_CONFIGURE= yes
LIBS+= ${BUILDLINK_LDADD.getopt}
# "make install" doesn't install the link from killall -> pidof.
post-install:
${RM} -f ${DESTDIR}${PREFIX}/bin/pidof
${LN} -f ${DESTDIR}${PREFIX}/bin/killall ${DESTDIR}${PREFIX}/bin/pidof
.include "../../mk/termcap.buildlink3.mk"
# XXX configure only tests for ncurses and termcap.
.if empty(BUILDLINK_TREE:Mncurses)
BUILDLINK_TRANSFORM+= l:ncurses:curses
.endif
.include "../../devel/libgetopt/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

7
sysutils/psmisc/PLIST Normal file
View File

@@ -0,0 +1,7 @@
@comment $NetBSD: PLIST,v 1.1 2001/10/31 22:53:38 zuntum Exp $
bin/killall
bin/pidof
bin/pstree
man/man1/killall.1
man/man1/pidof.1
man/man1/pstree.1

12
sysutils/psmisc/distinfo Normal file
View File

@@ -0,0 +1,12 @@
$NetBSD: distinfo,v 1.4 2005/02/24 13:40:56 agc Exp $
SHA1 (psmisc-20.1.tar.gz) = e969a2f539b181c372b0f82bbbd430c4d57d5d6b
RMD160 (psmisc-20.1.tar.gz) = 48698ad9f431c881bcb42394f5c912ef91b84d2b
Size (psmisc-20.1.tar.gz) = 57767 bytes
SHA1 (patch-aa) = 97b586e06444b9aa2a6ba95c10eaabc93f89c833
SHA1 (patch-ab) = 4aadacec85e2234c010aad2db5fa9fe469562f4f
SHA1 (patch-ac) = 9f9a7c7c5155345a1045aee70a2dd65a25ec7219
SHA1 (patch-ad) = 73ae9467e783957ce7ff638d8637e7398f75c5fe
SHA1 (patch-ae) = 484305118582c575f8c4827783aa3d5f57b25b5d
SHA1 (patch-af) = 3c5ba3cf27a422943f984b8414ac29da0b8934da
SHA1 (patch-ag) = a03a4a0c0dbf065e2b2785cee8f23579a11ae13f

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-aa,v 1.6 2001/04/24 16:59:35 jlam Exp $
--- doc/Makefile.in.orig Sat Mar 31 05:40:07 2001
+++ doc/Makefile.in
@@ -64,7 +64,7 @@
TERMCAP_LIB = @TERMCAP_LIB@
VERSION = @VERSION@
-man_MANS = fuser.1 killall.1 pidof.1 pstree.1
+man_MANS = killall.1 pidof.1 pstree.1
EXTRA_DIST = $(man_MANS)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs

View File

@@ -0,0 +1,16 @@
$NetBSD: patch-ab,v 1.3 2001/04/24 16:59:35 jlam Exp $
--- src/Makefile.in.orig Sat Mar 31 05:40:12 2001
+++ src/Makefile.in
@@ -64,9 +64,9 @@
TERMCAP_LIB = @TERMCAP_LIB@
VERSION = @VERSION@
-CFLAGS = -Wall
+#CFLAGS = -Wall
-bin_PROGRAMS = fuser killall pstree
+bin_PROGRAMS = killall pstree
fuser_SOURCES = fuser.c comm.h signals.c signals.h signames.h loop.h

View File

@@ -0,0 +1,22 @@
$NetBSD: patch-ac,v 1.5 2001/04/24 16:59:35 jlam Exp $
--- src/comm.h.orig Wed Dec 13 18:43:10 2000
+++ src/comm.h
@@ -6,6 +6,10 @@
#ifndef COMM_H
#define COMM_H
+#include <sys/param.h>
+#ifdef MAXCOMLEN
+#define COMM_LEN MAXCOMLEN
+#else
#if 0 /* broken in 1.3.xx */
#include <linux/sched.h>
#define COMM_LEN sizeof(dummy.comm)
@@ -14,5 +18,6 @@
#define COMM_LEN 16 /* synchronize with size of comm in struct task_struct in
/usr/include/linux/sched.h */
#endif
+#endif /* MAXCOMLEN */
#endif

View File

@@ -0,0 +1,71 @@
$NetBSD: patch-ad,v 1.6 2001/04/24 16:59:35 jlam Exp $
--- src/killall.c.orig Sat Mar 31 05:26:47 2001
+++ src/killall.c
@@ -18,10 +18,10 @@
#include <getopt.h>
#include "comm.h"
+#include "procfs.h"
#include "signals.h"
-#define PROC_BASE "/proc"
#define MAX_NAMES (sizeof(unsigned long)*8)
@@ -138,11 +138,15 @@
}
for (i = 0; i < pids; i++)
{
- sprintf (path, PROC_BASE "/%d/stat", pid_table[i]);
+ sprintf (path, "%s/%d/%s", PROC_BASE, pid_table[i], STATUS_FILE);
if (!(file = fopen (path, "r")))
continue;
empty = 0;
+#ifdef BSD_44_PROCFS
+ okay = fscanf (file, "%s", comm) == 1;
+#else
okay = fscanf (file, "%*d (%[^)]", comm) == 1;
+#endif
(void) fclose (file);
if (!okay)
continue;
@@ -151,7 +155,10 @@
length = strlen (comm);
if (length == COMM_LEN - 1)
{
- sprintf (path, PROC_BASE "/%d/cmdline", pid_table[i]);
+#if defined(BSD_44_PROCFS) && !defined(BSD_PROCFS_CMDLINE)
+ okay = 0;
+#else
+ sprintf (path, "%s/%d/%s", PROC_BASE, pid_table[i], CMDLINE_FILE);
if (!(file = fopen (path, "r")))
continue;
while (1) {
@@ -180,6 +187,7 @@
}
}
(void) fclose(file);
+#endif
if (exact && !okay)
{
if (verbose)
@@ -206,7 +214,7 @@
}
else
{
- sprintf (path, PROC_BASE "/%d/exe", pid_table[i]);
+ sprintf (path, "%s/%d/%s", PROC_BASE, pid_table[i], EXE_FILE);
if (stat (path, &st) < 0)
continue;
if (sts[j].st_dev != st.st_dev || sts[j].st_ino != st.st_ino)
@@ -369,7 +377,7 @@
sig_num = SIGTERM;
opterr = 0;
- while ( (optc = getopt_long_only(argc,argv,"egilqs:vwV",options,NULL)) != EOF) {
+ while ( (optc = getopt_long(argc,argv,"egilqs:vwV",options,NULL)) != EOF) {
switch (optc) {
case 'e':
exact = 1;

View File

@@ -0,0 +1,25 @@
$NetBSD: patch-ae,v 1.3 2001/04/24 16:59:35 jlam Exp $
--- src/procfs.h.orig Tue Apr 24 12:31:50 2001
+++ src/procfs.h
@@ -0,0 +1,20 @@
+#include <sys/param.h>
+
+#if (defined(BSD) && BSD >= 199306)
+#define BSD_44_PROCFS
+#if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104180000)
+#define BSD_PROCFS_CMDLINE
+#endif
+#endif
+
+#ifdef BSD_44_PROCFS
+#define PROC_BASE "/proc"
+#define CMDLINE_FILE "cmdline"
+#define EXE_FILE "file"
+#define STATUS_FILE "status"
+#else
+#define PROC_BASE "/proc"
+#define CMDLINE_FILE "cmdline"
+#define EXE_FILE "exe"
+#define STATUS_FILE "stat"
+#endif

View File

@@ -0,0 +1,92 @@
$NetBSD: patch-af,v 1.4 2001/04/24 16:59:35 jlam Exp $
--- src/pstree.c.orig Mon Dec 18 00:59:23 2000
+++ src/pstree.c
@@ -22,12 +22,12 @@
#include <sys/ioctl.h>
#include "comm.h"
+#include "procfs.h"
#ifndef MAX_DEPTH
#define MAX_DEPTH 100
#endif
-#define PROC_BASE "/proc"
/* UTF-8 defines by Johan Myreen */
#define UTF_V "\342\224\202\277" /* Vertical line drawing char */
@@ -303,6 +303,7 @@
const struct passwd *pw;
int lvl, i, add, offset, len, swapped, info, count, comm_len, first;
const char *tmp, *here;
+ char tbuf[1024], *pbuf;
char comm_tmp[5];
if (!current)
@@ -327,7 +328,8 @@
add = out_int (rep) + 2;
out_string ("*[");
}
- if (current->highlight && (tmp = tgetstr ("md", NULL)))
+ pbuf = tbuf;
+ if (current->highlight && (tmp = tgetstr ("md", &pbuf)))
tputs (tmp, 1, putchar);
if ((swapped = print_args) && current->argc < 0)
out_char ('(');
@@ -366,7 +368,8 @@
}
if (info || swapped)
out_char (')');
- if (current->highlight && (tmp = tgetstr ("me", NULL)))
+ pbuf = tbuf;
+ if (current->highlight && (tmp = tgetstr ("me", &pbuf)))
tputs (tmp, 1, putchar);
if (print_args)
{
@@ -504,7 +507,7 @@
while ((de = readdir (dir)) != NULL)
if ((pid = atoi (de->d_name)) != 0)
{
- sprintf (path, "%s/%d/stat", PROC_BASE, pid);
+ sprintf (path, "%s/%d/%s", PROC_BASE, pid, STATUS_FILE);
if ((file = fopen (path, "r")) != NULL)
{
empty = 0;
@@ -513,6 +516,10 @@
perror (path);
exit (1);
}
+#ifdef BSD_44_PROCFS
+ if (fscanf(file, "%s %*d %d", comm, &ppid) == 2)
+ { { {
+#else
fread(readbuf, BUFSIZ, 1, file) ;
if (ferror(file) == 0)
{
@@ -532,11 +539,12 @@
(file, "%d (%s) %c %d", &dummy, comm, (char *) &dummy,
&ppid) == 4)
*/
+#endif
if (!print_args)
add_proc (comm, pid, ppid, st.st_uid, NULL, 0);
else
{
- sprintf (path, "%s/%d/cmdline", PROC_BASE, pid);
+ sprintf (path, "%s/%d/%s", PROC_BASE, pid, CMDLINE_FILE);
if ((fd = open (path, O_RDONLY)) < 0)
{
perror (path);
@@ -641,7 +649,11 @@
switch (c)
{
case 'a':
+#if defined(BSD_44_PROCFS) && !defined(BSD_PROCFS_CMDLINE)
+ print_args = 0;
+#else
print_args = 1;
+#endif
break;
case 'c':
compact = 0;

View File

@@ -0,0 +1,82 @@
$NetBSD: patch-ag,v 1.1 2001/04/24 16:59:35 jlam Exp $
--- src/signals.c.orig Wed Dec 13 18:43:15 2000
+++ src/signals.c
@@ -7,9 +7,17 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
+#include <sys/param.h>
#include "signals.h"
+#if (defined(BSD) && BSD >= 199306)
+#define HAVE_SYS_SIGNAME
+#endif
+
+#ifdef HAVE_SYS_SIGNAME
+#include <signal.h>
+#else
typedef struct
{
int number;
@@ -22,11 +30,26 @@
#include "signames.h"
{0, NULL}
};
+#endif
void
list_signals (void)
{
+#ifdef HAVE_SYS_SIGNAME
+ int i, col;
+
+ col = 0;
+ for (i = 1; i < NSIG; i++) {
+ if (col+strlen(sys_signame[i])+1 > 80) {
+ putchar('\n');
+ col = 0;
+ }
+ printf("%s%s",col ? " " : "",sys_signame[i]);
+ col += strlen(sys_signame[i])+1;
+ }
+ putchar('\n');
+#else
SIGNAME *walk;
int col;
@@ -42,12 +65,26 @@
col += strlen (walk->name) + 1;
}
putchar ('\n');
+#endif
}
int
get_signal (char *name, const char *cmd)
{
+#ifdef HAVE_SYS_SIGNAME
+ int i;
+ if (isdigit(*name))
+ return atoi(name);
+ for (i = 1; i < NSIG; i++) {
+ if (!strcmp(sys_signame[i],name))
+ break;
+ }
+ if (i < NSIG)
+ return i;
+ fprintf(stderr,"%s: unknown signal; %s -l lists signals.\n",name,cmd);
+ exit(1);
+#else
SIGNAME *walk;
if (isdigit (*name))
@@ -59,4 +96,5 @@
return walk->number;
fprintf (stderr, "%s: unknown signal; %s -l lists signals.\n", name, cmd);
exit (1);
+#endif
}