auto-import changelog data from psacct-6.3.2-31.src.rpm

Wed Sep 01 2004 root <ccb@redhat.com> - 6.3.2-31
- integrate JFenlason's hz patch, improve pts device reporting
This commit is contained in:
cvsdist 2004-09-09 10:50:13 +00:00
parent 305ee0359e
commit f55e500b0c
3 changed files with 236 additions and 3 deletions

150
acct-6.3.2-pts.patch Normal file
View File

@ -0,0 +1,150 @@
--- acct-6.3.2/dev_hash.c.pts Thu Apr 18 19:18:15 1996
+++ acct-6.3.2/dev_hash.c Tue Aug 31 17:20:56 2004
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/utsname.h>
#include <pwd.h>
#include "common.h"
@@ -52,6 +53,11 @@
# endif
#endif
+#ifdef __linux__
+#define NULLDEV 0
+#else
+#define NULLDEV -1
+#endif
/* globals */
@@ -62,6 +68,55 @@
};
+/* hash all possible /dev/pts devices as they only appear
+ * in the filesystem when the device is active.
+ */
+
+static void
+setup_pts_devices () {
+
+ struct utsname uts;
+ struct dev_data dd;
+ int i;
+ struct pts_params {
+ char *utsname; /* os name */
+ int base; /* base major number */
+ int max; /* max # of devices */
+ int mod; /* number of minors per major */
+ } *pts_ent, pts_table[] = {
+ {"Linux", 136, 2048, 256},
+ { }
+ };
+
+ if( uname (&uts) ) {
+ /* silent error */
+ return;
+ }
+
+ for (pts_ent = &(pts_table[0]); pts_ent != NULL; ++pts_ent) {
+ if (!strcmp (uts.sysname, pts_ent->utsname))
+ break;
+ }
+ if (pts_ent == NULL) return; /* unsupported OS */
+
+ for (i = 0; i < pts_ent->max; ++i) {
+ long dev_num;
+ struct hashtab_elem *he;
+ int major, minor;
+
+ major = pts_ent->base + (i/pts_ent->mod);
+ minor = i % pts_ent->mod;
+ dev_num = ((major << 8) + minor);
+
+ dd.name = xmalloc (sizeof(char) * (strlen("pts/xxxx") + 1));
+ sprintf (dd.name, "pts/%d", i);
+
+ he = hashtab_create (dev_table, (void *) & dev_num, sizeof(dev_num));
+ hashtab_set_value (he, &dd, sizeof (dd));
+ }
+}
+
+
/* Read the DIRNAME directory entries and make a linked list of ttys
(so we can search through it later) */
@@ -79,7 +134,14 @@
if ((dirp = opendir (dirname)) == NULL)
return; /* skip it silently */
-
+
+ if (!strcmp (dirname, "/dev/pts")) {
+ /* assuming SysV, these are dynamically allocated */
+ closedir (dirp);
+ setup_pts_devices ();
+ return;
+ }
+
for (dp = readdir (dirp); dp != NULL; dp = readdir (dirp))
{
char *fullname = (char *) alloca ((strlen (dirname)
@@ -105,7 +167,7 @@
dev_num = sp.st_rdev;
dd.name = (char *) xmalloc (sizeof (char) * (NAMLEN (dp) + 1));
strcpy (dd.name, dp->d_name);
-
+
he = hashtab_create (dev_table, (void *) &dev_num, sizeof (dev_num));
hashtab_set_value (he, &dd, sizeof (dd));
}
@@ -114,6 +176,8 @@
}
+
+
/* Return the name of the device associated with DEV_NUM. The
argument passed was originally a dev_t, but that data type is too
limited on some systems (won't let us pass -1 because it's an
@@ -123,10 +187,11 @@
devname (long dev_num)
{
struct hashtab_elem *he;
+ static char devstr [20];
/* special case */
- if (dev_num == -1)
+ if (dev_num == NULLDEV)
return "__";
if (dev_table == NULL)
@@ -135,6 +200,7 @@
setup_devices ("/dev"); /* most certainly */
setup_devices ("/dev/pty"); /* perhaps */
setup_devices ("/dev/ptym"); /* perhaps */
+ setup_devices ("/dev/pts"); /* perhaps */
}
he = hashtab_find (dev_table, (void *) &dev_num, sizeof (dev_num));
@@ -144,9 +210,12 @@
struct dev_data *dd = hashtab_get_value (he);
return dd->name;
}
-
- /* didn't find it */
-
- return "??";
+
+ /* didn't find it, return it as [maj,min] */
+
+ sprintf (devstr, "[%d,%d]", /* is this portable? */
+ (int) ((dev_num & 0xFF00) >> 8), (int) (dev_num & 0x00FF));
+
+ return devstr;
}

