未验证 提交 820a48c5 编写于 作者: O openharmony_ci 提交者: Gitee

!157 支持容器资源限额

Merge pull request !157 from zhushengle/cgroups
......@@ -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();
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册