summaryrefslogtreecommitdiff
path: root/source3/registry/reg_perfcount.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-10-17 10:36:33 -0700
committerJeremy Allison <jra@samba.org>2009-10-17 10:36:33 -0700
commit7c51fa6d699a653cafa90df8e44911b576118ebd (patch)
tree543bf9ca698e03eff81104898b33e77f1abed319 /source3/registry/reg_perfcount.c
parentcc3a6770c77ec8fe1cd63bf4c682853c56201f0c (diff)
parent3e3214fd91471bca5b6c4d3782e922d252d588fb (diff)
downloadsamba-7c51fa6d699a653cafa90df8e44911b576118ebd.tar.gz
samba-7c51fa6d699a653cafa90df8e44911b576118ebd.tar.bz2
samba-7c51fa6d699a653cafa90df8e44911b576118ebd.zip
Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba
Diffstat (limited to 'source3/registry/reg_perfcount.c')
-rw-r--r--source3/registry/reg_perfcount.c245
1 files changed, 143 insertions, 102 deletions
diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c
index 14716b2f53..1991af10ca 100644
--- a/source3/registry/reg_perfcount.c
+++ b/source3/registry/reg_perfcount.c
@@ -30,7 +30,7 @@
#define NAMES_DB "names.tdb"
#define DATA_DB "data.tdb"
-PERF_OBJECT_TYPE *_reg_perfcount_find_obj(PERF_DATA_BLOCK *block, int objind);
+struct PERF_OBJECT_TYPE *_reg_perfcount_find_obj(struct PERF_DATA_BLOCK *block, int objind);
/*********************************************************************
*********************************************************************/
@@ -161,7 +161,7 @@ static uint32 _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb,
char temp[256];
char *buf1 = *retbuf;
uint32 working_size = 0;
- UNISTR2 name_index, name;
+ DATA_BLOB name_index, name;
memset(temp, 0, sizeof(temp));
snprintf(temp, sizeof(temp), "%d", keyval);
@@ -182,8 +182,8 @@ static uint32 _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb,
buffer_size = 0;
return buffer_size;
}
- init_unistr2(&name_index, (const char *)kbuf.dptr, UNI_STR_TERMINATE);
- memcpy(buf1+buffer_size, (char *)name_index.buffer, working_size);
+ push_reg_sz(talloc_tos(), &name_index, (const char *)kbuf.dptr);
+ memcpy(buf1+buffer_size, (char *)name_index.data, working_size);
buffer_size += working_size;
/* Now encode the actual name */
working_size = (dbuf.dsize + 1)*sizeof(uint16);
@@ -195,8 +195,8 @@ static uint32 _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb,
memset(temp, 0, sizeof(temp));
memcpy(temp, dbuf.dptr, dbuf.dsize);
SAFE_FREE(dbuf.dptr);
- init_unistr2(&name, temp, UNI_STR_TERMINATE);
- memcpy(buf1+buffer_size, (char *)name.buffer, working_size);
+ push_reg_sz(talloc_tos(), &name, temp);
+ memcpy(buf1+buffer_size, (char *)name.data, working_size);
buffer_size += working_size;
*retbuf = buf1;
@@ -365,24 +365,29 @@ static uint32 _reg_perfcount_get_numinst(int objInd, TDB_CONTEXT *names)
/*********************************************************************
*********************************************************************/
-static bool _reg_perfcount_add_object(PERF_DATA_BLOCK *block,
- prs_struct *ps,
+static bool _reg_perfcount_add_instance(struct PERF_OBJECT_TYPE *obj,
+ TALLOC_CTX *mem_ctx,
+ int instInd,
+ TDB_CONTEXT *names);
+
+static bool _reg_perfcount_add_object(struct PERF_DATA_BLOCK *block,
+ TALLOC_CTX *mem_ctx,
int num,
TDB_DATA data,
TDB_CONTEXT *names)
{
int i;
bool success = True;
- PERF_OBJECT_TYPE *obj;
+ struct PERF_OBJECT_TYPE *obj;
- block->objects = (PERF_OBJECT_TYPE *)TALLOC_REALLOC_ARRAY(ps->mem_ctx,
+ block->objects = (struct PERF_OBJECT_TYPE *)TALLOC_REALLOC_ARRAY(mem_ctx,
block->objects,
- PERF_OBJECT_TYPE,
+ struct PERF_OBJECT_TYPE,
block->NumObjectTypes+1);
if(block->objects == NULL)
return False;
obj = &(block->objects[block->NumObjectTypes]);
- memset((void *)&(block->objects[block->NumObjectTypes]), 0, sizeof(PERF_OBJECT_TYPE));
+ memset((void *)&(block->objects[block->NumObjectTypes]), 0, sizeof(struct PERF_OBJECT_TYPE));
block->objects[block->NumObjectTypes].ObjectNameTitleIndex = num;
block->objects[block->NumObjectTypes].ObjectNameTitlePointer = 0;
block->objects[block->NumObjectTypes].ObjectHelpTitleIndex = num+1;
@@ -398,7 +403,7 @@ static bool _reg_perfcount_add_object(PERF_DATA_BLOCK *block,
block->NumObjectTypes+=1;
for(i = 0; i < (int)obj->NumInstances; i++) {
- success = _reg_perfcount_add_instance(obj, ps, i, names);
+ success = _reg_perfcount_add_instance(obj, mem_ctx, i, names);
}
return success;
@@ -407,7 +412,7 @@ static bool _reg_perfcount_add_object(PERF_DATA_BLOCK *block,
/*********************************************************************
*********************************************************************/
-bool _reg_perfcount_get_counter_data(TDB_DATA key, TDB_DATA *data)
+static bool _reg_perfcount_get_counter_data(TDB_DATA key, TDB_DATA *data)
{
TDB_CONTEXT *counters;
const char *fname = counters_directory( DATA_DB );
@@ -469,10 +474,10 @@ static uint32 _reg_perfcount_compute_scale(int64_t data)
/*********************************************************************
*********************************************************************/
-static bool _reg_perfcount_get_counter_info(PERF_DATA_BLOCK *block,
- prs_struct *ps,
+static bool _reg_perfcount_get_counter_info(struct PERF_DATA_BLOCK *block,
+ TALLOC_CTX *mem_ctx,
int CounterIndex,
- PERF_OBJECT_TYPE *obj,
+ struct PERF_OBJECT_TYPE *obj,
TDB_CONTEXT *names)
{
TDB_DATA key, data;
@@ -546,7 +551,7 @@ static bool _reg_perfcount_get_counter_info(PERF_DATA_BLOCK *block,
SAFE_FREE(data.dptr);
obj->counter_data.ByteLength += dsize + padding;
- obj->counter_data.data = TALLOC_REALLOC_ARRAY(ps->mem_ctx,
+ obj->counter_data.data = TALLOC_REALLOC_ARRAY(mem_ctx,
obj->counter_data.data,
uint8,
obj->counter_data.ByteLength - sizeof(uint32));
@@ -578,11 +583,11 @@ static bool _reg_perfcount_get_counter_info(PERF_DATA_BLOCK *block,
/*********************************************************************
*********************************************************************/
-PERF_OBJECT_TYPE *_reg_perfcount_find_obj(PERF_DATA_BLOCK *block, int objind)
+struct PERF_OBJECT_TYPE *_reg_perfcount_find_obj(struct PERF_DATA_BLOCK *block, int objind)
{
int i;
- PERF_OBJECT_TYPE *obj = NULL;
+ struct PERF_OBJECT_TYPE *obj = NULL;
for(i = 0; i < block->NumObjectTypes; i++)
{
@@ -598,15 +603,15 @@ PERF_OBJECT_TYPE *_reg_perfcount_find_obj(PERF_DATA_BLOCK *block, int objind)
/*********************************************************************
*********************************************************************/
-static bool _reg_perfcount_add_counter(PERF_DATA_BLOCK *block,
- prs_struct *ps,
+static bool _reg_perfcount_add_counter(struct PERF_DATA_BLOCK *block,
+ TALLOC_CTX *mem_ctx,
int num,
TDB_DATA data,
TDB_CONTEXT *names)
{
char *begin, *end, *start, *stop;
int parent;
- PERF_OBJECT_TYPE *obj;
+ struct PERF_OBJECT_TYPE *obj;
bool success = True;
char buf[PERFCOUNT_MAX_LEN];
@@ -634,18 +639,18 @@ static bool _reg_perfcount_add_counter(PERF_DATA_BLOCK *block,
parent, num));
return False;
}
- obj->counters = (PERF_COUNTER_DEFINITION *)TALLOC_REALLOC_ARRAY(ps->mem_ctx,
+ obj->counters = (struct PERF_COUNTER_DEFINITION *)TALLOC_REALLOC_ARRAY(mem_ctx,
obj->counters,
- PERF_COUNTER_DEFINITION,
+ struct PERF_COUNTER_DEFINITION,
obj->NumCounters+1);
if(obj->counters == NULL)
return False;
- memset((void *)&(obj->counters[obj->NumCounters]), 0, sizeof(PERF_COUNTER_DEFINITION));
+ memset((void *)&(obj->counters[obj->NumCounters]), 0, sizeof(struct PERF_COUNTER_DEFINITION));
obj->counters[obj->NumCounters].CounterNameTitleIndex=num;
obj->counters[obj->NumCounters].CounterHelpTitleIndex=num+1;
obj->counters[obj->NumCounters].DetailLevel = PERF_DETAIL_NOVICE;
- obj->counters[obj->NumCounters].ByteLength = sizeof(PERF_COUNTER_DEFINITION);
- success = _reg_perfcount_get_counter_info(block, ps, num, obj, names);
+ obj->counters[obj->NumCounters].ByteLength = sizeof(struct PERF_COUNTER_DEFINITION);
+ success = _reg_perfcount_get_counter_info(block, mem_ctx, num, obj, names);
obj->NumCounters += 1;
start = stop + 1;
}
@@ -660,11 +665,11 @@ static bool _reg_perfcount_add_counter(PERF_DATA_BLOCK *block,
/*********************************************************************
*********************************************************************/
-bool _reg_perfcount_get_instance_info(PERF_INSTANCE_DEFINITION *inst,
- prs_struct *ps,
- int instId,
- PERF_OBJECT_TYPE *obj,
- TDB_CONTEXT *names)
+static bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *inst,
+ TALLOC_CTX *mem_ctx,
+ int instId,
+ struct PERF_OBJECT_TYPE *obj,
+ TDB_CONTEXT *names)
{
TDB_DATA key, data;
char buf[PERFCOUNT_MAX_LEN], temp[PERFCOUNT_MAX_LEN];
@@ -686,7 +691,7 @@ bool _reg_perfcount_get_instance_info(PERF_INSTANCE_DEFINITION *inst,
return False;
}
inst->counter_data.ByteLength = data.dsize + sizeof(inst->counter_data.ByteLength);
- inst->counter_data.data = TALLOC_REALLOC_ARRAY(ps->mem_ctx,
+ inst->counter_data.data = TALLOC_REALLOC_ARRAY(mem_ctx,
inst->counter_data.data,
uint8,
data.dsize);
@@ -713,12 +718,12 @@ bool _reg_perfcount_get_instance_info(PERF_INSTANCE_DEFINITION *inst,
memset(buf, 0, PERFCOUNT_MAX_LEN);
memcpy(buf, data.dptr, MIN(PERFCOUNT_MAX_LEN-1,data.dsize));
buf[PERFCOUNT_MAX_LEN-1] = '\0';
- inst->NameLength = rpcstr_push_talloc(ps->mem_ctx, &name, buf);
+ inst->NameLength = rpcstr_push_talloc(mem_ctx, &name, buf);
if (inst->NameLength == (uint32_t)-1 || !name) {
SAFE_FREE(data.dptr);
return False;
}
- inst->data = TALLOC_REALLOC_ARRAY(ps->mem_ctx,
+ inst->data = TALLOC_REALLOC_ARRAY(mem_ctx,
inst->data,
uint8,
inst->NameLength);
@@ -740,7 +745,7 @@ bool _reg_perfcount_get_instance_info(PERF_INSTANCE_DEFINITION *inst,
if((pad = (inst->ByteLength % 8)))
{
pad = 8 - pad;
- inst->data = TALLOC_REALLOC_ARRAY(ps->mem_ctx,
+ inst->data = TALLOC_REALLOC_ARRAY(mem_ctx,
inst->data,
uint8,
inst->NameLength + pad);
@@ -754,32 +759,32 @@ bool _reg_perfcount_get_instance_info(PERF_INSTANCE_DEFINITION *inst,
/*********************************************************************
*********************************************************************/
-bool _reg_perfcount_add_instance(PERF_OBJECT_TYPE *obj,
- prs_struct *ps,
- int instInd,
- TDB_CONTEXT *names)
+static bool _reg_perfcount_add_instance(struct PERF_OBJECT_TYPE *obj,
+ TALLOC_CTX *mem_ctx,
+ int instInd,
+ TDB_CONTEXT *names)
{
- PERF_INSTANCE_DEFINITION *inst;
+ struct PERF_INSTANCE_DEFINITION *inst;
if(obj->instances == NULL) {
- obj->instances = TALLOC_REALLOC_ARRAY(ps->mem_ctx,
+ obj->instances = TALLOC_REALLOC_ARRAY(mem_ctx,
obj->instances,
- PERF_INSTANCE_DEFINITION,
+ struct PERF_INSTANCE_DEFINITION,
obj->NumInstances);
}
if(obj->instances == NULL)
return False;
- memset(&(obj->instances[instInd]), 0, sizeof(PERF_INSTANCE_DEFINITION));
+ memset(&(obj->instances[instInd]), 0, sizeof(struct PERF_INSTANCE_DEFINITION));
inst = &(obj->instances[instInd]);
- return _reg_perfcount_get_instance_info(inst, ps, instInd, obj, names);
+ return _reg_perfcount_get_instance_info(inst, mem_ctx, instInd, obj, names);
}
/*********************************************************************
*********************************************************************/
-static int _reg_perfcount_assemble_global(PERF_DATA_BLOCK *block,
- prs_struct *ps,
+static int _reg_perfcount_assemble_global(struct PERF_DATA_BLOCK *block,
+ TALLOC_CTX *mem_ctx,
int base_index,
TDB_CONTEXT *names)
{
@@ -796,9 +801,9 @@ static int _reg_perfcount_assemble_global(PERF_DATA_BLOCK *block,
if(data.dptr != NULL)
{
if(_reg_perfcount_isparent(data))
- success = _reg_perfcount_add_object(block, ps, j, data, names);
+ success = _reg_perfcount_add_object(block, mem_ctx, j, data, names);
else if(_reg_perfcount_ischild(data))
- success = _reg_perfcount_add_counter(block, ps, j, data, names);
+ success = _reg_perfcount_add_counter(block, mem_ctx, j, data, names);
else
{
DEBUG(3, ("Bogus relationship [%s] for counter [%d].\n", data.dptr, j));
@@ -849,7 +854,7 @@ static bool _reg_perfcount_get_64(uint64_t *retval,
/*********************************************************************
*********************************************************************/
-static bool _reg_perfcount_init_data_block_perf(PERF_DATA_BLOCK *block,
+static bool _reg_perfcount_init_data_block_perf(struct PERF_DATA_BLOCK *block,
TDB_CONTEXT *names)
{
uint64_t PerfFreq, PerfTime, PerfTime100nSec;
@@ -893,16 +898,34 @@ static bool _reg_perfcount_init_data_block_perf(PERF_DATA_BLOCK *block,
return True;
}
+/*******************************************************************
+********************************************************************/
+
+static bool make_systemtime(struct SYSTEMTIME *systime, struct tm *unixtime)
+{
+ systime->year=unixtime->tm_year+1900;
+ systime->month=unixtime->tm_mon+1;
+ systime->dayofweek=unixtime->tm_wday;
+ systime->day=unixtime->tm_mday;
+ systime->hour=unixtime->tm_hour;
+ systime->minute=unixtime->tm_min;
+ systime->second=unixtime->tm_sec;
+ systime->milliseconds=0;
+
+ return True;
+}
+
/*********************************************************************
*********************************************************************/
-static bool _reg_perfcount_init_data_block(PERF_DATA_BLOCK *block,
- prs_struct *ps, TDB_CONTEXT *names)
+static bool _reg_perfcount_init_data_block(struct PERF_DATA_BLOCK *block,
+ TALLOC_CTX *mem_ctx, TDB_CONTEXT *names,
+ bool bigendian_data)
{
smb_ucs2_t *temp = NULL;
time_t tm;
- if (rpcstr_push_talloc(ps->mem_ctx, &temp, "PERF")==(size_t)-1) {
+ if (rpcstr_push_talloc(mem_ctx, &temp, "PERF")==(size_t)-1) {
return false;
}
if (!temp) {
@@ -910,7 +933,7 @@ static bool _reg_perfcount_init_data_block(PERF_DATA_BLOCK *block,
}
memcpy(block->Signature, temp, strlen_w(temp) *2);
- if(ps->bigendian_data == RPC_BIG_ENDIAN)
+ if(bigendian_data)
block->LittleEndian = 0;
else
block->LittleEndian = 1;
@@ -926,12 +949,12 @@ static bool _reg_perfcount_init_data_block(PERF_DATA_BLOCK *block,
memset(temp, 0, sizeof(temp));
rpcstr_push((void *)temp, global_myname(), sizeof(temp), STR_TERMINATE);
block->SystemNameLength = (strlen_w(temp) * 2) + 2;
- block->data = TALLOC_ZERO_ARRAY(ps->mem_ctx, uint8, block->SystemNameLength + (8 - (block->SystemNameLength % 8)));
+ block->data = TALLOC_ZERO_ARRAY(mem_ctx, uint8, block->SystemNameLength + (8 - (block->SystemNameLength % 8)));
if (block->data == NULL) {
return False;
}
memcpy(block->data, temp, block->SystemNameLength);
- block->SystemNameOffset = sizeof(PERF_DATA_BLOCK) - sizeof(block->objects) - sizeof(block->data);
+ block->SystemNameOffset = sizeof(struct PERF_DATA_BLOCK) - sizeof(block->objects) - sizeof(block->data);
block->HeaderLength = block->SystemNameOffset + block->SystemNameLength;
/* Make sure to adjust for 64-bit alignment for when we finish writing the system name,
so that the PERF_OBJECT_TYPE struct comes out 64-bit aligned */
@@ -943,13 +966,13 @@ static bool _reg_perfcount_init_data_block(PERF_DATA_BLOCK *block,
/*********************************************************************
*********************************************************************/
-static uint32 _reg_perfcount_perf_data_block_fixup(PERF_DATA_BLOCK *block, prs_struct *ps)
+static uint32 _reg_perfcount_perf_data_block_fixup(struct PERF_DATA_BLOCK *block, TALLOC_CTX *mem_ctx)
{
int obj, cnt, inst, pad, i;
- PERF_OBJECT_TYPE *object;
- PERF_INSTANCE_DEFINITION *instance;
- PERF_COUNTER_DEFINITION *counter;
- PERF_COUNTER_BLOCK *counter_data;
+ struct PERF_OBJECT_TYPE *object;
+ struct PERF_INSTANCE_DEFINITION *instance;
+ struct PERF_COUNTER_DEFINITION *counter;
+ struct PERF_COUNTER_BLOCK *counter_data;
char *temp = NULL, *src_addr, *dst_addr;
block->TotalByteLength = 0;
@@ -974,7 +997,7 @@ static uint32 _reg_perfcount_perf_data_block_fixup(PERF_DATA_BLOCK *block, prs_s
counter_data = &(instance->counter_data);
counter = &(object[obj].counters[object[obj].NumCounters - 1]);
counter_data->ByteLength = counter->CounterOffset + counter->CounterSize + sizeof(counter_data->ByteLength);
- temp = TALLOC_REALLOC_ARRAY(ps->mem_ctx,
+ temp = TALLOC_REALLOC_ARRAY(mem_ctx,
temp,
char,
counter_data->ByteLength- sizeof(counter_data->ByteLength));
@@ -995,7 +1018,7 @@ static uint32 _reg_perfcount_perf_data_block_fixup(PERF_DATA_BLOCK *block, prs_s
{
pad = 8 - pad;
}
- counter_data->data = TALLOC_REALLOC_ARRAY(ps->mem_ctx,
+ counter_data->data = TALLOC_REALLOC_ARRAY(mem_ctx,
counter_data->data,
uint8,
counter_data->ByteLength - sizeof(counter_data->ByteLength) + pad);
@@ -1015,7 +1038,7 @@ static uint32 _reg_perfcount_perf_data_block_fixup(PERF_DATA_BLOCK *block, prs_s
if((pad = (object[obj].counter_data.ByteLength % 8)))
{
pad = 8 - pad;
- object[obj].counter_data.data = TALLOC_REALLOC_ARRAY(ps->mem_ctx,
+ object[obj].counter_data.data = TALLOC_REALLOC_ARRAY(mem_ctx,
object[obj].counter_data.data,
uint8,
object[obj].counter_data.ByteLength + pad);
@@ -1024,7 +1047,7 @@ static uint32 _reg_perfcount_perf_data_block_fixup(PERF_DATA_BLOCK *block, prs_s
}
object[obj].TotalByteLength += object[obj].counter_data.ByteLength;
}
- object[obj].HeaderLength = sizeof(*object) - (sizeof(counter) + sizeof(instance) + sizeof(PERF_COUNTER_BLOCK));
+ object[obj].HeaderLength = sizeof(*object) - (sizeof(counter) + sizeof(instance) + sizeof(struct PERF_COUNTER_BLOCK));
object[obj].TotalByteLength += object[obj].HeaderLength;
object[obj].DefinitionLength += object[obj].HeaderLength;
@@ -1037,10 +1060,11 @@ static uint32 _reg_perfcount_perf_data_block_fixup(PERF_DATA_BLOCK *block, prs_s
/*********************************************************************
*********************************************************************/
-uint32 reg_perfcount_get_perf_data_block(uint32 base_index,
- prs_struct *ps,
- PERF_DATA_BLOCK *block,
- const char *object_ids)
+static uint32 reg_perfcount_get_perf_data_block(uint32 base_index,
+ TALLOC_CTX *mem_ctx,
+ struct PERF_DATA_BLOCK *block,
+ const char *object_ids,
+ bool bigendian_data)
{
uint32 buffer_size = 0;
const char *fname = counters_directory( NAMES_DB );
@@ -1055,7 +1079,7 @@ uint32 reg_perfcount_get_perf_data_block(uint32 base_index,
return 0;
}
- if (!_reg_perfcount_init_data_block(block, ps, names)) {
+ if (!_reg_perfcount_init_data_block(block, mem_ctx, names, bigendian_data)) {
DEBUG(0, ("_reg_perfcount_init_data_block failed\n"));
tdb_close(names);
return 0;
@@ -1066,14 +1090,14 @@ uint32 reg_perfcount_get_perf_data_block(uint32 base_index,
if(object_ids == NULL)
{
/* we're getting a request for "Global" here */
- retval = _reg_perfcount_assemble_global(block, ps, base_index, names);
+ retval = _reg_perfcount_assemble_global(block, mem_ctx, base_index, names);
}
else
{
/* we're getting a request for a specific set of PERF_OBJECT_TYPES */
- retval = _reg_perfcount_assemble_global(block, ps, base_index, names);
+ retval = _reg_perfcount_assemble_global(block, mem_ctx, base_index, names);
}
- buffer_size = _reg_perfcount_perf_data_block_fixup(block, ps);
+ buffer_size = _reg_perfcount_perf_data_block_fixup(block, mem_ctx);
tdb_close(names);
@@ -1084,10 +1108,35 @@ uint32 reg_perfcount_get_perf_data_block(uint32 base_index,
return buffer_size + block->HeaderLength;
}
+/*******************************************************************
+********************************************************************/
+
+static bool smb_io_system_time(const char *desc, prs_struct *ps, int depth, struct SYSTEMTIME *systime)
+{
+ if(!prs_uint16("year", ps, depth, &systime->year))
+ return False;
+ if(!prs_uint16("month", ps, depth, &systime->month))
+ return False;
+ if(!prs_uint16("dayofweek", ps, depth, &systime->dayofweek))
+ return False;
+ if(!prs_uint16("day", ps, depth, &systime->day))
+ return False;
+ if(!prs_uint16("hour", ps, depth, &systime->hour))
+ return False;
+ if(!prs_uint16("minute", ps, depth, &systime->minute))
+ return False;
+ if(!prs_uint16("second", ps, depth, &systime->second))
+ return False;
+ if(!prs_uint16("milliseconds", ps, depth, &systime->milliseconds))
+ return False;
+
+ return True;
+}
+
/*********************************************************************
*********************************************************************/
-static bool _reg_perfcount_marshall_perf_data_block(prs_struct *ps, PERF_DATA_BLOCK block, int depth)
+static bool _reg_perfcount_marshall_perf_data_block(prs_struct *ps, struct PERF_DATA_BLOCK block, int depth)
{
int i;
prs_debug(ps, depth, "", "_reg_perfcount_marshall_perf_data_block");
@@ -1142,11 +1191,11 @@ static bool _reg_perfcount_marshall_perf_data_block(prs_struct *ps, PERF_DATA_BL
*********************************************************************/
static bool _reg_perfcount_marshall_perf_counters(prs_struct *ps,
- PERF_OBJECT_TYPE object,
+ struct PERF_OBJECT_TYPE object,
int depth)
{
int cnt;
- PERF_COUNTER_DEFINITION counter;
+ struct PERF_COUNTER_DEFINITION counter;
prs_debug(ps, depth, "", "_reg_perfcount_marshall_perf_counters");
depth++;
@@ -1186,7 +1235,7 @@ static bool _reg_perfcount_marshall_perf_counters(prs_struct *ps,
*********************************************************************/
static bool _reg_perfcount_marshall_perf_counter_data(prs_struct *ps,
- PERF_COUNTER_BLOCK counter_data,
+ struct PERF_COUNTER_BLOCK counter_data,
int depth)
{
prs_debug(ps, depth, "", "_reg_perfcount_marshall_perf_counter_data");
@@ -1209,10 +1258,10 @@ static bool _reg_perfcount_marshall_perf_counter_data(prs_struct *ps,
*********************************************************************/
static bool _reg_perfcount_marshall_perf_instances(prs_struct *ps,
- PERF_OBJECT_TYPE object,
+ struct PERF_OBJECT_TYPE object,
int depth)
{
- PERF_INSTANCE_DEFINITION instance;
+ struct PERF_INSTANCE_DEFINITION instance;
int inst;
prs_debug(ps, depth, "", "_reg_perfcount_marshall_perf_instances");
@@ -1249,11 +1298,11 @@ static bool _reg_perfcount_marshall_perf_instances(prs_struct *ps,
/*********************************************************************
*********************************************************************/
-static bool _reg_perfcount_marshall_perf_objects(prs_struct *ps, PERF_DATA_BLOCK block, int depth)
+static bool _reg_perfcount_marshall_perf_objects(prs_struct *ps, struct PERF_DATA_BLOCK block, int depth)
{
int obj;
- PERF_OBJECT_TYPE object;
+ struct PERF_OBJECT_TYPE object;
prs_debug(ps, depth, "", "_reg_perfcount_marshall_perf_objects");
depth++;
@@ -1319,20 +1368,6 @@ static bool _reg_perfcount_marshall_perf_objects(prs_struct *ps, PERF_DATA_BLOCK
/*********************************************************************
*********************************************************************/
-static bool _reg_perfcount_marshall_hkpd(prs_struct *ps, PERF_DATA_BLOCK block)
-{
- int depth = 0;
- if(_reg_perfcount_marshall_perf_data_block(ps, block, depth) == True)
- {
- if(_reg_perfcount_marshall_perf_objects(ps, block, depth) == True)
- return True;
- }
- return False;
-}
-
-/*********************************************************************
-*********************************************************************/
-
WERROR reg_perfcount_get_hkpd(prs_struct *ps, uint32 max_buf_size, uint32 *outbuf_len, const char *object_ids)
{
/*
@@ -1343,27 +1378,33 @@ WERROR reg_perfcount_get_hkpd(prs_struct *ps, uint32 max_buf_size, uint32 *outbu
* promising under
* http://msdn2.microsoft.com/en-us/library/aa373105.aspx -- vl
*/
- PERF_DATA_BLOCK block;
+ struct PERF_DATA_BLOCK block;
uint32 buffer_size, base_index;
buffer_size = 0;
base_index = reg_perfcount_get_base_index();
ZERO_STRUCT(block);
- buffer_size = reg_perfcount_get_perf_data_block(base_index, ps, &block, object_ids);
+ buffer_size = reg_perfcount_get_perf_data_block(base_index, ps->mem_ctx, &block, object_ids, ps->bigendian_data);
if(buffer_size < max_buf_size)
{
*outbuf_len = buffer_size;
- if(_reg_perfcount_marshall_hkpd(ps, block) == True)
- return WERR_OK;
- else
+
+ if (!_reg_perfcount_marshall_perf_data_block(ps, block, 0))
return WERR_NOMEM;
+
+ if (!_reg_perfcount_marshall_perf_objects(ps, block, 0))
+ return WERR_NOMEM;
+
+ return WERR_OK;
}
else
{
*outbuf_len = max_buf_size;
- _reg_perfcount_marshall_perf_data_block(ps, block, 0);
+ if (!_reg_perfcount_marshall_perf_data_block(ps, block, 0))
+ return WERR_NOMEM;
+
return WERR_INSUFFICIENT_BUFFER;
}
}