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