SHA256
1
0
forked from pool/acct

Accepting request 102598 from Base:System

Condense changes. (forwarded request 102597 from a_jaeger)

OBS-URL: https://build.opensuse.org/request/show/102598
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/acct?expand=0&rev=18
This commit is contained in:
Stephan Kulow 2012-02-07 13:44:39 +00:00 committed by Git OBS Bridge
commit cc4120db1c
14 changed files with 144 additions and 397 deletions

View File

@ -1,60 +0,0 @@
--- Makefile.am
+++ Makefile.am
@@ -11,7 +11,7 @@
## From what sources are those programs built?
ac_SOURCES = ac.c common.c file_rd.c getopt.c getopt1.c hashtab.c \
- @MKTIME_C@ utmp_rd.c
+ mktime.c utmp_rd.c
ac_LDADD = @ALLOCA@
accton_SOURCES = accton.c common.c getopt.c getopt1.c
--- configure.in
+++ configure.in
@@ -6,7 +6,7 @@
AM_INIT_AUTOMAKE(acct, 6.3.5, no-define-symbols)
AM_CONFIG_HEADER(config.h)
-AC_ARG_PROGRAM
+dnl AC_ARG_PROGRAM
AC_PROG_CC
if test "x${ac_cv_prog_gcc}" = "xyes"; then
CFLAGS="${CFLAGS} -Wall -Wmissing-prototypes"
@@ -56,7 +56,7 @@
dnl and whether fields are int/comp_t
dnl
AC_CHECK_HEADER(sys/acct.h,
- AC_DEFINE(HAVE_SYS_ACCT_H)
+ [AC_DEFINE(HAVE_SYS_ACCT_H)
DUMP_ACCT_PROG=dump-acct
ACCTON_PROG=accton
LASTCOMM_PROG=lastcomm
@@ -89,14 +89,14 @@
AC_HEADER_EGREP(comp_t.*ac_mem, sys/acct.h,
AC_DEFINE(ACMEM_COMPT))
)
- AC_HEADER_EGREP(comp_t, sys/acct.h, AC_DEFINE(HAVE_COMP_T))
- ,
+ AC_HEADER_EGREP(comp_t, sys/acct.h, AC_DEFINE(HAVE_COMP_T))]
+ ,[
dnl
dnl here is the "else" clause for the above AC_CHECK_HEADER
dnl (for older versions of linux, which didn't have a sys/acct.h)
dnl
AC_CHECK_HEADER(linux/acct.h,
- AC_DEFINE(HAVE_LINUX_ACCT_H)
+ [AC_DEFINE(HAVE_LINUX_ACCT_H)
DUMP_ACCT_PROG=dump-acct
ACCTON_PROG=accton
LASTCOMM_PROG=lastcomm
@@ -133,8 +133,8 @@
AC_DEFINE(ACMEM_COMPT))
)
AC_HEADER_EGREP(comp_t, linux/acct.h, AC_DEFINE(HAVE_COMP_T))
- , )
-)
+ ])
+])
dnl
dnl find out where utmp/pacct are stored
dnl

View File

