summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorRoman Bogorodskiy <novel@FreeBSD.org>2005-05-02 07:48:41 +0000
committerRoman Bogorodskiy <novel@FreeBSD.org>2005-05-02 07:48:41 +0000
commit9920501c2a2c7f094c85a358e30400ff3e177731 (patch)
treeecd96c3fc4f1df5b33186bf1ddbd560a76936563 /sysutils
parent- Fix fetching (diff)
Add pidof - a tool which prints PID of given process name.
Notes
Notes: svn path=/head/; revision=134486
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/pidof/Makefile25
-rw-r--r--sysutils/pidof/distinfo2
-rw-r--r--sysutils/pidof/files/patch-pidof.c22
-rw-r--r--sysutils/pidof/pkg-descr3
5 files changed, 53 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index 7ca511c001a0..60fedc0825c2 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -357,6 +357,7 @@
SUBDIR += php4-posix
SUBDIR += php5-posix
SUBDIR += pib
+ SUBDIR += pidof
SUBDIR += pipemeter
SUBDIR += pkg_cutleaves
SUBDIR += pkg_install
diff --git a/sysutils/pidof/Makefile b/sysutils/pidof/Makefile
new file mode 100644
index 000000000000..0f7f8ef49140
--- /dev/null
+++ b/sysutils/pidof/Makefile
@@ -0,0 +1,25 @@
+# New ports collection makefile for: pidof
+# Date created: 2005-05-01
+# Whom: Roman Bogorodskiy <novel@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= pidof
+PORTVERSION= 20050501
+CATEGORIES= sysutils
+MASTER_SITES= ${MASTER_SITE_LOCAL}
+MASTER_SITE_SUBDIR= novel
+DISTNAME= ${PORTNAME}
+
+MAINTAINER= novel@FreeBSD.org
+COMMENT= A tool which prints PID of given process name
+
+CONFLICTS= psmisc-1*
+
+PLIST_FILES= bin/pidof
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/pidof ${PREFIX}/bin
+
+.include <bsd.port.mk>
diff --git a/sysutils/pidof/distinfo b/sysutils/pidof/distinfo
new file mode 100644
index 000000000000..fbf5daa08f8c
--- /dev/null
+++ b/sysutils/pidof/distinfo
@@ -0,0 +1,2 @@
+MD5 (pidof.tar.gz) = 58bcaf9a6e325ef6e5fd175175788e56
+SIZE (pidof.tar.gz) = 1769
diff --git a/sysutils/pidof/files/patch-pidof.c b/sysutils/pidof/files/patch-pidof.c
new file mode 100644
index 000000000000..7cc71b28d638
--- /dev/null
+++ b/sysutils/pidof/files/patch-pidof.c
@@ -0,0 +1,22 @@
+--- pidof.c.orig Mon May 2 07:26:03 2005
++++ pidof.c Mon May 2 07:40:31 2005
+@@ -53,10 +53,19 @@
+ if ((kd = kvm_open("/dev/null", "/dev/null", "/dev/null", O_RDONLY, "kvm_open")) == NULL)
+ (void)errx(1, "%s", kvm_geterr(kd));
+ else {
++#if __FreeBSD__ < 5
++ p = kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes);
++#else
+ p = kvm_getprocs(kd, KERN_PROC_PROC, 0, &n_processes);
++#endif /* __FreeBSD__ < 5 */
+ for (i = 0; i<n_processes; i++)
++#if __FreeBSD__ < 5
++ if (strncmp(process_name, p[i].kp_proc.p_comm, MAXCOMLEN+1) == 0) {
++ (void)printf("%d ", (int)p[i].kp_proc.p_pid);
++#else
+ if (strncmp(process_name, p[i].ki_comm, COMMLEN+1) == 0) {
+ (void)printf("%d ", (int)p[i].ki_pid);
++#endif /* __FreeBSD__ < 5 */
+ processes_found++;
+ }
+
diff --git a/sysutils/pidof/pkg-descr b/sysutils/pidof/pkg-descr
new file mode 100644
index 000000000000..74f2f5ca311d
--- /dev/null
+++ b/sysutils/pidof/pkg-descr
@@ -0,0 +1,3 @@
+A tool which prints PID of given process name.
+
+WWW: http://people.freebsd.org/~novel/pidof.html