View | Details | Raw Unified | Return to bug 146709 | Differences between
and this patch

Collapse All | Expand All

(-)psmisc/Makefile (-3 / +22 lines)
Lines 7-26 Link Here
7
7
8
PORTNAME=	psmisc
8
PORTNAME=	psmisc
9
PORTVERSION=	22.12
9
PORTVERSION=	22.12
10
PORTREVISION=	1
10
CATEGORIES=	sysutils
11
CATEGORIES=	sysutils
11
MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}
12
MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}
12
13
13
MAINTAINER=	sunpoet@sunpoet.net
14
MAINTAINER=	sunpoet@sunpoet.net
14
COMMENT=	A port of the Linux pstree, killall and pidof commands
15
COMMENT=	A port of the Linux pstree, killall and pidof commands
15
16
17
BUILD_DEPENDS=	gsed:${PORTSDIR}/textproc/gsed
18
16
CONFLICTS=	pidof-[0-9]* pstree-2.[0-9]*
19
CONFLICTS=	pidof-[0-9]* pstree-2.[0-9]*
17
20
18
CONFIGURE_ARGS=	--disable-nls
21
LICENSE=	GPLv2
22
19
GNU_CONFIGURE=	yes
23
GNU_CONFIGURE=	yes
20
USE_GMAKE=	yes
24
USE_GMAKE=	yes
21
25
26
OPTIONS=	NLS "Native Language Support via gettext utilities" On
27
28
.include <bsd.port.pre.mk>
29
22
MAN1=		killall.1 pstree.1
30
MAN1=		killall.1 pstree.1
23
PLIST_FILES=	bin/killall bin/pidof bin/pstree bin/pstree.x11
31
32
.if defined(WITHOUT_NLS)
33
CONFIGURE_ARGS+=--disable-nls
34
PLIST_SUB+=	NLS="@comment "
35
.else
36
USE_GETTEXT=	yes
37
CONFIGURE_ARGS+=--enable-nls
38
CPPFLAGS+=	-I${LOCALBASE}/include
39
LDFLAGS+=	-L${LOCALBASE}/lib
40
CONFIGURE_ENV+=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
41
PLIST_SUB+=	NLS=""
42
.endif
24
43
25
post-patch:
44
post-patch:
26
	@${REINPLACE_CMD} -e '/^#define COMM_LEN / s|16|254|' ${WRKSRC}/src/comm.h
45
	@${REINPLACE_CMD} -e '/^#define COMM_LEN / s|16|254|' ${WRKSRC}/src/comm.h
Lines 28-31 Link Here
28
post-install:
47
post-install:
29
	@${LN} -fs killall ${PREFIX}/bin/pidof
48
	@${LN} -fs killall ${PREFIX}/bin/pidof
30
49
31
.include <bsd.port.mk>
50
.include <bsd.port.post.mk>
(-)psmisc/files/patch-src-Makefile.in (-28 / +33 lines)
Lines 1-5 Link Here
1
--- src/Makefile.in.orig	2010-07-12 19:38:08.000000000 +0800
1
--- src/Makefile.in.orig	2010-07-12 04:38:08.000000000 -0700
2
+++ src/Makefile.in	2010-07-31 18:58:38.000000000 +0800
2
+++ src/Makefile.in	2010-08-11 23:39:30.652095791 -0700
3
@@ -34,8 +34,8 @@
3
@@ -34,8 +34,8 @@
4
 POST_UNINSTALL = :
4
 POST_UNINSTALL = :
5
 build_triplet = @build@
5
 build_triplet = @build@
Lines 37-68 Link Here
37
 prtstat_SOURCES = prtstat.c prtstat.h
37
 prtstat_SOURCES = prtstat.c prtstat.h
38
 BUILT_SOURCES = signames.h
38
 BUILT_SOURCES = signames.h
39
 EXTRA_DIST = signames.c 
39
 EXTRA_DIST = signames.c 
40
@@ -545,14 +543,20 @@
40
@@ -299,19 +297,19 @@
41
 
41
 	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
42
 fuser$(EXEEXT): $(fuser_OBJECTS) $(fuser_DEPENDENCIES) 
43
 	@rm -f fuser$(EXEEXT)
44
-	$(LINK) $(fuser_OBJECTS) $(fuser_LDADD) $(LIBS)
45
+	$(LINK) $(fuser_OBJECTS) $(fuser_LDADD) $(LIBS) $(INTLLIBS)
46
 killall$(EXEEXT): $(killall_OBJECTS) $(killall_DEPENDENCIES) 
47
 	@rm -f killall$(EXEEXT)
48
-	$(LINK) $(killall_OBJECTS) $(killall_LDADD) $(LIBS)
49
+	$(LINK) $(killall_OBJECTS) $(killall_LDADD) $(LIBS) $(INTLLIBS)
50
 peekfd$(EXEEXT): $(peekfd_OBJECTS) $(peekfd_DEPENDENCIES) 
51
 	@rm -f peekfd$(EXEEXT)