@ -1,93 +0,0 @@
--- configure.in
+++ configure.in
@@ -55,46 +55,7 @@
dnl figure out where acct.h lives
dnl and whether fields are int/comp_t
dnl
-AC_CHECK_HEADER(sys/acct.h,
- [AC_DEFINE(HAVE_SYS_ACCT_H)
- DUMP_ACCT_PROG=dump-acct
- ACCTON_PROG=accton
- LASTCOMM_PROG=lastcomm
- SA_PROG=sa
- ACCTON_MAN=accton.8
- LASTCOMM_MAN=lastcomm.1
- SA_MAN=sa.8
- AC_HEADER_EGREP(ac_utime, sys/acct.h,
- AC_DEFINE(HAVE_ACUTIME)
- AC_HEADER_EGREP(comp_t.*ac_utime, sys/acct.h,
- AC_DEFINE(ACUTIME_COMPT))
- )
- AC_HEADER_EGREP(ac_stime, sys/acct.h,
- AC_DEFINE(HAVE_ACSTIME)
- AC_HEADER_EGREP(comp_t.*ac_stime, sys/acct.h,
- AC_DEFINE(ACSTIME_COMPT))
- )
- AC_HEADER_EGREP(ac_etime, sys/acct.h,
- AC_DEFINE(HAVE_ACETIME)
- AC_HEADER_EGREP(comp_t.*ac_etime, sys/acct.h,
- AC_DEFINE(ACETIME_COMPT))
- )
- AC_HEADER_EGREP(ac_io, sys/acct.h,
- AC_DEFINE(HAVE_ACIO)
- AC_HEADER_EGREP(comp_t.*ac_io, sys/acct.h,
- AC_DEFINE(ACIO_COMPT))
- )
- AC_HEADER_EGREP(ac_mem, sys/acct.h,
- AC_DEFINE(HAVE_ACMEM)
- AC_HEADER_EGREP(comp_t.*ac_mem, sys/acct.h,
- AC_DEFINE(ACMEM_COMPT))
- )
- AC_HEADER_EGREP(comp_t, sys/acct.h, AC_DEFINE(HAVE_COMP_T))]
- ,[
- dnl
- dnl here is the "else" clause for the above AC_CHECK_HEADER
- dnl (for older versions of linux, which didn't have a sys/acct.h)
- dnl
+
AC_CHECK_HEADER(linux/acct.h,
[AC_DEFINE(HAVE_LINUX_ACCT_H)
DUMP_ACCT_PROG=dump-acct
@@ -134,7 +95,6 @@
)
AC_HEADER_EGREP(comp_t, linux/acct.h, AC_DEFINE(HAVE_COMP_T))
])
-])
dnl
dnl find out where utmp/pacct are stored
dnl
--- dump-acct.c
+++ dump-acct.c
@@ -14,7 +14,6 @@
#include "pacct_rd.h"
#include "getopt.h"
-
char *program_name;
int debugging_enabled = 0; /* no -- we don't care about bad
records or the file-reading
--- pacct_rd.h
+++ pacct_rd.h
@@ -6,6 +6,10 @@
#include "files.h"
+#ifndef acct
+#define acct acct_v3
+#endif
+
/* This looks strange, but it's real ANSI C. */
extern struct acct pacct_rd_never_used;
--- sa.c
+++ sa.c
@@ -78,6 +78,9 @@
#include "hashtab.h"
#include "version.h"
+#ifndef acct
+#define acct acct_v3
+#endif
/* defines, structures, and the like */

View File

