Update to FreeBSD 9.2

This commit is contained in:
Sebastian Huber
2013-11-06 16:20:21 +01:00
parent ce96623934
commit 66659ff1ad
596 changed files with 50781 additions and 19477 deletions

View File

@@ -98,11 +98,6 @@ retry:
return (-1);
}
if (maxcpus > MEMSTAT_MAXCPU) {
list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS;
return (-1);
}
size = sizeof(count);
if (sysctlbyname("kern.malloc_count", &count, &size, NULL, 0) < 0) {
if (errno == EACCES || errno == EPERM)
@@ -162,12 +157,6 @@ retry:
return (-1);
}
if (mtshp->mtsh_maxcpus > MEMSTAT_MAXCPU) {
list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS;
free(buffer);
return (-1);
}
/*
* For the remainder of this function, we are quite trusting about
* the layout of structures and sizes, since we've determined we have
@@ -186,7 +175,7 @@ retry:
mtp = NULL;
if (mtp == NULL)
mtp = _memstat_mt_allocate(list, ALLOCATOR_MALLOC,
mthp->mth_name);
mthp->mth_name, maxcpus);
if (mtp == NULL) {
_memstat_mtl_empty(list);
free(buffer);
@@ -197,7 +186,7 @@ retry:
/*
* Reset the statistics on a current node.
*/
_memstat_mt_reset_stats(mtp);
_memstat_mt_reset_stats(mtp, maxcpus);
for (j = 0; j < maxcpus; j++) {
mtsp = (struct malloc_type_stats *)p;
@@ -298,7 +287,7 @@ memstat_kvm_malloc(struct memory_type_list *list, void *kvm_handle)
void *kmemstatistics;
int hint_dontsearch, j, mp_maxcpus, ret;
char name[MEMTYPE_MAXNAME];
struct malloc_type_stats mts[MEMSTAT_MAXCPU], *mtsp;
struct malloc_type_stats *mts, *mtsp;
struct malloc_type_internal *mtip;
struct malloc_type type, *typep;
kvm_t *kvm;
@@ -325,11 +314,6 @@ memstat_kvm_malloc(struct memory_type_list *list, void *kvm_handle)
return (-1);
}
if (mp_maxcpus > MEMSTAT_MAXCPU) {
list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS;
return (-1);
}
ret = kread_symbol(kvm, X_KMEMSTATISTICS, &kmemstatistics,
sizeof(kmemstatistics), 0);
if (ret != 0) {
@@ -337,10 +321,17 @@ memstat_kvm_malloc(struct memory_type_list *list, void *kvm_handle)
return (-1);
}
mts = malloc(sizeof(struct malloc_type_stats) * mp_maxcpus);
if (mts == NULL) {
list->mtl_error = MEMSTAT_ERROR_NOMEMORY;
return (-1);
}
for (typep = kmemstatistics; typep != NULL; typep = type.ks_next) {
ret = kread(kvm, typep, &type, sizeof(type), 0);
if (ret != 0) {
_memstat_mtl_empty(list);
free(mts);
list->mtl_error = ret;
return (-1);
}
@@ -348,6 +339,7 @@ memstat_kvm_malloc(struct memory_type_list *list, void *kvm_handle)
MEMTYPE_MAXNAME);
if (ret != 0) {
_memstat_mtl_empty(list);
free(mts);
list->mtl_error = ret;
return (-1);
}
@@ -361,6 +353,7 @@ memstat_kvm_malloc(struct memory_type_list *list, void *kvm_handle)
sizeof(struct malloc_type_stats), 0);
if (ret != 0) {
_memstat_mtl_empty(list);
free(mts);
list->mtl_error = ret;
return (-1);
}
@@ -371,9 +364,10 @@ memstat_kvm_malloc(struct memory_type_list *list, void *kvm_handle)
mtp = NULL;
if (mtp == NULL)
mtp = _memstat_mt_allocate(list, ALLOCATOR_MALLOC,
name);
name, mp_maxcpus);
if (mtp == NULL) {
_memstat_mtl_empty(list);
free(mts);
list->mtl_error = MEMSTAT_ERROR_NOMEMORY;
return (-1);
}
@@ -382,7 +376,7 @@ memstat_kvm_malloc(struct memory_type_list *list, void *kvm_handle)
* This logic is replicated from kern_malloc.c, and should
* be kept in sync.
*/
_memstat_mt_reset_stats(mtp);
_memstat_mt_reset_stats(mtp, mp_maxcpus);
for (j = 0; j < mp_maxcpus; j++) {
mtsp = &mts[j];
mtp->mt_memalloced += mtsp->mts_memalloced;