tizen 2.3 release
[kernel/api/system-resource.git] / include / resourced.h
1 /*
2  * resourced
3  *
4  * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 /*
21  *  @file: resourced.h
22  *
23  *  @desc Performance management API
24  *  @version 2.0
25  *
26  *  Created on: May 30, 2012
27  */
28
29 #ifndef _SYSTEM_RESOURCE_RESOURCED_H_
30 #define _SYSTEM_RESOURCE_RESOURCED_H_
31
32 #include <sys/types.h>
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /* __cplusplus */
37
38 #define RESOURCED_ALL_APP "RESOURCED_ALL_APPLICATION_IDENTIFIER"
39 #define TETHERING_APP_NAME "RESOURCED_TETHERING_APPLICATION_IDENTIFIER"
40
41
42 /**
43  * @brief return code of the rsml's function
44  */
45 typedef enum {
46         RESOURCED_ERROR_NONMONITOR = -9,                /** < Process don't show watchdog popup */
47         RESOURCED_ERROR_NONFREEZABLE = -8,              /** < Process is nonfrizable */
48         RESOURCED_ERROR_NOTIMPL = -7,            /**< Not implemented yet error */
49         RESOURCED_ERROR_UNINITIALIZED = -6,      /**< Cgroup doen't
50                                            mounted or daemon not started */
51         RESOURCED_ERROR_NO_DATA = -5,            /**< Success, but no data */
52         RESOURCED_ERROR_INVALID_PARAMETER = -4,/**< Invalid parameter */
53         RESOURCED_ERROR_OUT_OF_MEMORY = -3,      /**< Out of memory */
54         RESOURCED_ERROR_DB_FAILED = -2,  /**< Database error */
55         RESOURCED_ERROR_FAIL = -1,               /**< General error */
56         RESOURCED_ERROR_NONE = 0                 /**< General success */
57 } resourced_ret_c;
58
59 #define RESOURCED_ERROR_OK RESOURCED_ERROR_NONE
60
61 /**
62  * @brief return type of the counters callback
63  */
64 typedef enum {
65         RESOURCED_CANCEL = 0,                   /**< cancel */
66         RESOURCED_CONTINUE = 1,         /**< continue */
67 } resourced_cb_ret;
68
69 /**
70  * @desc After invoking this function, application will be in
71  *   the monitored scope.
72  * @details It creates an appropriate cgroup,
73  *   it generates classid for the network performance control.
74  * @param app_id[in] - application identifier, it's package name now
75  * @param pid - pid to put in to cgroup, or self pid of 0
76  * @return 0 if success or error code
77  */
78 resourced_ret_c join_app_performance(const char *app_id, const pid_t pid);
79
80 #ifdef __cplusplus
81 }
82 #endif /* __cplusplus */
83
84 #endif /* _SYSTEM_RESOURCE_RESOURCED_H_ */