cgroup.h revision bc432dc7eb62c5671f2b741a86a66393adb350dc
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#pragma once
/***
This file is part of systemd.
Copyright 2013 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "list.h"
typedef struct CGroupContext CGroupContext;
typedef struct CGroupDeviceAllow CGroupDeviceAllow;
typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight;
typedef struct CGroupBlockIODeviceBandwidth CGroupBlockIODeviceBandwidth;
typedef enum CGroupDevicePolicy {
/* When devices listed, will allow those, plus built-in ones,
if none are listed will allow everything. */
/* Everything forbidden, except built-in ones and listed ones. */
/* Everythings forbidden, except for the listed devices */
struct CGroupDeviceAllow {
char *path;
bool r:1;
bool w:1;
bool m:1;
};
struct CGroupBlockIODeviceWeight {
char *path;
unsigned long weight;
};
struct CGroupBlockIODeviceBandwidth {
char *path;
bool read;
};
struct CGroupContext {
bool cpu_accounting;
bool blockio_accounting;
bool memory_accounting;
unsigned long cpu_shares;
unsigned long blockio_weight;
};
#include "unit.h"
#include "manager.h"
#include "cgroup-util.h"
void cgroup_context_init(CGroupContext *c);
void cgroup_context_done(CGroupContext *c);
void cgroup_context_free_blockio_device_bandwidth(CGroupContext *c, CGroupBlockIODeviceBandwidth *b);
void unit_update_cgroup_members_masks(Unit *u);
int unit_realize_cgroup(Unit *u);
void unit_destroy_cgroup(Unit *u);
int manager_setup_cgroup(Manager *m);
unsigned manager_dispatch_cgroup_queue(Manager *m);