feat: 支持cgroups

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: I4dc90957e83d851ffb3853a0be440716053ff785
This commit is contained in:
zhushengle
2023-02-21 18:27:06 +08:00
parent 083ba119de
commit bcfffbded9
2 changed files with 25 additions and 0 deletions
+4
View File
@@ -65,7 +65,11 @@ int do_mkdir(int dirfd, const char *pathname, mode_t mode)
{
goto errout;
}
#ifdef LOSCFG_KERNEL_PLIMITS
if (!strncmp(fullpath, "/dev", 4) || !strcmp(fullpath, "/proc"))
#else
if (!strncmp(fullpath, "/dev", 4) || !strncmp(fullpath, "/proc", 5))
#endif
{
// virtual root create virtual dir
VnodeHold();
+21
View File
@@ -37,6 +37,9 @@
#include "blockproxy.h"
#include "path_cache.h"
#include "unistd.h"
#ifdef LOSCFG_KERNEL_DEV_PLIMIT
#include "los_plimits.h"
#endif
/****************************************************************************
* Public Functions
@@ -159,6 +162,17 @@ int fp_open(int dirfd, const char *path, int oflags, mode_t mode)
VnodeDrop();
goto errout;
}
#ifdef LOSCFG_KERNEL_DEV_PLIMIT
if (vnode->type == VNODE_TYPE_CHR)
{
if (OsDevLimitCheckPermission(vnode->type, fullpath, oflags) != LOS_OK)
{
ret = -EPERM;
VnodeDrop();
goto errout;
}
}
#endif
#ifdef LOSCFG_FS_VFS_BLOCK_DEVICE
if (vnode->type == VNODE_TYPE_BLK)
{
@@ -169,6 +183,13 @@ int fp_open(int dirfd, const char *path, int oflags, mode_t mode)
ret = fd;
goto errout;
}
#ifdef LOSCFG_KERNEL_DEV_PLIMIT
if (OsDevLimitCheckPermission(vnode->type, fullpath, oflags) != LOS_OK)
{
ret = -EPERM;
goto errout;
}
#endif
return fd;
}
#endif