X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fcore%2Fcgroup.h;h=6bef26c481ee04e6f4da50c7d6572ec6255acc6a;hp=767eea2fb5aec2509ad71aa1b41ff66f82c6e145;hb=da4b83e77bc603745cf4a365d7f013301ef7fa89;hpb=56c4f5eceb1e77ac537960e255076712fcd0e7e5 diff --git a/src/core/cgroup.h b/src/core/cgroup.h index 767eea2fb..6bef26c48 100644 --- a/src/core/cgroup.h +++ b/src/core/cgroup.h @@ -23,15 +23,27 @@ #include -#include "list.h" -#include "time-util.h" +// #include "list.h" +// #include "time-util.h" #include "logind.h" -typedef struct CGroupContext CGroupContext; -typedef struct CGroupDeviceAllow CGroupDeviceAllow; -typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight; -typedef struct CGroupBlockIODeviceBandwidth CGroupBlockIODeviceBandwidth; +// UNNEEDED typedef struct CGroupContext CGroupContext; +// UNNEEDED Stypedef struct CGroupDeviceAllow CGroupDeviceAllow; +// UNNEEDED typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight; +// UNNEEDED typedef struct CGroupBlockIODeviceBandwidth CGroupBlockIODeviceBandwidth; +/* Maximum value for fixed (manual) net class ID assignment, + * and also the value at which the range of automatic assignments starts + */ +// UNNEEDED #define CGROUP_NETCLASS_FIXED_MAX UINT32_C(65535) + +// UNNEEDED typedef struct CGroupContext CGroupContext; +// UNNEEDED typedef struct CGroupDeviceAllow CGroupDeviceAllow; +// UNNEEDED typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight; +// UNNEEDED typedef struct CGroupBlockIODeviceBandwidth CGroupBlockIODeviceBandwidth; + +/// UNNEEDED by elogind +#if 0 typedef enum CGroupDevicePolicy { /* When devices listed, will allow those, plus built-in ones, @@ -48,6 +60,17 @@ typedef enum CGroupDevicePolicy { _CGROUP_DEVICE_POLICY_INVALID = -1 } CGroupDevicePolicy; +typedef enum CGroupNetClassType { + /* Default - do not assign a net class */ + CGROUP_NETCLASS_TYPE_NONE, + + /* Automatically assign a net class */ + CGROUP_NETCLASS_TYPE_AUTO, + + /* Assign the net class that was provided by the user */ + CGROUP_NETCLASS_TYPE_FIXED, +} CGroupNetClassType; + struct CGroupDeviceAllow { LIST_FIELDS(CGroupDeviceAllow, device_allow); char *path; @@ -59,7 +82,7 @@ struct CGroupDeviceAllow { struct CGroupBlockIODeviceWeight { LIST_FIELDS(CGroupBlockIODeviceWeight, device_weights); char *path; - unsigned long weight; + uint64_t weight; }; struct CGroupBlockIODeviceBandwidth { @@ -73,13 +96,14 @@ struct CGroupContext { bool cpu_accounting; bool blockio_accounting; bool memory_accounting; + bool tasks_accounting; - unsigned long cpu_shares; - unsigned long startup_cpu_shares; + uint64_t cpu_shares; + uint64_t startup_cpu_shares; usec_t cpu_quota_per_sec_usec; - unsigned long blockio_weight; - unsigned long startup_blockio_weight; + uint64_t blockio_weight; + uint64_t startup_blockio_weight; LIST_HEAD(CGroupBlockIODeviceWeight, blockio_device_weights); LIST_HEAD(CGroupBlockIODeviceBandwidth, blockio_device_bandwidths); @@ -88,22 +112,28 @@ struct CGroupContext { CGroupDevicePolicy device_policy; LIST_HEAD(CGroupDeviceAllow, device_allow); + CGroupNetClassType netclass_type; + uint32_t netclass_id; + + uint64_t tasks_max; + bool delegate; }; +#endif // 0 // #include "unit.h" -#include "cgroup-util.h" +// #include "cgroup-util.h" -void cgroup_context_init(CGroupContext *c); -void cgroup_context_done(CGroupContext *c); +// UNNNEEDE void cgroup_context_init(CGroupContext *c); +// UNNEEDED void cgroup_context_done(CGroupContext *c); // UNNEEDED void cgroup_context_dump(CGroupContext *c, FILE* f, const char *prefix); -// UNNEEDED void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, ManagerState state); +// UNNEEDED void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, uint32_t netclass_id, ManagerState state); -CGroupMask cgroup_context_get_mask(CGroupContext *c); +// UNNEEDED CGroupMask cgroup_context_get_mask(CGroupContext *c); -void cgroup_context_free_device_allow(CGroupContext *c, CGroupDeviceAllow *a); -void cgroup_context_free_blockio_device_weight(CGroupContext *c, CGroupBlockIODeviceWeight *w); -void cgroup_context_free_blockio_device_bandwidth(CGroupContext *c, CGroupBlockIODeviceBandwidth *b); +// UNNEEDED void cgroup_context_free_device_allow(CGroupContext *c, CGroupDeviceAllow *a); +// UNNEEDED void cgroup_context_free_blockio_device_weight(CGroupContext *c, CGroupBlockIODeviceWeight *w); +// UNNEEDED void cgroup_context_free_blockio_device_bandwidth(CGroupContext *c, CGroupBlockIODeviceBandwidth *b); // UNNEEDED CGroupMask unit_get_own_mask(Unit *u); // UNNEEDED CGroupMask unit_get_siblings_mask(Unit *u); @@ -125,6 +155,9 @@ void cgroup_context_free_blockio_device_bandwidth(CGroupContext *c, CGroupBlockI // UNNEEDED int unit_attach_pids_to_cgroup(Unit *u); +// UNNEEDED int unit_add_to_netclass_cgroup(Unit *u); +// UNNEEDED int unit_remove_from_netclass_cgroup(Unit *u); + int manager_setup_cgroup(Manager *m); void manager_shutdown_cgroup(Manager *m, bool delete); @@ -138,6 +171,7 @@ void manager_shutdown_cgroup(Manager *m, bool delete); // UNNEEDED int unit_watch_all_pids(Unit *u); // UNNEEDED int unit_get_memory_current(Unit *u, uint64_t *ret); +// UNNEEDED int unit_get_tasks_current(Unit *u, uint64_t *ret); // UNNEEDED int unit_get_cpu_usage(Unit *u, nsec_t *ret); // UNNEEDED int unit_reset_cpu_usage(Unit *u); @@ -146,5 +180,9 @@ void manager_shutdown_cgroup(Manager *m, bool delete); // UNNEEDED int unit_notify_cgroup_empty(Unit *u); // UNNEEDED int manager_notify_cgroup_empty(Manager *m, const char *group); -const char* cgroup_device_policy_to_string(CGroupDevicePolicy i) _const_; -CGroupDevicePolicy cgroup_device_policy_from_string(const char *s) _pure_; +// UNNEEDED void unit_invalidate_cgroup(Unit *u, CGroupMask m); + +// UNNEEDED void manager_invalidate_startup_units(Manager *m); + +// UNNEEDED const char* cgroup_device_policy_to_string(CGroupDevicePolicy i) _const_; +// UNNEEDED CGroupDevicePolicy cgroup_device_policy_from_string(const char *s) _pure_;