Package: sysvinit-utils
Version: 2.87dsf-8.1
File: /sbin/killall5
Severity: wishlist
Tags: patch
More often than not I'm using pidof to get a list of PIDs for use
with strace. Sadly I always had to re-format the output, so that it
includes the "-p" part needed by strace.
Here's a patch to allow arbitrary output formats in pidof;
documentation included, but please check my english.
Please apply in the next version; thank you very much.
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_AT.UTF-8, LC_CTYPE=de_AT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages sysvinit-utils depends on:
ii libc6 2.10.2-6 Embedded GNU C Library: Shared lib
ii libselinux1 2.0.89-4 SELinux runtime shared libraries
sysvinit-utils recommends no packages.
Versions of packages sysvinit-utils suggests:
pn sash <none> (no description available)
-- no debconf information
diff -u -r sysvinit-2.87dsf-orig/src/killall5.c sysvinit-2.87dsf/src/killall5.c
--- sysvinit-2.87dsf-orig/src/killall5.c 2009-07-12 16:59:06.000000000 +0200
+++ sysvinit-2.87dsf/src/killall5.c 2010-02-26 09:53:29.049994659 +0100
@@ -514,12 +514,13 @@
int chroot_check = 0;
struct stat st;
char tmp[512];
+ char *format=NULL;
for (oind = PIDOF_OMITSZ-1; oind > 0; oind--)
opid[oind] = 0;
opterr = 0;
- while ((opt = getopt(argc,argv,"hco:sx")) != EOF) switch (opt) {
+ while ((opt = getopt(argc,argv,"hco:sxf:")) != EOF) switch (opt) {
case '?':
nsyslog(LOG_ERR,"invalid options on command line!\n");
closelog();
@@ -527,6 +528,9 @@
case 'c':
if (geteuid() == 0) chroot_check = 1;
break;
+ case 'f':
+ format=optarg;
+ break;
case 'o':
if (oind >= PIDOF_OMITSZ -1) {
nsyslog(LOG_ERR,"omit pid buffer size %d "
@@ -602,9 +606,14 @@
continue;
}
}
- if (!first)
- printf(" ");
- printf("%d", p->pid);
+ if (format)
+ printf(format, p->pid);
+ else
+ {
+ if (!first)
+ printf(" ");
+ printf("%d", p->pid);
+ }
first = 0;
}
}
diff -u -r sysvinit-2.87dsf-orig/man/pidof.8 sysvinit-2.87dsf/man/pidof.8
--- sysvinit-2.87dsf-orig/man/pidof.8 2010-02-26 09:53:32.253991975 +0100
+++ sysvinit-2.87dsf/man/pidof.8 2010-02-26 09:57:07.102003998 +0100
@@ -10,6 +10,8 @@
.IR omitpid ]
.RB [ \-o
.IR omitpid.. ]
+.RB [ \-f
+.IR format ]
.B program
.RB [ program.. ]
.SH DESCRIPTION
@@ -36,6 +38,9 @@
Tells \fIpidof\fP to omit processes with that process id. The special
pid \fB%PPID\fP can be used to name the parent process of the \fIpidof\fP
program, in other words the calling shell or shell script.
+.IP "-f \fIformat\fP"
+Tells \fIpidof\fP to format the process ids in the given \fIprintf\fP style.
+For example \fB" -p%d"\fP is useful for \fIstrace\fP.
.SH "EXIT STATUS"
.TP
.B 0
_______________________________________________
Pkg-sysvinit-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-sysvinit-devel