mirror of
https://gitee.com/openharmony/interface_sdk_c
synced 2024-11-27 08:51:29 +00:00
commit
fd6fecceaa
@ -1,3 +1,10 @@
|
||||
[
|
||||
{ "name": "OH_Ability_CreateNativeChildProcess" }
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Ability_CreateNativeChildProcess"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_Ability_StartNativeChildProcess"
|
||||
}
|
||||
]
|
@ -54,6 +54,11 @@ typedef enum Ability_NativeChildProcess_ErrCode {
|
||||
*/
|
||||
NCP_NO_ERROR = 0,
|
||||
|
||||
/**
|
||||
* @error Operation not permitted.
|
||||
*/
|
||||
NCP_ERR_NO_PERMISSION = 201,
|
||||
|
||||
/**
|
||||
* @error Invalid parameter.
|
||||
*/
|
||||
@ -173,6 +178,100 @@ typedef void (*OH_Ability_OnNativeChildProcessStarted)(int errCode, OHIPCRemoteP
|
||||
int OH_Ability_CreateNativeChildProcess(const char* libName,
|
||||
OH_Ability_OnNativeChildProcessStarted onProcessStarted);
|
||||
|
||||
/**
|
||||
* @brief The info of the file descriptors passed to child process.
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct NativeChildProcess_Fd {
|
||||
/** the key of the file descriptor. */
|
||||
char* fdName;
|
||||
|
||||
/** the value of the file descriptor. */
|
||||
int32_t fd;
|
||||
|
||||
/** the next pointer of the linked list. */
|
||||
struct NativeChildProcess_Fd* next;
|
||||
} NativeChildProcess_Fd;
|
||||
|
||||
/**
|
||||
* @brief The list of the info of the file descriptors passed to child process.
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct NativeChildProcess_FdList {
|
||||
/** the head of the list.
|
||||
* For details, see {@link NativeChildProcess_Fd}.
|
||||
*/
|
||||
struct NativeChildProcess_Fd* head;
|
||||
} NativeChildProcess_FdList;
|
||||
|
||||
/**
|
||||
* @brief Enumerates the isolation modes used by the native child process module.
|
||||
* @since 12
|
||||
*/
|
||||
typedef enum NativeChildProcess_IsolationMode {
|
||||
/**
|
||||
* Normal isolation mode, parent process shares the same sandbox or internet with the child process.
|
||||
*/
|
||||
NCP_ISOLATION_MODE_NORMAL = 0,
|
||||
|
||||
/**
|
||||
* Isolated mode, parent process does not share the same sandbox or internet with the child process.
|
||||
*/
|
||||
NCP_ISOLATION_MODE_ISOLATED = 1,
|
||||
} NativeChildProcess_IsolationMode;
|
||||
|
||||
/**
|
||||
* @brief The options used by the child process.
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct NativeChildProcess_Options {
|
||||
/** the isolation mode used by the child process.
|
||||
* For details, see {@link NativeChildProcess_IsolationMode}.
|
||||
*/
|
||||
NativeChildProcess_IsolationMode isolationMode;
|
||||
|
||||
/** reserved field for future extension purposes */
|
||||
int64_t reserved;
|
||||
} NativeChildProcess_Options;
|
||||
|
||||
/**
|
||||
* @brief The arguments passed to the child process.
|
||||
* @since 12
|
||||
*/
|
||||
typedef struct NativeChildProcess_Args {
|
||||
/** the entry parameter. */
|
||||
char* entryParams;
|
||||
|
||||
/** the list of the info of the file descriptors passed to child process.
|
||||
* For details, see {@link NativeChildProcess_FdList}.
|
||||
*/
|
||||
struct NativeChildProcess_FdList fdList;
|
||||
} NativeChildProcess_Args;
|
||||
|
||||
/**
|
||||
* @brief Starts a child process, loads the specified dynamic library file.
|
||||
*
|
||||
* @permission {@code ohos.permission.START_NATIVE_CHILD_PROCESS}
|
||||
* @param entry Name of the entry of the dynamic library file loaded in the child process. The value cannot be nullptr.
|
||||
* @param args The arguments passed to the child process.
|
||||
* For details, see {@link NativeChildProcess_Args}.
|
||||
* @param options The child process options.
|
||||
* For details, see {@link NativeChildProcess_Options}.
|
||||
* @param pid The started child process id.
|
||||
* @return Returns {@link NCP_NO_ERROR} if the call is successful.\n
|
||||
* Returns {@link NCP_ERR_NO_PERMISSION} if the operation is not permitted.
|
||||
* The permission {@code ohos.permission.START_NATIVE_CHILD_PROCESS} is needed.\n
|
||||
* Returns {@link NCP_ERR_INVALID_PARAM} if the dynamic library name or callback function pointer is invalid.\n
|
||||
* Returns {@link NCP_ERR_NOT_SUPPORTED} if the device does not support the creation of native child processes.\n
|
||||
* Returns {@link NCP_ERR_ALREADY_IN_CHILD} if it is not allowed to create another child process in the child process.\n
|
||||
* Returns {@link NCP_ERR_MAX_CHILD_PROCESSES_REACHED} if the maximum number of native child processes is reached.\n
|
||||
* For details, see {@link Ability_NativeChildProcess_ErrCode}.
|
||||
* @see OH_Ability_OnNativeChildProcessStarted
|
||||
* @since 12
|
||||
*/
|
||||
Ability_NativeChildProcess_ErrCode OH_Ability_StartNativeChildProcess(
|
||||
const char* entry, NativeChildProcess_Args args,
|
||||
NativeChildProcess_Options options, int32_t *pid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
@ -2581,6 +2581,15 @@
|
||||
"availableLevel": "system_basic",
|
||||
"provisionEnable": true,
|
||||
"distributedSceneEnable": false
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.START_NATIVE_CHILD_PROCESS",
|
||||
"grantMode": "system_grant",
|
||||
"since": 12,
|
||||
"deprecated": "",
|
||||
"availableLevel": "system_basic",
|
||||
"provisionEnable": true,
|
||||
"distributedSceneEnable": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user