52
-	$(LINK) $(peekfd_OBJECTS) $(peekfd_LDADD) $(LIBS)
53
+	$(LINK) $(peekfd_OBJECTS) $(peekfd_LDADD) $(LIBS) $(INTLLIBS)
54
 prtstat$(EXEEXT): $(prtstat_OBJECTS) $(prtstat_DEPENDENCIES) 
55
 	@rm -f prtstat$(EXEEXT)
56
-	$(LINK) $(prtstat_OBJECTS) $(prtstat_LDADD) $(LIBS)
57
+	$(LINK) $(prtstat_OBJECTS) $(prtstat_LDADD) $(LIBS) $(INTLLIBS)
58
 pstree$(EXEEXT): $(pstree_OBJECTS) $(pstree_DEPENDENCIES) 
59
 	@rm -f pstree$(EXEEXT)
60
-	$(LINK) $(pstree_OBJECTS) $(pstree_LDADD) $(LIBS)
61
+	$(LINK) $(pstree_OBJECTS) $(pstree_LDADD) $(LIBS) $(INTLLIBS)
42
 
62
 
63
 mostlyclean-compile:
64
 	-rm -f *.$(OBJEXT)
65
@@ -547,7 +545,7 @@
43
 signames.h: signames.c Makefile
66
 signames.h: signames.c Makefile
44
-		export LC_ALL=C ; \
67
 		export LC_ALL=C ; \
45
-		@CPP@ -dM $< |\
68
 		@CPP@ -dM $< |\
46
-		tr -s '\t ' ' ' | sort -n -k 3 | sed \
69
-		tr -s '\t ' ' ' | sort -n -k 3 | sed \
47
-	's:#define SIG\([A-Z]\+[0-9]*\) \([0-9]\+\) *\(\|/\*.*\)$$:{\ \2,"\1" },:p;d' | \
70
+		tr -s '\t ' ' ' | sort -n -k 3 | gsed \
48
-		  grep -v '[0-9][0-9][0-9]' >signames.h || \
71
 	's:#define SIG\([A-Z]\+[0-9]*\) \([0-9]\+\) *\(\|/\*.*\)$$:{\ \2,"\1" },:p;d' | \
49
-		  { rm -f signames.h; exit 1; }
72
 		  grep -v '[0-9][0-9][0-9]' >signames.h || \
50
-		grep '^{ 1,"HUP" },$$' signames.h >/dev/null || \
73
 		  { rm -f signames.h; exit 1; }
51
-		  { rm -f signames.h; exit 1; }
52
+		@CPP@ -dM $< | {\
53
+			signames=`kill -l | tr a-z A-Z`; \
54
+			while read define name value; do \
55
+				[ "$$define" = '#define' ] || continue; \
56
+				case "$$value" in \
57
+				*[!0-9]*) continue; \
58
+				esac; \
59
+				for signame in $$signames; do \
60
+					if [ "$$name" = "SIG$$signame" ]; then \
61
+						echo "{ $$value, \"$$signame\" },"; \
62
+					fi; \
63
+				done; \
64
+			done; \
65
+		} | sort -n -k 2 > signames.h
66
 
67
 install-exec-hook:
68
 		cd $(DESTDIR)$(bindir) && \
(-)psmisc/files/patch-src-pstree.c (-14 / +38 lines)
Lines 1-14 Link Here
1
--- src/pstree.c.orig	2009-12-27 15:46:47.000000000 +0900
1
--- src/pstree.c.orig	2009-12-27 15:46:47.000000000 +0900
2
+++ src/pstree.c	2010-01-03 00:52:21.437862505 +0900
2
+++ src/pstree.c	2010-01-03 00:52:21.437862505 +0900
3
@@ -37,6 +37,7 @@
3
@@ -37,6 +37,9 @@
4
 #include <term.h>
4
 #include <term.h>
5
 #include <termios.h>
5
 #include <termios.h>
6
 #include <langinfo.h>
6
 #include <langinfo.h>
7
+#ifdef __FreeBSD__
7
+#include <limits.h>
8
+#include <limits.h>
9
+#endif
8
 #include <assert.h>
10
 #include <assert.h>
9
 #include <sys/types.h>
11
 #include <sys/types.h>
10
 #include <sys/stat.h>
12
 #include <sys/stat.h>
11
@@ -590,7 +591,11 @@
13
@@ -590,7 +594,11 @@
12
   struct dirent *de;
14
   struct dirent *de;
13
   FILE *file;
15
   FILE *file;
14
   struct stat st;
16
   struct stat st;
Lines 20-50 Link Here
20
   char *buffer;
22
   char *buffer;
21
   size_t buffer_size;
23
   size_t buffer_size;
22
   char readbuf[BUFSIZ + 1];
24
   char readbuf[BUFSIZ + 1];
