2007-01-15 23:50:49 +01:00
|
|
|
|
--- lastcomm.c
|
|
|
|
|
+++ lastcomm.c
|
2007-02-15 18:09:44 +01:00
|
|
|
|
@@ -48,6 +48,10 @@
|
2007-01-15 23:50:49 +01:00
|
|
|
|
|
|
|
|
|
#include <pwd.h>
|
|
|
|
|
|
2007-02-15 18:09:44 +01:00
|
|
|
|
+#ifdef HAVE_UNISTD_H
|
|
|
|
|
+#include <unistd.h>
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
2007-01-15 23:50:49 +01:00
|
|
|
|
#include "common.h"
|
|
|
|
|
#include "uid_hash.h"
|
2007-02-15 18:09:44 +01:00
|
|
|
|
#include "dev_hash.h"
|
|
|
|
|
@@ -65,7 +69,7 @@
|
2007-01-15 23:50:49 +01:00
|
|
|
|
int strict_match_flag = 0; /* Nonzero if each record has to match
|
|
|
|
|
all items on the command line */
|
|
|
|
|
int print_controls = 0; /* don't print control characters */
|
|
|
|
|
-int ahz = AHZ; /* for viewing logs from another system */
|
|
|
|
|
+int ahz = 0; /* for viewing logs from another system */
|
|
|
|
|
|
|
|
|
|
char *program_name; /* name of the program, for usage & errs */
|
|
|
|
|
|
2007-02-15 18:09:44 +01:00
|
|
|
|
@@ -88,7 +92,6 @@
|
|
|
|
|
int get_entry PARAMS((struct acct **));
|
|
|
|
|
int desired_entry PARAMS((char *, char *, char *));
|
|
|
|
|
|
|
|
|
|
-
|
2007-01-15 23:50:49 +01:00
|
|
|
|
/* code */
|
|
|
|
|
|
|
|
|
|
void
|
2007-02-15 18:09:44 +01:00
|
|
|
|
@@ -288,6 +291,14 @@
|
|
|
|
|
print_pacct_record (rec, stddebug);
|
|
|
|
|
}
|
2007-01-15 23:50:49 +01:00
|
|
|
|
|
2007-02-15 18:09:44 +01:00
|
|
|
|
+ if (!ahz) // if this is the first cycle run, ahz is not set yet
|
|
|
|
|
+ {
|
|
|
|
|
+ if (rec->ac_version == 3)
|
|
|
|
|
+ ahz = 100; // value AHZ = 100 is hardcoded in acct.h, but in #ifdef __KERNEL__ block. too bad
|
|
|
|
|
+ else
|
|
|
|
|
+ ahz = sysconf(_SC_CLK_TCK);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
if (desired_entry (this_uid, this_dev, rec->ac_comm))
|
|
|
|
|
{
|
|
|
|
|
#ifdef HAVE_COMP_T
|
2007-01-15 23:50:49 +01:00
|
|
|
|
--- sa.c
|
|
|
|
|
+++ sa.c
|
|
|
|
|
@@ -174,7 +174,7 @@
|
|
|
|
|
int print_users = 0;
|
|
|
|
|
int percentages = 0; /* include percentages in printout */
|
|
|
|
|
int user_summary_flag = 0; /* are we printing a user summary? */
|
|
|
|
|
-int ahz = AHZ; /* for viewing logs from another system */
|
|
|
|
|
+int ahz = 0; /* for viewing logs from another system */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(HAVE_ACUTIME) && defined(HAVE_ACSTIME)
|
2007-02-15 18:09:44 +01:00
|
|
|
|
@@ -262,7 +262,6 @@
|
|
|
|
|
int ask_if_junkable PARAMS((char *, int));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
2007-01-15 23:50:49 +01:00
|
|
|
|
/* code */
|
|
|
|
|
|
|
|
|
|
void
|
2007-02-15 18:09:44 +01:00
|
|
|
|
@@ -1116,6 +1115,18 @@
|
|
|
|
|
/* loop while there are entries to be had */
|
|
|
|
|
while ((rec = pacct_get_entry ()) != NULL)
|
|
|
|
|
{
|
|
|
|
|
+ if (!ahz) // if this is the first cycle run, ahz is not set yet
|
|
|
|
|
+ {
|
|
|
|
|
+ if (rec->ac_version == 3)
|
|
|
|
|
+ ahz = 100; // value AHZ = 100 is hardcoded in acct.h, but in #ifdef __KERNEL__ block. too bad
|
|
|
|
|
+ else
|
|
|
|
|
+ ahz = sysconf(_SC_CLK_TCK);
|
|
|
|
|
+
|
|
|
|
|
+ if (debugging_enabled)
|
|
|
|
|
+ {
|
|
|
|
|
+ fprintf (stddebug, "AHZ -> %d\n", ahz);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
#ifdef HAVE_ACUTIME
|
|
|
|
|
# ifdef ACUTIME_COMPT
|
|
|
|
|
double ut = comp_t_2_double (rec->ac_utime) / (double) ahz;
|