79
psacct-6.3.2-hz.patch Normal file
View File

@ -0,0 +1,79 @@
--- acct-6.3.2/sa.c 1998-03-10 17:54:28.000000000 +0000
+++ acct-6.3.2.1/sa.c 2004-03-08 22:05:57.000000000 +0000
@@ -233,7 +233,7 @@
"***other" category */
int always_yes = 0; /* nonzero means always answer yes to
a query */
-
+static unsigned int hzval;
/* prototypes */
@@ -266,6 +266,7 @@
{
int c;
+ hzval = sysconf(_SC_CLK_TCK);
program_name = argv[0];
/* Cache the page size of the machine for the PAGES_TO_KB macro */
@@ -551,7 +552,7 @@
if (debugging_enabled)
{
- fprintf (stddebug, "AHZ -> %d\n", AHZ);
+ fprintf (stddebug, "hzval -> %d\n", hzval);
fprintf (stddebug, "getpagesize() -> %d\n", getpagesize ());
fprintf (stddebug, "system_page_size == %.2f\n", system_page_size);
}
@@ -901,7 +902,7 @@
/* Christoph Badura <bad@flatlin.ka.sub.org> says:
*
* The k*sec statistic is computed as
- * ((ac_utime+ac_stime)*pages_to_kbytes(ac_mem))/AHZ. Of course you
+ * ((ac_utime+ac_stime)*pages_to_kbytes(ac_mem))/hzval. Of course you
* need to expand the comp_t values.
*
* PAGES_TO_KBYTES(x) simply divides x by (getpagesize()/1024). Of
@@ -1103,33 +1104,33 @@
{
#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;
# else
- double ut = (double) rec->ac_utime / (double) AHZ;
+ double ut = (double) rec->ac_utime / (double) hzval;
# endif
#endif
#ifdef HAVE_ACSTIME
# ifdef ACSTIME_COMPT
- double st = comp_t_2_double (rec->ac_stime) / (double) AHZ;
+ double st = comp_t_2_double (rec->ac_stime) / (double) hzval;
# else
- double st = (double) rec->ac_stime / (double) AHZ;
+ double st = (double) rec->ac_stime / (double) hzval;
# endif
#endif
#ifdef HAVE_ACETIME
# ifdef ACETIME_COMPT
- double et = comp_t_2_double (rec->ac_etime) / (double) AHZ;
+ double et = comp_t_2_double (rec->ac_etime) / (double) hzval;
# else
- double et = (double) rec->ac_etime / (double) AHZ;
+ double et = (double) rec->ac_etime / (double) hzval;
# endif
#endif
#ifdef HAVE_ACIO
# ifdef ACIO_COMPT
- double di = comp_t_2_double (rec->ac_io) / (double) AHZ;
+ double di = comp_t_2_double (rec->ac_io) / (double) hzval;
# else
- double di = (double) rec->ac_io / (double) AHZ;
+ double di = (double) rec->ac_io / (double) hzval;
# endif
#endif

View File

@ -12,7 +12,7 @@
Summary: Utilities for monitoring process activities.
Name: psacct
Version: 6.3.2
Release: 30
Release: 31
License: GPL
Group: Applications/System
Source: ftp://ftp.gnu.org/pub/gnu/acct-6.3.2.tar.gz
@ -23,6 +23,8 @@ Patch0: acct-6.3.2-config.patch
Patch1: acct-6.3.2-exit.patch
# Fixes some broken calls to ctime() on 64bit arch's <mharris@redhat.com>
Patch2: psacct-6.3.2-64bit-fixes.patch
Patch3: psacct-6.3.2-hz.patch
Patch4: acct-6.3.2-pts.patch
Buildroot: %{_tmppath}/%{name}-%{version}-root
Prereq: /sbin/install-info
@ -49,6 +51,8 @@ commmands.
%endif
%patch1 -p1 -b .psacct-exit
%patch2 -p0 -b .64bit-fixes
%patch3 -p1 -b .hz
%patch4 -p1 -b .pts
%build
%if ! %{FHS_compliant}
@ -150,8 +154,8 @@ fi
%{_infodir}/accounting.info.gz
%changelog
* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Wed Sep 1 2004 root <ccb@redhat.com> - 6.3.2-31
- integrate JFenlason's hz patch, improve pts device reporting
* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt