lastcomm: added new --pid option to show process PID and PPID
changelog update: 6.6.3-1 author change spec file update: added correct access mode to created /var/account/pacct
This commit is contained in:
parent
9a3b6f60e3
commit
baa0dceeb0
105
psacct-6.6.3-lastcomm-new-pid-option.patch
Normal file
105
psacct-6.6.3-lastcomm-new-pid-option.patch
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
diff -up ./lastcomm.1.ori ./lastcomm.1
|
||||||
|
--- ./lastcomm.1.ori 2017-02-08 23:28:06.000000000 +0100
|
||||||
|
+++ ./lastcomm.1 2017-06-22 16:21:46.249345984 +0200
|
||||||
|
@@ -122,13 +122,10 @@ format as your current machine, but has
|
||||||
|
.B AHZ.
|
||||||
|
.TP
|
||||||
|
.B \-p, \-\-show\-paging
|
||||||
|
-Print paging statistics
|
||||||
|
+Print paging statistics.
|
||||||
|
.TP
|
||||||
|
.B \-\-pid
|
||||||
|
-Add pid of the process and pid of the process parent to the output
|
||||||
|
-(pid is the last but one and parent pid the last column).
|
||||||
|
-These values are shown only when they are generated by acct function
|
||||||
|
-(depends on the version of kernel)
|
||||||
|
+Show PID and PPID of the process if acct version 3 format is supported by kernel.
|
||||||
|
.TP
|
||||||
|
.B \-\-debug
|
||||||
|
Print verbose internal information.
|
||||||
|
diff -up ./lastcomm.c.ori ./lastcomm.c
|
||||||
|
--- ./lastcomm.c.ori 2017-04-05 23:06:33.000000000 +0200
|
||||||
|
+++ ./lastcomm.c 2017-06-22 16:21:14.814430103 +0200
|
||||||
|
@@ -77,6 +77,8 @@ char *program_name; /* name of the prog
|
||||||
|
|
||||||
|
int show_paging = 0; /* If they want paging stats, print 'em */
|
||||||
|
|
||||||
|
+char show_pid = 0;
|
||||||
|
+
|
||||||
|
static unsigned int hzval;
|
||||||
|
|
||||||
|
/* Here are various lists for the user to specify entries that they
|
||||||
|
@@ -125,6 +127,9 @@ int main(int argc, char *argv[])
|
||||||
|
{ "show-paging", no_argument, NULL, 11 },
|
||||||
|
#endif
|
||||||
|
{ "forwards", no_argument, NULL, 12 },
|
||||||
|
+#ifdef LINUX_MULTIFORMAT
|
||||||
|
+ { "pid", no_argument, NULL, 13},
|
||||||
|
+#endif
|
||||||
|
{ 0, 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -209,6 +214,9 @@ int main(int argc, char *argv[])
|
||||||
|
}
|
||||||
|
backwards = 0;
|
||||||
|
break;
|
||||||
|
+ case 13:
|
||||||
|
+ show_pid = 1;
|
||||||
|
+ break;
|
||||||
|
case 'h':
|
||||||
|
case 3:
|
||||||
|
/* This should fall through to default! */
|
||||||
|
@@ -304,6 +312,7 @@ void give_usage(void)
|
||||||
|
#ifdef HAVE_PAGING
|
||||||
|
"[--show-paging] "
|
||||||
|
#endif
|
||||||
|
+ "[--pid] "
|
||||||
|
"[--ahz <freq>] [--version] [--help]\n", program_name);
|
||||||
|
print_acct_file_location ();
|
||||||
|
}
|
||||||
|
@@ -392,8 +401,8 @@ void parse_entries(void)
|
||||||
|
(void)putchar(' ');
|
||||||
|
|
||||||
|
btime = (time_t) rec->ac_btime;
|
||||||
|
- if ( show_paging == 0 )
|
||||||
|
- (void)printf(" %-8.8s %-8.8s %6.2f secs %-16.16s\n",
|
||||||
|
+ if ( show_paging == 0)
|
||||||
|
+ (void)printf(" %-8.8s %-8.8s %6.2f secs %-16.16s",
|
||||||
|
this_uid, this_dev,
|
||||||
|
#ifdef LINUX_MULTIFORMAT
|
||||||
|
((ut + st) / (double) rec->ac_ahz),
|
||||||
|
@@ -403,7 +412,7 @@ void parse_entries(void)
|
||||||
|
ctime (&btime));
|
||||||
|
else
|
||||||
|
#ifdef HAVE_PAGING
|
||||||
|
- (void)printf(" %6.0fmin %6.0fmaj %4.0fswp %6.2f secs %-16.16s\n",
|
||||||
|
+ (void)printf(" %6.0fmin %6.0fmaj %4.0fswp %6.2f secs %-16.16s",
|
||||||
|
minf, majf, swap,
|
||||||
|
#ifdef LINUX_MULTIFORMAT
|
||||||
|
((ut + st) / (double) rec->ac_ahz),
|
||||||
|
@@ -412,8 +421,24 @@ void parse_entries(void)
|
||||||
|
#endif
|
||||||
|
ctime (&btime));
|
||||||
|
#else
|
||||||
|
- (void)printf(" --- No paging statistics! --- \n" );
|
||||||
|
+ (void)printf(" --- No paging statistics! --- " );
|
||||||
|
#endif
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ if (show_pid)
|
||||||
|
+ {
|
||||||
|
+#ifdef LINUX_MULTIFORMAT
|
||||||
|
+ if ((rec->ac_version & 0x7f) == 3)
|
||||||
|
+ {
|
||||||
|
+ (void) printf(" %d %d", rec->ac_pid, rec->ac_ppid);
|
||||||
|
+ }
|
||||||
|
+#else
|
||||||
|
+ (void)printf(" --- No PID information available! --- " );
|
||||||
|
+#endif
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ (void) printf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
psacct.spec
15
psacct.spec
@ -4,7 +4,7 @@
|
|||||||
Summary: Utilities for monitoring process activities
|
Summary: Utilities for monitoring process activities
|
||||||
Name: psacct
|
Name: psacct
|
||||||
Version: 6.6.3
|
Version: 6.6.3
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
URL: http://www.gnu.org/software/acct/
|
URL: http://www.gnu.org/software/acct/
|
||||||
@ -25,6 +25,7 @@ Patch4: psacct-6.6.2-unnumberedsubsubsec.patch
|
|||||||
#Patch6: psacct-6.6.1-man-dump-acct.patch
|
#Patch6: psacct-6.6.1-man-dump-acct.patch
|
||||||
# Preventing SEGVs when an incomplete record appears
|
# Preventing SEGVs when an incomplete record appears
|
||||||
Patch7: psacct-6.6.1-SEGV-when-record-incomplete.patch
|
Patch7: psacct-6.6.1-SEGV-when-record-incomplete.patch
|
||||||
|
Patch8: psacct-6.6.3-lastcomm-new-pid-option.patch
|
||||||
|
|
||||||
Conflicts: filesystem < 3
|
Conflicts: filesystem < 3
|
||||||
Conflicts: systemd < 39-1
|
Conflicts: systemd < 39-1
|
||||||
@ -60,6 +61,7 @@ commands.
|
|||||||
#%%patch5 -p1 -b .rh-man-scan
|
#%%patch5 -p1 -b .rh-man-scan
|
||||||
#%%patch6 -p1 -b .man-dump-acct
|
#%%patch6 -p1 -b .man-dump-acct
|
||||||
%patch7 -p1
|
%patch7 -p1
|
||||||
|
%patch8 -p1
|
||||||
|
|
||||||
# fixing 'gets' undeclared
|
# fixing 'gets' undeclared
|
||||||
sed -i 's|.*(gets,.*||g' lib/stdio.in.h
|
sed -i 's|.*(gets,.*||g' lib/stdio.in.h
|
||||||
@ -87,7 +89,7 @@ cp dump-acct.8 %{buildroot}%{_mandir}/man8/
|
|||||||
rm -f %{buildroot}%{_infodir}/dir
|
rm -f %{buildroot}%{_infodir}/dir
|
||||||
|
|
||||||
mkdir -p %{buildroot}/var/account
|
mkdir -p %{buildroot}/var/account
|
||||||
touch %{buildroot}/var/account/pacct
|
touch %{buildroot}/var/account/pacct && chmod 0600 %{buildroot}/var/account/pacct
|
||||||
|
|
||||||
# create logrotate config file
|
# create logrotate config file
|
||||||
mkdir -p %{buildroot}/etc/logrotate.d
|
mkdir -p %{buildroot}/etc/logrotate.d
|
||||||
@ -110,7 +112,7 @@ rm -f %{buildroot}%{_bindir}/last %{buildroot}%{_mandir}/man1/last.1*
|
|||||||
%systemd_post psacct.service
|
%systemd_post psacct.service
|
||||||
|
|
||||||
/sbin/install-info %{_infodir}/accounting.info %{_infodir}/dir || :
|
/sbin/install-info %{_infodir}/accounting.info %{_infodir}/dir || :
|
||||||
touch /var/account/pacct
|
touch /var/account/pacct && chmod 0600 /var/account/pacct
|
||||||
|
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
@ -165,7 +167,12 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Fri Dec 08 2017 Jan Rybar <jrybar@redhat.com> - 6.6.3-1
|
* Mon Dec 11 2017 Jan Rybar <jrybar@redhat.com> - 6.6.3-2
|
||||||
|
- lastcomm: added new --pid option to show process PID and PPID
|
||||||
|
- changelog update: 6.6.3-1 author change
|
||||||
|
- spec file update: added correct access mode to created /var/account/pacct
|
||||||
|
|
||||||
|
* Mon Dec 11 2017 Jan Rybar <jrybar@redhat.com> - 6.6.3-1
|
||||||
- New upstream release 6.6.3
|
- New upstream release 6.6.3
|
||||||
|
|
||||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 6.6.2-7
|
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 6.6.2-7
|
||||||
|
Loading…
Reference in New Issue
Block a user