summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--MDK/Common/System.pm11
-rw-r--r--perl-MDK-Common.spec5
2 files changed, 14 insertions, 2 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;
diff --git a/perl-MDK-Common.spec b/perl-MDK-Common.spec
index 38ddb92..ce0defb 100644
--- a/perl-MDK-Common.spec
+++ b/perl-MDK-Common.spec
@@ -2,7 +2,7 @@
# do not change the version here, change in MDK/Common.pm.pl
%define version THEVERSION
-%define release 5mdk
+%define release 6mdk
Summary: Various simple functions
Name: perl-MDK-Common
@@ -49,6 +49,9 @@ rm -rf $RPM_BUILD_ROOT
# MODIFY IN THE CVS: cvs.mandrakesoft.com:/cooker soft/perl-MDK-Common
%changelog
+* Tue Jul 23 2002 Pixel <pixel@mandrakesoft.com> 1.0.3-6mdk
+- MDK::Common::System: add fuzzy_pidofs
+
* Tue Jul 23 2002 Pixel <pixel@mandrakesoft.com> 1.0.3-5mdk
- perl_checker: catch misuse of =~ when = was meant
- MDK/Common/DataStructure.pm: add deref_array