2012-01-25 18:07:04 +01:00
|
|
|
Subject: acct-hz.patch
|
|
|
|
|
|
|
|
---
|
|
|
|
lastcomm.c | 14 +++++++++++++-
|
|
|
|
sa.c | 14 +++++++++++++-
|
|
|
|
2 files changed, 26 insertions(+), 2 deletions(-)
|
|
|
|
|
2017-04-06 15:31:38 +02:00
|
|
|
Index: lastcomm.c
|
2013-12-23 13:06:02 +01:00
|
|
|
===================================================================
|
2017-04-06 15:31:38 +02:00
|
|
|
--- lastcomm.c.orig
|
|
|
|
+++ lastcomm.c
|
|
|
|
@@ -71,7 +71,7 @@ int debugging_enabled = 0; /* Nonzero me
|
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 */
|
|
|
|
|
2017-04-06 15:31:38 +02:00
|
|
|
@@ -328,6 +328,14 @@ void parse_entries(void)
|
2012-01-25 18:07:04 +01:00
|
|
|
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))
|
2012-01-25 18:07:04 +01:00
|
|
|
{
|
|
|
|
double ut = ACUTIME_2_DOUBLE (rec->ac_utime);
|
2017-04-06 15:31:38 +02:00
|
|
|
Index: sa.c
|
2013-12-23 13:06:02 +01:00
|
|
|
===================================================================
|
2017-04-06 15:31:38 +02:00
|
|
|
--- sa.c.orig
|
|
|
|
+++ sa.c
|
|
|
|
@@ -191,7 +191,7 @@ int print_users = 0;
|
2007-01-15 23:50:49 +01:00
|
|
|
int percentages = 0; /* include percentages in printout */
|
|
|
|
int user_summary_flag = 0; /* are we printing a user summary? */
|
2014-12-20 16:56:51 +01:00
|
|
|
int group_summary_flag = 0; /* are we printing a group summary? */
|
2007-01-15 23:50:49 +01:00
|
|
|
-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)
|
2017-04-06 15:31:38 +02:00
|
|
|
@@ -1180,6 +1180,18 @@ void parse_acct_entries (void)
|
2007-02-15 18:09:44 +01:00
|
|
|
/* 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
|
2013-12-23 13:06:02 +01:00
|
|
|
double ut = comp_t_2_double (rec->ac_utime) / CURR_AHZ;
|
2012-01-25 18:07:04 +01:00
|
|
|
#endif
|