File: memory.c

package info (click to toggle)
nws 2.11-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,700 kB
  • ctags: 2,820
  • sloc: ansic: 28,849; sh: 3,289; java: 1,205; makefile: 697; perl: 12
file content (39 lines) | stat: -rwxr-xr-x 824 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* $Id: memory.c,v 1.18 2004/10/21 05:49:26 graziano Exp $ */

#include "memory.h"

#include "strutil.h"

void
MemoryUseSkill(	const char *options, 
		int *length, 
		SkillResult **results) {
	const char *c;
	char *tmp;
	char memoryType[7 + 1], opts[255 + 1];
	double res;
	int ret;

	tmp = GetOptionValue(options, "type", "passive");
	for(c = tmp; GETTOK(memoryType, c, ",", &c);) {
		vstrncpy(opts, sizeof(opts), 2, "type:", memoryType);
		if (strcmp(memoryType,"active") == 0) {
			ret = ActiveMemoryGetFree(&res);
		} else {
			ret = PassiveMemoryGetFree(&res);
		}
		AppendResult(freeMemory, opts, ret, res, length, results);
	}
	FREE(tmp);
}

int
MemoryMonitorAvailable(const char *options) {
	static int available = -1;

	if (available == -1) {
		available = PassiveMemoryMonitorAvailable();
	}

	return available;
}