SHA256
1
0
forked from pool/acct
acct/acct-hz.patch
Cristian Rodríguez 07a4cd0789 Accepting request 101489 from home:bvassche:branches:Base:System
- switch from acct-6.3.5 to acct-6.5.5. From the upstream acct ChangeLog:
	* sa.c - Fix hzval.
	* ac.8 - Rename to sa.1
	* FreeBSD / kFreeBSD >= 7.0-STABLE patch.
	* Fix potential buffer-overflows.
	* UNIX 98 pty support.
	* sa.c - correct --help.
	* accounting.texi - grammar fix.
	* Fixed includes for BSDen. Removed last K & R remainings.
	  Bump version to 6.5.4.
	* Minor fixes, included getop, mktime, rename & xmalloc
	  from gnulib. Fixed HOST_LEN not defined issue.
	* Major overhaul, releasing GNU Acct 6.5.
	* NEWS: document changes in the upcoming 6.4 release.
	* accounting.texi: clarify sa sum line.
	* accounting.info: regenerated.
	* Makefile.am: reflect earlier ToDo -> TODO change.
	* config.guess: added.
	* config.sub: added.
	* depcomp: added.
	* texinfo.tex: added.
	* INSTALL: regenerated.
	* Makefile.in: regenerated.
	* aclocal.m4: regenerated.
	* ansi2knr.c: regenerated.
	* config.h.in: regenerated.
	* configure: regenerated.
	* install-sh: regenerated.
	* mdate-sh: regenerated.

OBS-URL: https://build.opensuse.org/request/show/101489
OBS-URL: https://build.opensuse.org/package/show/Base:System/acct?expand=0&rev=17
2012-01-25 17:07:04 +00:00

82 lines
2.4 KiB
Diff

Subject: acct-hz.patch
---
lastcomm.c | 14 +++++++++++++-
sa.c | 14 +++++++++++++-
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/lastcomm.c b/lastcomm.c
index 276f9fa..993118d 100644
--- a/lastcomm.c
+++ b/lastcomm.c
@@ -49,6 +49,10 @@ MA 02139, USA. */
#include <pwd.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#include "common.h"
#include "files.h"
#include "uid_hash.h"
@@ -71,7 +75,7 @@ int debugging_enabled = 0; /* Nonzero means print internal
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 */
@@ -328,6 +332,14 @@ void parse_entries(void)
print_pacct_record (rec, stddebug);
}
+ 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))
{
double ut = ACUTIME_2_DOUBLE (rec->ac_utime);
diff --git a/sa.c b/sa.c
index 55b1a23..8891a50 100644
--- a/sa.c
+++ b/sa.c
@@ -189,7 +189,7 @@ int dont_read_summary_files = 0;
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)
@@ -1173,6 +1173,18 @@ void parse_acct_entries (void)
/* 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
double ut = comp_t_2_double (rec->ac_utime) / (double) hzval;
#endif
--
1.7.7