@ -1,45 +0,0 @@
--- accton.c
+++ accton.c
@@ -21,6 +21,7 @@
#include "config.h"
+#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
--- sa.c
+++ sa.c
@@ -1158,27 +1158,17 @@
if (print_users)
{
- printf ("%-8.8s"
+ printf ("%-8.8s", uid_name (rec->ac_uid));
#if defined(HAVE_ACUTIME) && defined(HAVE_ACSTIME)
- " %6.2f cpu"
+ printf (" %6.2f cpu", ut + st);
#endif
#if defined(HAVE_ACMEM)
- " %8.0fk mem"
+ printf (" %8.0fk mem", mu);
#endif
#ifdef HAVE_ACIO
- " %6.0f io"
-#endif
- " %-*.*s%s\n",
- uid_name (rec->ac_uid),
-#if defined(HAVE_ACUTIME) && defined(HAVE_ACSTIME)
- ut + st,
-#endif
-#if defined(HAVE_ACMEM)
- mu,
-#endif
-#ifdef HAVE_ACIO
- di,
+ printf (" %6.0f io", di);
#endif
+ printf (" %-*.*s%s\n",
COMM_LEN, COMM_LEN, rec->ac_comm,
(rec->ac_flag & AFORK) ? "*" : "");
}

View File

@ -1,14 +0,0 @@
--- accounting.texi
+++ accounting.texi
@@ -4,6 +4,11 @@
@include version.texi
+@dircategory Miscellaneous
+@direntry
+* acct: (accounting). User specific process accounting.
+@end direntry
+
@ifinfo
GNU Accounting Utilities
Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.

View File

@ -1,82 +0,0 @@
--- al_share.cpp
+++ al_share.cpp
@@ -114,11 +114,13 @@
{
if (print_file_problems)
{
+ time_t tmp_time;
utmp_print_file_and_line (stddebug);
fprintf (stddebug, ": problem: time warp (%-24.24s",
ctime (&last_time));
- fprintf (stddebug, " -> %-24.24s)\n",
- ctime ((time_t *) &(rec->ut_time)));
+ tmp_time = rec->ut_time;
+ fprintf (stddebug, " -> %-24.24s)\n",
+ ctime (&tmp_time));
}
#ifdef BACKWARDS
--- lastcomm.c
+++ lastcomm.c
@@ -273,6 +273,7 @@
parse_entries (void)
{
struct acct *rec; /* the current record */
+ time_t tmp_time;
/* loop while there are entries to be had */
@@ -349,10 +350,11 @@
#endif
putchar (' ');
+ tmp_time = rec->ac_btime;
printf (" %-8.8s %-8.8s %6.2f secs %-16.16s\n",
this_uid, this_dev,
((ut + st) / (double) ahz),
- ctime (&rec->ac_btime));
+ ctime (&tmp_time));
}
}
}
--- pacct_rd.c
+++ pacct_rd.c
@@ -61,6 +61,7 @@
void
print_pacct_record (struct acct *rec, FILE *out)
{
+ time_t tmp_time;
fprintf (stddebug, "%-*.*s|", COMM_LEN, COMM_LEN, rec->ac_comm);
#define NUM_FORMAT "%6.1f"
@@ -117,7 +118,8 @@
);
#endif
- fprintf (stddebug, "%s", ctime ((time_t *) &(rec->ac_btime)));
+ tmp_time = rec->ac_btime;
+ fprintf (stddebug, "%s", ctime (&tmp_time));
}
--- utmp_rd.c
+++ utmp_rd.c
@@ -67,6 +67,7 @@
void
print_utmp_record (struct utmp *rec, FILE *out)
{
+ time_t tmp_time;
if (rec)
{
fprintf (out, "%-*.*s|%-*.*s|",
@@ -117,8 +118,8 @@
#ifdef HAVE_UT_HOST
fprintf (out, "%-*.*s|", HOST_LEN, HOST_LEN, rec->ut_host);
#endif
-
- fputs (ctime ((time_t *) &(rec->ut_time)), out);
+ tmp_time = rec->ut_time;
+ fputs (ctime (&tmp_time), out);
}
}

View File

@ -1,46 +0,0 @@
--- 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 *));
static struct tm *
-localtime_r (t, tp)
- const time_t *t;
- struct tm *tp;
+localtime_r ( const time_t * t, struct tm * tp)
{
struct tm *l = localtime (t);
if (! l)
@@ -144,9 +142,7 @@
All values are in range, except possibly YEAR.
If overflow occurs, yield the low order bits of the correct answer. */
static time_t
-ydhms_tm_diff (year, yday, hour, min, sec, tp)
- int year, yday, hour, min, sec;
- const struct tm *tp;
+ydhms_tm_diff (int year, int yday, int hour, int min, int sec, const struct tm *tp)
{
/* Compute intervening leap days correctly even if year is negative.
Take care to avoid int overflow. time_t overflow is OK, since
@@ -173,8 +169,7 @@
/* Convert *TP to a time_t value. */
time_t
-mktime (tp)
- struct tm *tp;
+mktime (struct tm *tp)
{
#ifdef _LIBC
/* POSIX.1 8.1.1 requires that whenever mktime() is called, the
@@ -192,10 +187,7 @@
compared to what the result would be for UTC without leap seconds.
If *OFFSET's guess is correct, only one CONVERT call is needed. */
time_t
-__mktime_internal (tp, convert, offset)
- struct tm *tp;
- struct tm *(*convert) __P ((const time_t *, struct tm *));
- time_t *offset;
+__mktime_internal (struct tm *tp, struct tm *(*convert) (const time_t *, struct tm *), time_t *offset)
{
time_t t, dt, t0;
struct tm tm;

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cedd1c130f290574eafb98cd8302aaf0fa6aea44dd1ab64b91bef3d00a614f62
size 125622

3
acct-6.5.5.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4163c87b9e92a73a65eaeadc6c41caa4626da782ff26d6e7a945edcc140a6fd5
size 747225

42
acct-ac.patch Normal file
View File

@ -0,0 +1,42 @@
Subject: configure.ac: Change AC_LANG_SOURCE() into AC_LANG_PROGRAM()
---
configure.ac | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index 743fe29..c150ca3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,7 +162,7 @@ AC_CHECK_HEADER(sys/acct.h,
dnl
dnl find out where utmp/pacct are stored
dnl
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -241,9 +241,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
# endif
# endif
#endif
-
-main ()
-{
+]], [[
FILE *fp;
fp = fopen ("locs", "w");
fprintf (fp, "WTMP_FILE_LOC=%s\n", WTMP_FILE);
@@ -251,8 +249,6 @@ main ()
fprintf (fp, "SAVACCT_FILE_LOC=%s\n", SAVACCT_FILE);
fprintf (fp, "USRACCT_FILE_LOC=%s\n", USRACCT_FILE);
fclose (fp);
- exit(0);
-}
]])],[. ./locs; rm locs],[echo "Error -- could not locate your wtmp and acct files."; exit 1],[echo "Sorry -- you cannot cross-compile this package (FIXME)."; exit 1 ])
AC_TYPE_PID_T dnl for sys/acct.h
AC_TYPE_UID_T dnl same as above
--
1.7.7

21
acct-axp.patch Normal file
View File

