mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
cgroups: run some commands with root permissions
Certain commands requires in general root permissions to be properly executed (for example on an Android target). Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This commit is contained in:
parent
96392fd6b5
commit
3acf5d56df
@ -104,7 +104,8 @@ class Controller(object):
|
||||
def list_all(self):
|
||||
self.logger.debug('Listing groups for %s controller', self.kind)
|
||||
output = self.target.execute('{} find {} -type d'\
|
||||
.format(self.target.busybox, self.mount_point))
|
||||
.format(self.target.busybox, self.mount_point),
|
||||
as_root=True)
|
||||
cgroups = []
|
||||
for cg in output.splitlines():
|
||||
cg = cg.replace(self.mount_point + '/', '/')
|
||||
@ -162,7 +163,7 @@ class CGroup(object):
|
||||
def exists(self):
|
||||
try:
|
||||
self.target.execute('[ -d {0} ]'\
|
||||
.format(self.directory))
|
||||
.format(self.directory), as_root=True)
|
||||
return True
|
||||
except TargetError:
|
||||
return False
|
||||
@ -176,7 +177,8 @@ class CGroup(object):
|
||||
self.directory)
|
||||
output = self.target._execute_util(
|
||||
'cgroups_get_attributes {} {}'.format(
|
||||
self.directory, self.controller.kind))
|
||||
self.directory, self.controller.kind),
|
||||
as_root=True)
|
||||
for res in output.splitlines():
|
||||
attr = res.split(':')[0]
|
||||
value = res.split(':')[1]
|
||||
|
Loading…
x
Reference in New Issue
Block a user