|
|
0a209a |
diff -up ./lastcomm.1.ori ./lastcomm.1
|
|
|
0a209a |
--- ./lastcomm.1.ori 2017-02-13 10:18:15.394190398 +0100
|
|
|
0a209a |
+++ ./lastcomm.1 2017-02-13 11:37:28.993835576 +0100
|
|
|
0a209a |
@@ -122,7 +122,10 @@ format as your current machine, but has
|
|
|
0a209a |
.B AHZ.
|
|
|
0a209a |
.TP
|
|
|
0a209a |
.B \-p, \-\-show\-paging
|
|
|
0a209a |
-Print paging statistics
|
|
|
0a209a |
+Print paging statistics.
|
|
|
0a209a |
+.TP
|
|
|
0a209a |
+.B \-\-pid
|
|
|
0a209a |
+Show PID and PPID of the process if acct version 3 format is supported by kernel.
|
|
|
0a209a |
.TP
|
|
|
0a209a |
.B \-\-debug
|
|
|
0a209a |
Print verbose internal information.
|
|
|
0a209a |
diff -up ./lastcomm.c.ori ./lastcomm.c
|
|
|
0a209a |
--- ./lastcomm.c.ori 2017-02-08 17:06:24.909802191 +0100
|
|
|
0a209a |
+++ ./lastcomm.c 2017-02-13 10:51:28.019625702 +0100
|
|
|
0a209a |
@@ -77,6 +77,8 @@ char *program_name; /* name of the prog
|
|
|
0a209a |
|
|
|
0a209a |
int show_paging = 0; /* If they want paging stats, print 'em */
|
|
|
0a209a |
|
|
|
0a209a |
+char show_pid = 0;
|
|
|
0a209a |
+
|
|
|
0a209a |
static unsigned int hzval;
|
|
|
0a209a |
|
|
|
0a209a |
/* Here are various lists for the user to specify entries that they
|
|
|
0a209a |
@@ -125,6 +127,9 @@ int main(int argc, char *argv[])
|
|
|
0a209a |
{ "show-paging", no_argument, NULL, 11 },
|
|
|
0a209a |
#endif
|
|
|
0a209a |
{ "forwards", no_argument, NULL, 12 },
|
|
|
0a209a |
+#ifdef LINUX_MULTIFORMAT
|
|
|
0a209a |
+ { "pid", no_argument, NULL, 13},
|
|
|
0a209a |
+#endif
|
|
|
0a209a |
{ 0, 0, 0, 0 }
|
|
|
0a209a |
};
|
|
|
0a209a |
|
|
|
0a209a |
@@ -209,6 +214,9 @@ int main(int argc, char *argv[])
|
|
|
0a209a |
}
|
|
|
0a209a |
backwards = 0;
|
|
|
0a209a |
break;
|
|
|
0a209a |
+ case 13:
|
|
|
0a209a |
+ show_pid = 1;
|
|
|
0a209a |
+ break;
|
|
|
0a209a |
case 'h':
|
|
|
0a209a |
case 3:
|
|
|
0a209a |
/* This should fall through to default! */
|
|
|
0a209a |
@@ -304,6 +312,7 @@ void give_usage(void)
|
|
|
0a209a |
#ifdef HAVE_PAGING
|
|
|
0a209a |
"[--show-paging] "
|
|
|
0a209a |
#endif
|
|
|
0a209a |
+ "[--pid] "
|
|
|
0a209a |
"[--ahz <freq>] [--version] [--help]\n", program_name);
|
|
|
0a209a |
print_acct_file_location ();
|
|
|
0a209a |
}
|
|
|
0a209a |
@@ -392,8 +401,8 @@ void parse_entries(void)
|
|
|
0a209a |
(void)putchar(' ');
|
|
|
0a209a |
|
|
|
0a209a |
btime = (time_t) rec->ac_btime;
|
|
|
0a209a |
- if ( show_paging == 0 )
|
|
|
0a209a |
- (void)printf(" %-8.8s %-8.8s %6.2f secs %-16.16s\n",
|
|
|
0a209a |
+ if ( show_paging == 0)
|
|
|
0a209a |
+ (void)printf(" %-8.8s %-8.8s %6.2f secs %-16.16s",
|
|
|
0a209a |
this_uid, this_dev,
|
|
|
0a209a |
#ifdef LINUX_MULTIFORMAT
|
|
|
0a209a |
((ut + st) / (double) rec->ac_ahz),
|
|
|
0a209a |
@@ -403,7 +412,7 @@ void parse_entries(void)
|
|
|
0a209a |
ctime (&btime));
|
|
|
0a209a |
else
|
|
|
0a209a |
#ifdef HAVE_PAGING
|
|
|
0a209a |
- (void)printf(" %6.0fmin %6.0fmaj %4.0fswp %6.2f secs %-16.16s\n",
|
|
|
0a209a |
+ (void)printf(" %6.0fmin %6.0fmaj %4.0fswp %6.2f secs %-16.16s",
|
|
|
0a209a |
minf, majf, swap,
|
|
|
0a209a |
#ifdef LINUX_MULTIFORMAT
|
|
|
0a209a |
((ut + st) / (double) rec->ac_ahz),
|
|
|
0a209a |
@@ -412,8 +421,24 @@ void parse_entries(void)
|
|
|
0a209a |
#endif
|
|
|
0a209a |
ctime (&btime));
|
|
|
0a209a |
#else
|
|
|
0a209a |
- (void)printf(" --- No paging statistics! --- \n" );
|
|
|
0a209a |
+ (void)printf(" --- No paging statistics! --- " );
|
|
|
0a209a |
#endif
|
|
|
0a209a |
+
|
|
|
0a209a |
+
|
|
|
0a209a |
+ if (show_pid)
|
|
|
0a209a |
+ {
|
|
|
0a209a |
+#ifdef LINUX_MULTIFORMAT
|
|
|
0a209a |
+ if ((rec->ac_version & 0x7f) == 3)
|
|
|
0a209a |
+ {
|
|
|
0a209a |
+ (void) printf(" %d %d", rec->ac_pid, rec->ac_ppid);
|
|
|
0a209a |
+ }
|
|
|
0a209a |
+#else
|
|
|
0a209a |
+ (void)printf(" --- No PID information available! --- " );
|
|
|
0a209a |
+#endif
|
|
|
0a209a |
+ }
|
|
|
0a209a |
+
|
|
|
0a209a |
+
|
|
|
0a209a |
+ (void) printf("\n");
|
|
|
0a209a |
}
|
|
|
0a209a |
}
|
|
|
0a209a |
}
|