mirror of
https://github.com/openharmony/third_party_NuttX.git
synced 2026-07-01 08:17:34 -04:00
feat: 支持cgroups
Signed-off-by: zhushengle <zhushengle@huawei.com> Change-Id: I4dc90957e83d851ffb3853a0be440716053ff785
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user