SHA256
1
0
forked from pool/acct
OBS User unknown 2007-02-15 17:09:44 +00:00 committed by Git OBS Bridge
parent f56221b1b0
commit b84edfcf52
4 changed files with 64 additions and 40 deletions

View File

@ -1,14 +1,17 @@
--- lastcomm.c
+++ lastcomm.c
@@ -47,6 +47,7 @@
#endif
@@ -48,6 +48,10 @@
#include <pwd.h>
+#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#include "common.h"
#include "uid_hash.h"
@@ -65,7 +66,7 @@
#include "dev_hash.h"
@@ -65,7 +69,7 @@
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 */
@ -17,25 +20,29 @@
char *program_name; /* name of the program, for usage & errs */
@@ -91,6 +92,10 @@
@@ -88,7 +92,6 @@
int get_entry PARAMS((struct acct **));
int desired_entry PARAMS((char *, char *, char *));
-
/* code */
+#ifndef HZ
+# define AHZ sysconf(_SC_CLK_TCK)
+#endif
+
void
main (int argc, char *argv[])
@@ -288,6 +291,14 @@
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))
{
@@ -98,6 +103,7 @@
int other_pacct_file_specified = 0; /* nonzero if the user used the
`-f' or `--file' flag */
+ ahz = AHZ;
program_name = argv[0];
/* Tell the pacct reader that we want to do things backwards! */
#ifdef HAVE_COMP_T
--- sa.c
+++ sa.c
@@ -174,7 +174,7 @@
@ -47,20 +54,30 @@
#if defined(HAVE_ACUTIME) && defined(HAVE_ACSTIME)
@@ -265,11 +265,16 @@
@@ -262,7 +262,6 @@
int ask_if_junkable PARAMS((char *, int));
-
/* code */
+#ifndef HZ
+# define AHZ sysconf(_SC_CLK_TCK)
+#endif
+
void
main (int argc, char *argv[])
@@ -1116,6 +1115,18 @@
/* loop while there are entries to be had */
while ((rec = pacct_get_entry ()) != NULL)
{
int c;
+ ahz = AHZ;
program_name = argv[0];
/* Cache the page size of the machine for the PAGES_TO_KB macro */
+ 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;

View File

@ -1,5 +1,5 @@
--- mktime.c.save 1997-10-14 01:40:36.000000000 +0100
+++ mktime.c 2006-08-31 09:18:15.000000000 +0100
--- mktime.c
+++ mktime.c
@@ -124,9 +124,7 @@
#define localtime_r my_localtime_r
static struct tm *localtime_r __P ((const time_t *, struct tm *));

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Feb 14 14:46:17 CET 2007 - mkudlvasr@suse.cz
- fixed ahz value problems [#244186]
-------------------------------------------------------------------
Tue Sep 5 15:32:51 CEST 2006 - anosek@suse.cz

View File

@ -1,7 +1,7 @@
#
# spec file for package acct (Version 6.3.5)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
@ -11,12 +11,12 @@
# norootforbuild
Name: acct
License: GPL
License: GNU General Public License (GPL)
Group: System/Base
PreReq: %insserv_prereq %fillup_prereq fileutils %install_info_prereq
Autoreqprov: on
Version: 6.3.5
Release: 696
Release: 718
Source: %{name}-%{version}.tar.bz2
Source1: rc.acct
Source2: logrotate.acct
@ -39,7 +39,7 @@ accounting: sa, accton, and lastcomm.
Authors:
--------
Noel Cragg <noel@gnu.ai.mit.edu>
Noel Cragg <noel@gnu.org>
%prep
%setup -q
@ -113,6 +113,8 @@ rm -rf $RPM_BUILD_ROOT
/usr/sbin/*
%changelog -n acct
* Wed Feb 14 2007 - mkudlvasr@suse.cz
- fixed ahz value problems [#244186]
* Tue Sep 05 2006 - anosek@suse.cz
- fixed compiler warning: old-style function definition
[#203115] (warning.patch)