init.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef _LIBCGROUP_INIT_H
  2. #define _LIBCGROUP_INIT_H
  3. #ifndef _LIBCGROUP_H_INSIDE
  4. #error "Only <libcgroup.h> should be included directly."
  5. #endif
  6. #ifndef SWIG
  7. #include <features.h>
  8. #endif
  9. __BEGIN_DECLS
  10. /**
  11. * @defgroup group_init 1. Initialization
  12. * @{
  13. *
  14. * @name Initialization
  15. * @{
  16. * Application must initialize @c libcgroup using cgroup_init() before any
  17. * other @c libcgroup function can be called. @c libcgroup caches information
  18. * about mounted hierarchies (just what's mounted where, not the control groups
  19. * themselves) at this time. There is currently no way to refresh this cache,
  20. * i.e. all subsequent mounts/remounts/unmounts are not reflected in this cache
  21. * and @c libcgroup may produce unexpected results.
  22. *
  23. * In addition, there is no way how to clean the cache on application exit.
  24. *
  25. * @todo this is very bad... There should be at least way how to refresh the
  26. * cache and/or an option to refresh it automatically (does kernel provide
  27. * any indication, when a filesystem is mounted/unmounted?). Dtto the cleanup
  28. * on exit.
  29. */
  30. /**
  31. * Initialize libcgroup. Information about mounted hierarchies are examined
  32. * and cached internally (just what's mounted where, not the groups themselves).
  33. *
  34. * If the cgroup logging was not set using cgroup_set_logger() or
  35. * cgroup_set_default_logger() before calling cgroup_init(), the default logger
  36. * is automatically set, logging CGROUP_LOG_ERROR messages.
  37. */
  38. int cgroup_init(void);
  39. /**
  40. * Returns path where is mounted given controller. Applications should rely on
  41. * @c libcgroup API and not call this function directly.
  42. * Only the first mount point is returned, use
  43. * cgroup_get_subsys_mount_point_begin(), cgroup_get_subsys_mount_point_next()
  44. * and cgroup_get_subsys_mount_point_end() to get all of them.
  45. * @param controller Name of the controller
  46. * @param mount_point The string where the mount point location is stored.
  47. * Please note, the caller must free the mount_point.
  48. */
  49. int cgroup_get_subsys_mount_point(const char *controller, char **mount_point);
  50. /**
  51. * @}
  52. * @}
  53. */
  54. __END_DECLS
  55. #endif /* _LIBCGROUP_INIT_H */