4 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * @file: net-cls-cgroup.h
23 * @desc Performance management daemon. Helper function
24 * for working with classid table.
30 #ifndef _RESOURCED_NET_CLS_CGROUP_H_
31 #define _RESOURCED_NET_CLS_CGROUP_H_
33 #include <sys/types.h>
37 #include "resourced.h"
39 typedef GArray int_array;
42 * @desc Get all pids from cgroup
43 * Should be invoked after update_classids
44 * @return array, you should free it
46 int_array *get_monitored_pids(void);
49 * @desc update class id - pid table. At present one pid per classid.
51 int update_classids(void);
54 * @desc Get appid from classid task table. At present it is package name.
56 char *get_app_id_by_pid(const pid_t pid);
57 char *get_app_id_by_classid(const u_int32_t classid, const bool update_state);
60 * @desc take classid from net_cls cgroup by appid
61 * This function converts appid to pkgname.
62 * @param pkg_name - name of the cgroup
63 * @param create - in case of true - create cgroup if it's not exists
66 u_int32_t get_classid_by_app_id(const char *app_id, int create);
69 * @desc take classid from net_cls cgroup with name pkg_name
70 * @param pkg_name - name of the cgroup
71 * @param create - in case of true - create cgroup if it's not exists
74 u_int32_t get_classid_by_pkg_name(const char *pkg_name, int create);
77 * @desc Make net_cls cgroup and put in it the given pid and
79 * If cgroup alreay exists function just put pid in it.
80 * @param pid - process, that will be added to cgroup pkg_name,
81 * @param pkg_name - package name.
83 resourced_ret_c make_net_cls_cgroup_with_pid(const int pid,
84 const char *pkg_name);
86 #endif /*_RESOURCED_NET_CLS_CGROUP_H_*/