23
@@ -623,7 +628,7 @@
25
@@ -623,7 +631,11 @@
24
     if ((pid = (pid_t) atoi(de->d_name)) != 0) {
26
     if ((pid = (pid_t) atoi(de->d_name)) != 0) {
25
       if (! (path = malloc(strlen(PROC_BASE) + strlen(de->d_name) + 10)))
27
       if (! (path = malloc(strlen(PROC_BASE) + strlen(de->d_name) + 10)))
26
         exit(2);
28
         exit(2);
27
-      sprintf(path, "%s/%d/stat", PROC_BASE, pid);
29
+#ifdef __FreeBSD__
28
+      sprintf(path, "%s/%d/status", PROC_BASE, pid);
30
+      sprintf(path, "%s/%d/status", PROC_BASE, pid);
31
+#else
32
       sprintf(path, "%s/%d/stat", PROC_BASE, pid);
33
+#endif
29
       if ((file = fopen(path, "r")) != NULL) {
34
       if ((file = fopen(path, "r")) != NULL) {
30
         empty = 0;
35
         empty = 0;
31
         sprintf(path, "%s/%d", PROC_BASE, pid);
36
         sprintf(path, "%s/%d", PROC_BASE, pid);
32
@@ -638,6 +643,10 @@
37
@@ -638,6 +650,29 @@
33
           perror(path);
38
           perror(path);
34
           exit(1);
39
           exit(1);
35
         }
40
         }
36
+#ifdef __FreeBSD__
41
+#ifdef __FreeBSD__
37
+        if (fscanf(file, "%s %*d %d", comm, &ppid) == 2)
42
+        /* Read comm and ppid */
38
+          add_proc(comm, pid, ppid, st.st_uid, NULL, 0, 0);
43
+        if (fscanf(file, "%s %*d %d", readbuf, &ppid) == 2) {
44
+          tmpptr = readbuf;
45
+          size = 0;
46
+          /* Unescape comm */
47
+          do {
48
+            if (*tmpptr == '\\')
49
+            {
50
+              char tmp = tmpptr[4];
51
+              tmpptr[4] = 0;
52
+              comm[size++] = strtol(++tmpptr, NULL, 8);
53
+              tmpptr += 2;
54
+              tmpptr[1] = tmp;
55
+            }
56
+            else
57
+              comm[size++] = *tmpptr;
58
+          } while (*++tmpptr);
59
+          comm[size] = 0;
60
+          /* Balance braces */
61
+          {
62
+            {
39
+#else
63
+#else
40
         size = fread(readbuf, 1, BUFSIZ, file);
64
         size = fread(readbuf, 1, BUFSIZ, file);
41
         if (ferror(file) == 0) {
65
         if (ferror(file) == 0) {
42
           readbuf[size] = 0;
66
           readbuf[size] = 0;
43
@@ -725,6 +734,7 @@
67
@@ -692,6 +727,7 @@
44
             }
68
                   (void) closedir(taskdir);
45
           }
69
                 }
46
         }
70
               free(taskpath);
47
+#endif /*__FreeBSD__*/
71
+#endif /*__FreeBSD__*/
48
         (void) fclose(file);
72
               if (!print_args)
49
       }
73
 #ifdef WITH_SELINUX
50
       free(path);
74
                 add_proc(comm, pid, ppid, st.st_uid, NULL, 0, 0, scontext);
(-)psmisc/pkg-plist (+26 lines)
Line 0 Link Here
1
bin/killall
2
bin/pidof
3
bin/pstree
4
bin/pstree.x11
5
%%NLS%%share/locale/bg/LC_MESSAGES/psmisc.mo
6
%%NLS%%share/locale/ca/LC_MESSAGES/psmisc.mo
7
%%NLS%%share/locale/cs/LC_MESSAGES/psmisc.mo
8
%%NLS%%share/locale/de/LC_MESSAGES/psmisc.mo
9
%%NLS%%share/locale/el/LC_MESSAGES/psmisc.mo
10
%%NLS%%share/locale/eu/LC_MESSAGES/psmisc.mo
11
%%NLS%%share/locale/fi/LC_MESSAGES/psmisc.mo
12
%%NLS%%share/locale/fr/LC_MESSAGES/psmisc.mo
13
%%NLS%%share/locale/hu/LC_MESSAGES/psmisc.mo
14
%%NLS%%share/locale/id/LC_MESSAGES/psmisc.mo
15
%%NLS%%share/locale/it/LC_MESSAGES/psmisc.mo
16
%%NLS%%share/locale/ja/LC_MESSAGES/psmisc.mo
17
%%NLS%%share/locale/nb/LC_MESSAGES/psmisc.mo
18
%%NLS%%share/locale/nl/LC_MESSAGES/psmisc.mo
19
%%NLS%%share/locale/pl/LC_MESSAGES/psmisc.mo
20
%%NLS%%share/locale/pt/LC_MESSAGES/psmisc.mo
21
%%NLS%%share/locale/ro/LC_MESSAGES/psmisc.mo
22
%%NLS%%share/locale/ru/LC_MESSAGES/psmisc.mo
23
%%NLS%%share/locale/sv/LC_MESSAGES/psmisc.mo
24
%%NLS%%share/locale/vi/LC_MESSAGES/psmisc.mo
25
%%NLS%%share/locale/zh_CN/LC_MESSAGES/psmisc.mo
26
%%NLS%%share/locale/zh_TW/LC_MESSAGES/psmisc.mo

Return to bug 146709