summaryrefslogtreecommitdiffstats
path: root/MDK
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-07-23 15:20:09 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-07-23 15:20:09 +0000
commitfcac348ec6d89f560a0f21612a071b27929a370c (patch)
tree16837afb8cd7a1a98e92d703a13f66480fd76cec /MDK
parent2878efe1d9cee58887489257b8a677ac29879931 (diff)
downloadperl-MDK-Common-fcac348ec6d89f560a0f21612a071b27929a370c.tar
perl-MDK-Common-fcac348ec6d89f560a0f21612a071b27929a370c.tar.gz
perl-MDK-Common-fcac348ec6d89f560a0f21612a071b27929a370c.tar.bz2
perl-MDK-Common-fcac348ec6d89f560a0f21612a071b27929a370c.tar.xz
perl-MDK-Common-fcac348ec6d89f560a0f21612a071b27929a370c.zip
MDK::Common::System: add fuzzy_pidofs
Diffstat (limited to 'MDK')
-rw-r--r--MDK/Common/System.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/MDK/Common/System.pm b/MDK/Common/System.pm
index b01a523..6fca4d6 100644
--- a/MDK/Common/System.pm
+++ b/MDK/Common/System.pm
@@ -121,6 +121,10 @@ If the category doesn't exist, it creates it. eg:
update_gnomekderc("/etc/skels/.kderc", 'KDE',
kfmIconStyle => "Large")
+=item fuzzy_pidofs(REGEXP)
+
+return the list of process ids matching the regexp
+
=back
=head1 OTHER
@@ -158,7 +162,7 @@ use MDK::Common::File;
use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK %compat_arch $printable_chars $sizeof_int $bitof_int); #);
@ISA = qw(Exporter);
-@EXPORT_OK = qw(%compat_arch $printable_chars $sizeof_int $bitof_int arch typeFromMagic list_passwd list_home list_skels syscall_ psizeof availableMemory availableRamMB gettimeofday unix2dos getVarsFromSh setVarsInSh setVarsInShMode setVarsInCsh template2file template2userfile update_gnomekderc); #);
+@EXPORT_OK = qw(%compat_arch $printable_chars $sizeof_int $bitof_int arch typeFromMagic list_passwd list_home list_skels syscall_ psizeof availableMemory availableRamMB gettimeofday unix2dos getVarsFromSh setVarsInSh setVarsInShMode setVarsInCsh template2file template2userfile update_gnomekderc fuzzy_pidofs); #);
%EXPORT_TAGS = (all => [ @EXPORT_OK ]);
@@ -353,4 +357,9 @@ sub update_gnomekderc {
}
+sub fuzzy_pidofs {
+ my ($regexp) = @_;
+ grep { /^(\d+)$/ && MDK::Common::File::cat_("/proc/$_/cmdline") =~ /$regexp/ } MDK::Common::File::all('/proc');
+}
+
1;