Mercurial > archived > louis > perso > liblxcstats
annotate _lxcstats.h @ 0:6ce4443e7545
Add the draft of an API to collect statistics on LXC
author | Louis Opter <kalessin@kalessin.fr> |
---|---|
date | Wed, 29 Dec 2010 23:28:14 +0100 |
parents | |
children | 2cb8a6cbe468 |
rev | line source |
---|---|
0
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
1 #ifndef _LXC_STATS_PRIV_H_ |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
2 # define _LXC_STATS_PRIV_H_ |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
3 |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
4 # include "compat/compat.h" |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
5 # include "probes/probes.h" |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
6 |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
7 struct dirent; |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
8 |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
9 /** |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
10 * Store all informations needed to get statistics from a cgroup |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
11 * hierarchy. |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
12 */ |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
13 struct _lxcst_controller { |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
14 char *cgroup_dir; /**< Mount point of the cgroup hierarchy. */ |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
15 }; |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
16 |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
17 /** |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
18 * Allocate a new lxcst structure for the given container. |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
19 */ |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
20 struct lxcst *_lxcst_container_new(struct _lxcst_controller *, const char *); |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
21 |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
22 /** |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
23 * Free a lxcst structure. |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
24 */ |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
25 void _lxcst_container_delete(struct lxcst *); |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
26 |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
27 /** |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
28 * Get statistics on a container. |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
29 */ |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
30 int _lxcst_container_read_infos(struct lxcst *); |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
31 |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
32 char *_lxcst_join_path(char *, size_t , const char *, const char *); |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
33 |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
34 /** |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
35 * Used to select only directories with scandir. We can't directly use it with |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
36 * scandir because we need the cgroup_dir. |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
37 * |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
38 * @return true if the given directory entry is a directory. |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
39 */ |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
40 int _lxcst_isdir(const struct _lxcst_controller *, const struct dirent *); |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
41 |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
42 /** |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
43 * Allocate a buffer and read an entire file in it. |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
44 * |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
45 * @param [in] path Path to the file to read |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
46 * @param [out] content A pointer to a pointer which will hold the allocated |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
47 * buffer. |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
48 * |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
49 * @return The size of the buffer on sucess, -1 with errno set otherwise. |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
50 */ |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
51 ssize_t _lxcst_read_file(const char *path, char **content); |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
52 |
6ce4443e7545
Add the draft of an API to collect statistics on LXC
Louis Opter <kalessin@kalessin.fr>
parents:
diff
changeset
|
53 #endif |