From 837f0e1a7b275d04812d6462daaa2908d39af1c1 Mon Sep 17 00:00:00 2001 From: "Zane C. Bowers-Hadley" Date: Sat, 24 Aug 2019 10:24:26 -0500 Subject: [PATCH] add --self flag --- Proc-ProcessTable-ncps/bin/ncps | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Proc-ProcessTable-ncps/bin/ncps b/Proc-ProcessTable-ncps/bin/ncps index bd0fb74..c66dd2e 100755 --- a/Proc-ProcessTable-ncps/bin/ncps +++ b/Proc-ProcessTable-ncps/bin/ncps @@ -52,6 +52,8 @@ sub help{ -s Show swapped out procs. --si Invert the swapped out search. +--self Show the the ncps process as well. + --st A comma seperated list of states to search for. --sti Invert the state search. @@ -109,6 +111,7 @@ my $euid=0; my $euid_invert=0; my $egid=0; my $egid_invert=0; +my $self_proc=0; # get the commandline options Getopt::Long::Configure ('no_ignore_case'); @@ -153,6 +156,7 @@ GetOptions( 'eui' => \$euid_invert, 'eg' => \$egid, 'egi' => \$egid_invert, + 'self' => \$self_proc, ); # print the version info if requested @@ -352,6 +356,9 @@ if ( defined( $ENV{NCPS_majflt} ) ){ if ( defined( $ENV{NCPS_tty} ) ){ $tty = $tty ^ 1; } +if ( defined( $ENV{NCPS_self} ) ){ + $self_proc = $self_proc ^ 1; +} #if ( defined( $ENV{NCPS_inverted} ) ){ # no invert support really yet #} @@ -365,6 +372,19 @@ if ( $no_color ){ $ENV{ANSI_COLORS_DISABLED}=1; } +# +# handles the self proc flag +# +if ( ! $self_proc ){ + push( @filters, { + type=>'PID', + invert=>1, + args=>{ + pids=>[$$], + }, + }); +} + # # handles the time search #