mirror of
https://github.com/ARM-software/devlib.git
synced 2025-02-07 13:40:48 +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):
|
def list_all(self):
|
||||||
self.logger.debug('Listing groups for %s controller', self.kind)
|
self.logger.debug('Listing groups for %s controller', self.kind)
|
||||||
output = self.target.execute('{} find {} -type d'\
|
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 = []
|
cgroups = []
|
||||||
for cg in output.splitlines():
|
for cg in output.splitlines():
|
||||||
cg = cg.replace(self.mount_point + '/', '/')
|
cg = cg.replace(self.mount_point + '/', '/')
|
||||||
@ -162,7 +163,7 @@ class CGroup(object):
|
|||||||
def exists(self):
|
def exists(self):
|
||||||
try:
|
try:
|
||||||
self.target.execute('[ -d {0} ]'\
|
self.target.execute('[ -d {0} ]'\
|
||||||
.format(self.directory))
|
.format(self.directory), as_root=True)
|
||||||
return True
|
return True
|
||||||
except TargetError:
|
except TargetError:
|
||||||
return False
|
return False
|
||||||
@ -176,7 +177,8 @@ class CGroup(object):
|
|||||||
self.directory)
|
self.directory)
|
||||||
output = self.target._execute_util(
|
output = self.target._execute_util(
|
||||||
'cgroups_get_attributes {} {}'.format(
|
'cgroups_get_attributes {} {}'.format(
|
||||||
self.directory, self.controller.kind))
|
self.directory, self.controller.kind),
|
||||||
|
as_root=True)
|
||||||
for res in output.splitlines():
|
for res in output.splitlines():
|
||||||
attr = res.split(':')[0]
|
attr = res.split(':')[0]
|
||||||
value = res.split(':')[1]
|
value = res.split(':')[1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user