feat: 支持time容器
BREAKING CHANGE: 支持ipc容器及增强对外变更: 1.clone 支持CLONE_NEWTIME 2.增加”/proc/[pid]/container/time" 用于查询容器信息 3.增加”/proc/[pid]/container/time_for_children" 用于查询容器信息 4.增加”/proc/[pid]/container/pid_for_children" 用于查询容器信息 5.增加”/proc/[pid]/time_offsets" 用于查询和配置time容器信息 Close #I6B0A3 Signed-off-by: zhushengle <zhushengle@huawei.com> Change-Id: I54d79937ca608a10a4384f61e11c88757f833edf
This commit is contained in:
@@ -45,19 +45,26 @@
|
||||
#ifdef LOSCFG_IPC_CONTAINER
|
||||
#include "los_ipc_container_pri.h"
|
||||
#endif
|
||||
#ifdef LOSCFG_TIME_CONTAINER
|
||||
#include "los_time_container_pri.h"
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
CONTAINER = 0,
|
||||
PID_CONTAINER,
|
||||
PID_CHILD_CONTAINER,
|
||||
UTS_CONTAINER,
|
||||
MNT_CONTAINER,
|
||||
IPC_CONTAINER,
|
||||
TIME_CONTAINER,
|
||||
TIME_CHILD_CONTAINER,
|
||||
} ContainerType;
|
||||
|
||||
typedef struct Container {
|
||||
Atomic rc;
|
||||
#ifdef LOSCFG_PID_CONTAINER
|
||||
struct PidContainer *pidContainer;
|
||||
struct PidContainer *pidForChildContainer;
|
||||
#endif
|
||||
#ifdef LOSCFG_UTS_CONTAINER
|
||||
struct UtsContainer *utsContainer;
|
||||
@@ -68,6 +75,10 @@ typedef struct Container {
|
||||
#ifdef LOSCFG_IPC_CONTAINER
|
||||
struct IpcContainer *ipcContainer;
|
||||
#endif
|
||||
#ifdef LOSCFG_IPC_CONTAINER
|
||||
struct TimeContainer *timeContainer;
|
||||
struct TimeContainer *timeForChildContainer;
|
||||
#endif
|
||||
} Container;
|
||||
|
||||
VOID OsContainerInitSystemProcess(LosProcessCB *processCB);
|
||||
|
||||
63
kernel/base/include/los_time_container_pri.h
Normal file
63
kernel/base/include/los_time_container_pri.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _LOS_TIME_CONTAINER_PRI_H
|
||||
#define _LOS_TIME_CONTAINER_PRI_H
|
||||
#include "time.h"
|
||||
#include "los_atomic.h"
|
||||
|
||||
#ifdef LOSCFG_TIME_CONTAINER
|
||||
typedef struct ProcessCB LosProcessCB;
|
||||
|
||||
typedef struct TimeContainer {
|
||||
Atomic rc;
|
||||
BOOL frozenOffsets;
|
||||
struct timespec64 monotonic;
|
||||
UINT32 containerID;
|
||||
} TimeContainer;
|
||||
|
||||
UINT32 OsInitRootTimeContainer(TimeContainer **timeContainer);
|
||||
|
||||
UINT32 OsCopyTimeContainer(UINTPTR flags, LosProcessCB *child, LosProcessCB *parent);
|
||||
|
||||
VOID OsTimeContainersDestroy(LosProcessCB *curr);
|
||||
|
||||
UINT32 OsGetTimeContainerID(TimeContainer *timeContainer);
|
||||
|
||||
TimeContainer *OsGetCurrTimeContainer(VOID);
|
||||
|
||||
UINT32 OsGetTimeContainerMonotonic(LosProcessCB *processCB, struct timespec64 *offsets);
|
||||
|
||||
UINT32 OsSetTimeContainerMonotonic(LosProcessCB *processCB, struct timespec64 *offsets);
|
||||
|
||||
#define CLOCK_MONOTONIC_TIME_BASE (OsGetCurrTimeContainer()->monotonic)
|
||||
|
||||
#endif
|
||||
#endif /* _LOS_TIME_CONTAINER_PRI_H */
|
||||
Reference in New Issue
Block a user