summaryrefslogtreecommitdiffstats
path: root/lib/libdevstat
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>1998-09-20 00:11:23 +0000
committerken <ken@FreeBSD.org>1998-09-20 00:11:23 +0000
commit7c2e7bb8801f9ef8e3e4ab93dc153e7901f3338e (patch)
treec143714a5306e798bef167a851c06b083fcf45ad /lib/libdevstat
parent79ff6f224d335b39f52730937b59b8cbc8bf329b (diff)
downloadFreeBSD-src-7c2e7bb8801f9ef8e3e4ab93dc153e7901f3338e.zip
FreeBSD-src-7c2e7bb8801f9ef8e3e4ab93dc153e7901f3338e.tar.gz
Change the devstat generation number from an int to a long. The int-sized
generation was causing unaligned access faults on the Alpha. I have incremented the devstat version number, since this is an interface change. You'll need to recompile libdevstat, systat, iostat, vmstat and rpc.rstatd along with your kernel. Partially Submitted by: Andrew Gallatin <gallatin@cs.duke.edu>
Diffstat (limited to 'lib/libdevstat')
-rw-r--r--lib/libdevstat/devstat.310
-rw-r--r--lib/libdevstat/devstat.c27
-rw-r--r--lib/libdevstat/devstat.h10
3 files changed, 24 insertions, 23 deletions
diff --git a/lib/libdevstat/devstat.3 b/lib/libdevstat/devstat.3
index 189f703..6da22aa 100644
--- a/lib/libdevstat/devstat.3
+++ b/lib/libdevstat/devstat.3
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id$
+.\" $Id: devstat.3,v 1.1 1998/09/15 06:23:21 gibbs Exp $
.\"
.Dd May 21, 1998
.Dt DEVSTAT 3
@@ -37,7 +37,7 @@
.Fd #include <devstat.h>
.Ft int
.Fn getnumdevs "void"
-.Ft int
+.Ft long
.Fn getgeneration "void"
.Ft int
.Fn getversion "void"
@@ -50,8 +50,8 @@
.Fa "struct device_selection **dev_select"
.Fa "int *num_selected"
.Fa "int *num_selections"
-.Fa "int *select_generation"
-.Fa "int current_generation"
+.Fa "long *select_generation"
+.Fa "long current_generation"
.Fa "struct devstat *devices"
.Fa "int numdevs"
.Fa "struct devstat_match *matches"
@@ -146,7 +146,7 @@ subelement contains the following elements:
struct devinfo {
struct devstat *devices;
u_int8_t *mem_ptr;
- int generation;
+ long generation;
int numdevs;
};
.Ed
diff --git a/lib/libdevstat/devstat.c b/lib/libdevstat/devstat.c
index 4c40d85..6211909 100644
--- a/lib/libdevstat/devstat.c
+++ b/lib/libdevstat/devstat.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: devstat.c,v 1.1 1998/09/15 06:23:21 gibbs Exp $
+ * $Id: devstat.c,v 1.2 1998/09/18 02:35:25 ken Exp $
*/
#include <sys/types.h>
@@ -101,14 +101,14 @@ getnumdevs(void)
* the device list and the generation could change between the time that
* this function is called and the device list is retreived.
*/
-int
+long
getgeneration(void)
{
size_t gensize;
- int generation;
+ long generation;
char *func_name = "getgeneration";
- gensize = sizeof(int);
+ gensize = sizeof(long);
/*
* Get the current generation number.
@@ -234,7 +234,8 @@ getdevs(struct statinfo *stats)
{
int error;
size_t dssize;
- int oldnumdevs, oldgeneration;
+ int oldnumdevs;
+ long oldgeneration;
int retval = 0;
struct devinfo *dinfo;
char *func_name = "getdevs";
@@ -266,10 +267,10 @@ getdevs(struct statinfo *stats)
* number, as well as all the devices. So we need four
* bytes more.
*/
- dssize =(dinfo->numdevs * sizeof(struct devstat)) + sizeof(int);
+ dssize =(dinfo->numdevs * sizeof(struct devstat)) +sizeof(long);
dinfo->mem_ptr = (u_int8_t *)malloc(dssize);
} else
- dssize =(dinfo->numdevs * sizeof(struct devstat)) + sizeof(int);
+ dssize =(dinfo->numdevs * sizeof(struct devstat)) +sizeof(long);
/* Get the current time when we get the stats */
gettimeofday(&stats->busy_time, NULL);
@@ -298,7 +299,7 @@ getdevs(struct statinfo *stats)
return(-1);
dssize = (dinfo->numdevs * sizeof(struct devstat)) +
- sizeof(int);
+ sizeof(long);
dinfo->mem_ptr = (u_int8_t *)realloc(dinfo->mem_ptr,
dssize);
if ((error = sysctlbyname("kern.devstat.all",
@@ -322,7 +323,7 @@ getdevs(struct statinfo *stats)
* The sysctl spits out the generation as the first four bytes,
* then all of the device statistics structures.
*/
- dinfo->generation = *(int *)dinfo->mem_ptr;
+ dinfo->generation = *(long *)dinfo->mem_ptr;
/*
* If the generation has changed, and if the current number of
@@ -344,14 +345,14 @@ getdevs(struct statinfo *stats)
if ((dinfo->numdevs = getnumdevs()) < 0)
return(-1);
dssize = (dinfo->numdevs * sizeof(struct devstat)) +
- sizeof(int);
+ sizeof(long);
dinfo->mem_ptr = (u_int8_t *)realloc(dinfo->mem_ptr,
dssize);
}
retval = 1;
}
- dinfo->devices = (struct devstat *)(dinfo->mem_ptr + sizeof(int));
+ dinfo->devices = (struct devstat *)(dinfo->mem_ptr + sizeof(long));
return(retval);
}
@@ -419,8 +420,8 @@ getdevs(struct statinfo *stats)
*/
int
selectdevs(struct device_selection **dev_select, int *num_selected,
- int *num_selections, int *select_generation,
- int current_generation, struct devstat *devices, int numdevs,
+ int *num_selections, long *select_generation,
+ long current_generation, struct devstat *devices, int numdevs,
struct devstat_match *matches, int num_matches,
char **dev_selections, int num_dev_selections,
devstat_select_mode select_mode, int maxshowdevs, int perf_select)
diff --git a/lib/libdevstat/devstat.h b/lib/libdevstat/devstat.h
index b2f1543..e0a54d0 100644
--- a/lib/libdevstat/devstat.h
+++ b/lib/libdevstat/devstat.h
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: devstat.h,v 1.1 1998/09/15 06:23:21 gibbs Exp $
*/
#ifndef _DEVSTAT_H
@@ -68,7 +68,7 @@ struct device_selection {
struct devinfo {
struct devstat *devices;
u_int8_t *mem_ptr;
- int generation;
+ long generation;
int numdevs;
};
@@ -89,13 +89,13 @@ typedef enum {
__BEGIN_DECLS
int getnumdevs(void);
-int getgeneration(void);
+long getgeneration(void);
int getversion(void);
int checkversion(void);
int getdevs(struct statinfo *stats);
int selectdevs(struct device_selection **dev_select, int *num_selected,
- int *num_selections, int *select_generation,
- int current_generation, struct devstat *devices, int numdevs,
+ int *num_selections, long *select_generation,
+ long current_generation, struct devstat *devices, int numdevs,
struct devstat_match *matches, int num_matches,
char **dev_selections, int num_dev_selections,
devstat_select_mode select_mode, int maxshowdevs,
OpenPOWER on IntegriCloud