File: validate.h

package info (click to toggle)
vzctl 3.0.11-14
  • links: PTS
  • area: main
  • in suites: etch
  • size: 1,164 kB
  • ctags: 1,894
  • sloc: ansic: 14,655; sh: 2,744; makefile: 419
file content (70 lines) | stat: -rw-r--r-- 2,017 bytes parent folder | download | duplicates (2)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 *  Copyright (C) 2000-2006 SWsoft. All rights reserved.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#ifndef _VALIDATE_H_
#define _VALIDATE_H_

#define ACT_NONE	0
#define ACT_WARN	1
#define ACT_ERROR	2
#define ACT_FIX		3

#define UTILIZATION	0
#define COMMITMENT	1

#define PROCUBC		"/proc/user_beancounters"

struct CRusage {
	double low_mem;
	double total_ram;
	double mem_swap;
	double alloc_mem;
	double alloc_mem_lim;
	double alloc_mem_max_lim;
	double cpu;
};

struct ovrc {
	int action;
	float *level_low_mem;
	float *level_total_ram;
	float *level_mem_swap;
	float *level_alloc_mem;
	float *level_alloc_mem_lim;
	float *level_alloc_mem_max_lim;
};

struct mem_struct {
	unsigned long long ram;
	unsigned long long swap;
	unsigned long long lowmem;
};

struct ub_struct;
struct vps_res;

int validate(struct vps_res *param, int recover, int ask);
int calc_ve_utilization(struct ub_struct *param, struct CRusage *rusage,
	struct mem_struct *mem, int numerator);
int calc_ve_commitment(struct ub_struct *param, struct CRusage *rusage,
	struct mem_struct *mem, int numerator);
void add_ubs_limit(struct ub_struct *ubs, int res_id, unsigned long *limit);
void free_ubs_limit(struct ub_struct *ubs);
void shift_ubs_param(struct ub_struct *param);
void inc_rusage(struct CRusage *rusagetotal, struct CRusage *rusage);
#endif