diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-03-24 19:06:49 +0100 |
---|---|---|
committer | Dhaval Giani <dhaval.giani@gmail.com> | 2010-03-26 12:56:43 +0100 |
commit | 127da29e9ab20a3be8096cbd7f7ff225a2ddd7b7 (patch) | |
tree | c06b98c7ddd7bd922cd049e4431872e6b6023f2e /include | |
parent | bdc36c15b77dd7db3720540efbd164899bee53c0 (diff) | |
download | libcg-127da29e9ab20a3be8096cbd7f7ff225a2ddd7b7.tar.gz libcg-127da29e9ab20a3be8096cbd7f7ff225a2ddd7b7.tar.xz libcg-127da29e9ab20a3be8096cbd7f7ff225a2ddd7b7.zip |
add const where applicable, drop const where unnecessary
This patch adds the const qualifier to a number of function arguments
(mostly string arguments) so that client libraries can pass their own
const strings to the library without having to cast their const'ness
away.
This also drops a couple of consts where call-by-value is done anyway,
and which hence has no effect and just misleads the users and adds
unnecessary noise to the signal. After all this is C, not C++.
Signed-off-by: Lennart Poettering <lennart@poettering.net>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcgroup/init.h | 2 | ||||
-rw-r--r-- | include/libcgroup/iterators.h | 8 | ||||
-rw-r--r-- | include/libcgroup/tasks.h | 10 |
3 files changed, 10 insertions, 10 deletions
diff --git a/include/libcgroup/init.h b/include/libcgroup/init.h index b38eb61..d0e93b4 100644 --- a/include/libcgroup/init.h +++ b/include/libcgroup/init.h @@ -18,7 +18,7 @@ int cgroup_init(void); * @mount_point: The string where the mount point is stored. Please note, * the caller must free mount_point. */ -int cgroup_get_subsys_mount_point(char *controller, char **mount_point); +int cgroup_get_subsys_mount_point(const char *controller, char **mount_point); __END_DECLS diff --git a/include/libcgroup/iterators.h b/include/libcgroup/iterators.h index 3e9f9f7..e8df12a 100644 --- a/include/libcgroup/iterators.h +++ b/include/libcgroup/iterators.h @@ -74,7 +74,7 @@ struct controller_data { * @handle: Handle to be used during iteration * @info: info filled and returned about directory information */ -int cgroup_walk_tree_begin(char *controller, char *base_path, const int depth, +int cgroup_walk_tree_begin(const char *controller, const char *base_path, int depth, void **handle, struct cgroup_file_info *info, int *base_level); /** @@ -86,7 +86,7 @@ int cgroup_walk_tree_begin(char *controller, char *base_path, const int depth, * * Returns ECGEOF when we are done walking through the nodes. */ -int cgroup_walk_tree_next(const int depth, void **handle, +int cgroup_walk_tree_next(int depth, void **handle, struct cgroup_file_info *info, int base_level); int cgroup_walk_tree_end(void **handle); @@ -107,7 +107,7 @@ int cgroup_walk_tree_set_flags(void **handle, int flags); * @handle: Handle to be used during iteration. * @stat: Stats values will be filled and returned here. */ -int cgroup_read_stats_begin(char *controller, char *path, void **handle, +int cgroup_read_stats_begin(const char *controller, const char *path, void **handle, struct cgroup_stat *stat); /** @@ -126,7 +126,7 @@ int cgroup_read_stats_end(void **handle); * @handle: Handle to be used in the iteration * @pid: The pid read from the tasks file. Will be filled in by the API */ -int cgroup_get_task_begin(char *cgroup, char *controller, void **handle, +int cgroup_get_task_begin(const char *cgroup, const char *controller, void **handle, pid_t *pid); /** diff --git a/include/libcgroup/tasks.h b/include/libcgroup/tasks.h index 665f993..913251c 100644 --- a/include/libcgroup/tasks.h +++ b/include/libcgroup/tasks.h @@ -42,8 +42,8 @@ int cgroup_attach_task_pid(struct cgroup *cgroup, pid_t tid); * @return 0 on success, > 0 on error * TODO: Determine thread-safeness and fix of not safe. */ -int cgroup_change_cgroup_flags(const uid_t uid, const gid_t gid, - char *procname, const pid_t pid, const int flags); +int cgroup_change_cgroup_flags(uid_t uid, gid_t gid, + const char *procname, pid_t pid, int flags); /** * Changes the cgroup of a program based on the rules in the config file. If a @@ -62,8 +62,8 @@ int cgroup_change_cgroup_flags(const uid_t uid, const gid_t gid, * @return 0 on success, > 0 on error * TODO: Determine thread-safeness and fix if not safe. */ -int cgroup_change_cgroup_uid_gid_flags(const uid_t uid, const gid_t gid, - const pid_t pid, const int flags); +int cgroup_change_cgroup_uid_gid_flags(uid_t uid, gid_t gid, + pid_t pid, int flags); /** * Provides backwards-compatibility with older versions of the API. This @@ -84,7 +84,7 @@ int cgroup_change_cgroup_uid_gid(uid_t uid, gid_t gid, pid_t pid); * * returns 0 on success. */ -int cgroup_change_cgroup_path(char *path, pid_t pid, char *controllers[]); +int cgroup_change_cgroup_path(const char *path, pid_t pid, const char * const controllers[]); /** * Print the cached rules table. This function should be called only after |