4 * Copyright (c) 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.
20 #include <resourced.h>
21 #include <sys/types.h>
24 * Cgroup creation interface
27 #ifndef _CGROUP_LIBRARY_CGROUP_H_
28 #define _CGROUP_LIBRARY_CGROUP_H_
30 #define DEFAULT_CGROUP "/sys/fs/cgroup"
33 * @desc Get one unsigned int value from cgroup
34 * @param cgroup_name - cgroup path
35 * @param file_name - cgroup content to write
36 * @param value - out parameter, value to fill
37 * @return negative value if error
39 int cgroup_read_node(const char *cgroup_name,
40 const char *file_name, unsigned int *value);
43 * @desc Put value to cgroup,
44 * @param cgroup_name - cgroup path
45 * @param file_name - cgroup content to write
46 * @param value - data to write
47 * @return negative value if error
49 int cgroup_write_node(const char *cgroup_name, const char *file_name, unsigned int value);
52 * @desc Put value to cgroup,
53 * @param cgroup_name - cgroup path
54 * @param file_name - cgroup content to write
55 * @param string -string to write
56 * @return negative value if error
58 int cgroup_write_node_str(const char *cgroup_name,
59 const char *file_name, char* string);
63 * @param parentdir - parent cgroup path
64 * @param cgroup_name - cgroup subdirectory to write
65 * @param cgroup_exists - 1 if subdir already exists, NULL pointer is possible
66 * as formal argument, in this case it will not be filled
67 * @return negative value if error
69 int make_cgroup_subdir(char* parentdir, char* cgroup_name, int *cgroup_exists);
73 * @param source -cgroup name
74 * @param mount_point - cgroup path
75 * @param opts - mount options
76 * @return negative value if error
78 int mount_cgroup_subsystem(char* source, char* mount_point, char* opts);
82 * @param source -cgroup name
83 * @param mount_point - cgroup path
84 * @param opts - mount options
85 * @return negative value if error
87 resourced_ret_c place_pid_to_cgroup(const char *cgroup_subsystem,
88 const char *cgroup_name, const int pid);
90 resourced_ret_c place_pid_to_cgroup_by_fullpath(const char *cgroup_full_path,
93 #endif /*_CGROUP_LIBRARY_CGROUP_H_*/