@ -0,0 +1,21 @@
Subject: acct-axp.patch
---
accton.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/accton.c b/accton.c
index eeb503d..4c8e2eb 100644
--- a/accton.c
+++ b/accton.c
@@ -21,6 +21,7 @@ MA 02139, USA.
#include "config.h"
+#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
--
1.7.7

View File

@ -1,6 +1,15 @@
--- lastcomm.c
+++ lastcomm.c
@@ -48,6 +48,10 @@
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>
@ -9,9 +18,9 @@
+#endif
+
#include "common.h"
#include "files.h"
#include "uid_hash.h"
#include "dev_hash.h"
@@ -65,7 +69,7 @@
@@ -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 */
@ -20,17 +29,9 @@
char *program_name; /* name of the program, for usage & errs */
@@ -88,7 +92,6 @@
int get_entry PARAMS((struct acct **));
int desired_entry PARAMS((char *, char *, char *));
-
/* code */
void
@@ -288,6 +291,14 @@
print_pacct_record (rec, stddebug);
}
@@ -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
+ {
@ -41,11 +42,13 @@
+ }
+
if (desired_entry (this_uid, this_dev, rec->ac_comm))
{
#ifdef HAVE_COMP_T
--- sa.c
+++ sa.c
@@ -174,7 +174,7 @@
{
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? */
@ -54,15 +57,7 @@
#if defined(HAVE_ACUTIME) && defined(HAVE_ACSTIME)
@@ -262,7 +262,6 @@
int ask_if_junkable PARAMS((char *, int));
-
/* code */
void
@@ -1116,6 +1115,18 @@
@@ -1173,6 +1173,18 @@ void parse_acct_entries (void)
/* loop while there are entries to be had */
while ((rec = pacct_get_entry ()) != NULL)
{
@ -79,5 +74,8 @@
+ }
+ }
#ifdef HAVE_ACUTIME
# ifdef ACUTIME_COMPT
double ut = comp_t_2_double (rec->ac_utime) / (double) ahz;
double ut = comp_t_2_double (rec->ac_utime) / (double) hzval;
#endif
--
1.7.7

25
acct-info.patch Normal file
View File

@ -0,0 +1,25 @@
Subject: Add @dircategory and @direntry
---
accounting.texi | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/accounting.texi b/accounting.texi
index f580f6f..5c8df0d 100644
--- a/accounting.texi
+++ b/accounting.texi
@@ -11,6 +11,11 @@
@include version.texi
+@dircategory Miscellaneous
+@direntry
+* acct: (accounting). User specific process accounting.
+@end direntry
+
@ifinfo
GNU Accounting Utilities
Copyright (C) 1993, 1996, 1997, 1998, 2005, 2008, 2009, 2010
--
1.7.7

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Mon Jan 23 08:43:45 UTC 2012 - bart.vanassche@gmail.com
- switch from acct-6.3.5 to acct-6.5.5. From the upstream acct ChangeLog:
* Fix potential buffer-overflows.
* UNIX 98 pty support.
* Add Linux multiformat support.
* lastcomm.c: integrated patch from Paul Jones which adds
paging and swapping support to lastcomm and sa
-------------------------------------------------------------------
Mon Oct 4 10:37:43 UTC 2011 - uli@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package acct
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -21,19 +21,16 @@ Name: acct
License: GPL-2.0+
Group: System/Base
PreReq: %insserv_prereq %fillup_prereq fileutils %install_info_prereq
Version: 6.3.5
Release: 829
Source: %{name}-%{version}.tar.bz2
Version: 6.5.5
Release: 830
Source: %{name}-%{version}.tar.gz
Source1: rc.acct
Source2: logrotate.acct
BuildRequires: libtool
Patch: %{name}-%{version}-axp.dif
Patch1: %{name}-%{version}-ac.dif
Patch2: %{name}-%{version}-info.diff
Patch3: %{name}-%{version}-acct_v3-fix.diff
Patch4: %{name}-%{version}-time-fix.diff
Patch5: %{name}-%{version}-hz.patch
Patch6: %{name}-%{version}-warning.patch
Patch: %{name}-hz.patch
Patch1: %{name}-axp.patch
Patch2: %{name}-info.patch
Patch3: %{name}-ac.patch
Url: http://www.gnu.org/directory/acct.html
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Summary: User-Specific Process Accounting
@ -44,22 +41,16 @@ accounting: sa, accton, and lastcomm.
%prep
%setup -q
%patch
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
%define prefix /usr
%define sysconfdir /etc
%{suse_update_config}
libtoolize -f
aclocal
automake -a
autoconf
autoreconf -ivf
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" ./configure \
--mandir=%{_mandir} \
--prefix=%{prefix} \