ohos-abilitykit-sys 0.1.5

Bindings to the Abilitykit of OpenHarmony
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
// automatically generated by rust-bindgen 0.71.1

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use ohos_sys_opaque_types::OHIPCRemoteProxy;

pub type Ability_NativeChildProcessResult = Result<(), Ability_NativeChildProcessErrorCode>;
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
impl Ability_NativeChildProcessErrorCode {
    /// Invalid parameter.
    pub const INVALID_PARAM: Ability_NativeChildProcessErrorCode =
        Ability_NativeChildProcessErrorCode(const { core::num::NonZero::new(401).unwrap() });
    /// Creating a native child process is not supported.
    pub const NOT_SUPPORTED: Ability_NativeChildProcessErrorCode =
        Ability_NativeChildProcessErrorCode(const { core::num::NonZero::new(801).unwrap() });
    /// Internal error.
    pub const INTERNAL: Ability_NativeChildProcessErrorCode =
        Ability_NativeChildProcessErrorCode(const { core::num::NonZero::new(16000050).unwrap() });
    /// A new child process cannot be created during the startup of another native child process.
    /// You can try again after the child process is started.
    pub const BUSY: Ability_NativeChildProcessErrorCode =
        Ability_NativeChildProcessErrorCode(const { core::num::NonZero::new(16010001).unwrap() });
    /// Starting the native child process times out.
    pub const TIMEOUT: Ability_NativeChildProcessErrorCode =
        Ability_NativeChildProcessErrorCode(const { core::num::NonZero::new(16010002).unwrap() });
    /// Server error.
    pub const SERVICE_ERROR: Ability_NativeChildProcessErrorCode =
        Ability_NativeChildProcessErrorCode(const { core::num::NonZero::new(16010003).unwrap() });
    /// The multi-process mode is disabled. A child process cannot be started.
    pub const MULTI_PROCESS_DISABLED: Ability_NativeChildProcessErrorCode =
        Ability_NativeChildProcessErrorCode(const { core::num::NonZero::new(16010004).unwrap() });
    /// A process cannot be created in a child process.
    pub const ALREADY_IN_CHILD: Ability_NativeChildProcessErrorCode =
        Ability_NativeChildProcessErrorCode(const { core::num::NonZero::new(16010005).unwrap() });
    /// The number of native child processes reaches the maximum.
    pub const MAX_CHILD_PROCESSES_REACHED: Ability_NativeChildProcessErrorCode =
        Ability_NativeChildProcessErrorCode(const { core::num::NonZero::new(16010006).unwrap() });
    /// The child process fails to load the dynamic library because the file does not exist
    /// or the corresponding method is not implemented or exported.
    pub const LIB_LOADING_FAILED: Ability_NativeChildProcessErrorCode =
        Ability_NativeChildProcessErrorCode(const { core::num::NonZero::new(16010007).unwrap() });
    /// The child process fails to call the OnConnect method of the dynamic library.
    /// An invalid IPC object pointer may be returned.
    pub const CONNECTION_FAILED: Ability_NativeChildProcessErrorCode =
        Ability_NativeChildProcessErrorCode(const { core::num::NonZero::new(16010008).unwrap() });
    /// The callback does not exist; it may not have been registered or has already been unregistered.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub const CALLBACK_NOT_EXIST: Ability_NativeChildProcessErrorCode =
        Ability_NativeChildProcessErrorCode(const { core::num::NonZero::new(16010009).unwrap() });
}
#[repr(transparent)]
/// Enumerates the error codes used by the native child process module.
///
/// Available since API-level: 12
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Ability_NativeChildProcessErrorCode(pub core::num::NonZero<::core::ffi::c_uint>);
#[cfg(feature = "api-13")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
impl NativeChildProcess_IsolationMode {
    /// Normal isolation mode, parent process shares the same sandbox or internet with the child process.
    pub const NCP_ISOLATION_MODE_NORMAL: NativeChildProcess_IsolationMode =
        NativeChildProcess_IsolationMode(0);
    /// Isolated mode, parent process does not share the same sandbox or internet with the child process.
    pub const NCP_ISOLATION_MODE_ISOLATED: NativeChildProcess_IsolationMode =
        NativeChildProcess_IsolationMode(1);
}
#[repr(transparent)]
/// Enumerates the isolation modes used by the native child process module.
///
/// Available since API-level: 13
#[cfg(feature = "api-13")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct NativeChildProcess_IsolationMode(pub ::core::ffi::c_uint);
/// Defines a struct for the child process configs.
///
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
#[repr(C)]
pub struct Ability_ChildProcessConfigs {
    _unused: [u8; 0],
}
/// Defines a callback function for notifying the child process startup result.
///
/// # Arguments
///
/// * `errCode` - Error code corresponding to the callback function. The following values are available:
/// [`NCP_NO_ERROR`] if the child process is created successfully.
///
/// [`NCP_ERR_LIB_LOADING_FAILED`] if loading the dynamic library file fails or the necessary export function
/// is not implemented in the dynamic library.
///
/// [`NCP_ERR_CONNECTION_FAILED`] if the OnConnect method implemented in the dynamic library does not return
/// a valid IPC stub pointer.
///
/// For details, see [`Ability_NativeChildProcess_ErrCode`].
///
/// * `remoteProxy` - Pointer to the IPC object of the child process. If an exception occurs, the value may be nullptr.
/// The object must be released by calling [`OH_IPCRemoteProxy_Destory`] when it is no longer needed.
/// [`OH_Ability_CreateNativeChildProcess`] [`OH_IPCRemoteProxy_Destory`]
/// Available since API-level: 12
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub type OH_Ability_OnNativeChildProcessStarted = ::core::option::Option<
    unsafe extern "C" fn(errCode: ::core::ffi::c_int, remoteProxy: *mut OHIPCRemoteProxy),
>;
/// The info of the file descriptors passed to child process.
///
/// Available since API-level: 13
#[cfg(feature = "api-13")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NativeChildProcess_Fd {
    /// the key of the file descriptor.
    pub fdName: *mut ::core::ffi::c_char,
    /// the value of the file descriptor.
    pub fd: i32,
    /// the next pointer of the linked list.
    pub next: *mut NativeChildProcess_Fd,
}
/// The list of the info of the file descriptors passed to child process.
///
/// Available since API-level: 13
#[cfg(feature = "api-13")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NativeChildProcess_FdList {
    /// the head of the list.
    /// For details, see [`NativeChildProcess_Fd`].
    pub head: *mut NativeChildProcess_Fd,
}
/// The options used by the child process.
///
/// Available since API-level: 13
#[cfg(feature = "api-13")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NativeChildProcess_Options {
    /// the isolation mode used by the child process.
    /// For details, see [`NativeChildProcess_IsolationMode`].
    pub isolationMode: NativeChildProcess_IsolationMode,
    /// reserved field for future extension purposes
    pub reserved: i64,
}
/// The arguments passed to the child process.
///
/// Available since API-level: 13
#[cfg(feature = "api-13")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NativeChildProcess_Args {
    /// the entry parameter.
    pub entryParams: *mut ::core::ffi::c_char,
    /// the list of the info of the file descriptors passed to child process.
    /// For details, see [`NativeChildProcess_FdList`].
    pub fdList: NativeChildProcess_FdList,
}
/// Defines a callback function to handle the exit of a native child process.
///
/// # Arguments
///
/// * `pid` - The pid of the exited native child process.
///
/// * `signal` - The signal of the exited native child process.
///
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub type OH_Ability_OnNativeChildProcessExit =
    ::core::option::Option<unsafe extern "C" fn(pid: i32, signal: i32)>;
extern "C" {
    /// Creates a new child process configs object.
    /// The caller is responsible for destroying the returned object by calling
    /// [`OH_Ability_DestroyChildProcessConfigs`] to avoid memory leaks.
    ///
    /// # Returns
    ///
    /// * Returns a pointer to the newly created [`Ability_ChildProcessConfigs`] object if successful.
    /// Returns nullptr if an internal error occurs or memory allocation fails.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Ability_CreateChildProcessConfigs() -> *mut Ability_ChildProcessConfigs;
    /// Destroys a child process configs object and releases associated resources.
    ///
    /// # Arguments
    ///
    /// * `configs` - Pointer to the child process configs object to be destroyed.
    /// After this call, the pointer becomes invalid and must not be used.
    /// Passing nullptr is allowed and will be ignored.
    ///
    /// # Returns
    ///
    /// * Returns [`NCP_NO_ERROR`] if the operation is successful or if the input is nullptr.
    /// Returns [`NCP_ERR_INVALID_PARAM`] if the input parameters are invalid.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Ability_DestroyChildProcessConfigs(
        configs: *mut Ability_ChildProcessConfigs,
    ) -> Ability_NativeChildProcessResult;
    /// Sets the isolation mode for the specified child process configs.
    ///
    /// # Arguments
    ///
    /// * `configs` - Pointer to the child process configs object. Must not be nullptr.
    ///
    /// * `isolationMode` - The isolation mode to set. See [`NativeChildProcess_IsolationMode`] for details.
    ///
    /// # Returns
    ///
    /// * Returns [`NCP_NO_ERROR`] if the isolation mode is set successfully.
    /// Returns [`NCP_ERR_INVALID_PARAM`] if the input parameters are invalid.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Ability_ChildProcessConfigs_SetIsolationMode(
        configs: *mut Ability_ChildProcessConfigs,
        isolationMode: NativeChildProcess_IsolationMode,
    ) -> Ability_NativeChildProcessResult;
    /// Sets the UID isolation flag for the specified child process configs.
    /// The isolationUid only takes effect when [`OH_Ability_ChildProcessConfigs_SetIsolationMode`]
    /// is set to [`NCP_ISOLATION_MODE_ISOLATED`].
    ///
    /// # Arguments
    ///
    /// * `configs` - Pointer to the child process configs object. Must not be nullptr.
    ///
    /// * `isolationUid` - The UID isolation setting to apply.
    /// - true: uses independent UID
    /// - false: uses parent process's UID
    ///
    /// # Returns
    ///
    /// * Returns [`NCP_NO_ERROR`] if the UID isolation flag is set successfully.
    /// Returns [`NCP_ERR_INVALID_PARAM`] if the input parameters are invalid.
    ///
    /// Available since API-level: 21
    #[cfg(feature = "api-21")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-21")))]
    pub fn OH_Ability_ChildProcessConfigs_SetIsolationUid(
        configs: *mut Ability_ChildProcessConfigs,
        isolationUid: bool,
    ) -> Ability_NativeChildProcessResult;
    /// Sets the process name for the specified child process configs.
    ///
    /// # Arguments
    ///
    /// * `configs` - Pointer to the child process configs object. Must not be nullptr.
    ///
    /// * `processName` - The process name to set.
    /// Must be a non-empty string containing only letters, digits, or underscores.
    /// Maximum length is 64 characters.
    /// The name ultimately assigned to the process is {bundleName}:{processName}.
    ///
    /// # Returns
    ///
    /// * Returns [`NCP_NO_ERROR`] if the process name is set successfully.
    /// Returns [`NCP_ERR_INVALID_PARAM`] if the input parameters are invalid.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Ability_ChildProcessConfigs_SetProcessName(
        configs: *mut Ability_ChildProcessConfigs,
        processName: *const ::core::ffi::c_char,
    ) -> Ability_NativeChildProcessResult;
    /// Creates a child process, loads the specified dynamic library file, and returns the startup result
    /// asynchronously through a callback parameter.
    /// The callback notification is an independent thread. When implementing the callback function,
    /// pay attention to thread synchronization and do not perform time-consuming operations to avoid long-time blocking.
    ///
    /// The dynamic library specified must implement and export the following functions:
    ///
    /// 1. OHIPCRemoteStub* NativeChildProcess_OnConnect()
    ///
    /// 2. void NativeChildProcess_MainProc()
    ///
    ///
    /// The processing logic sequence is shown in the following pseudocode:
    ///
    /// Main process:
    ///
    /// 1. OH_Ability_CreateNativeChildProcess(libName, onProcessStartedCallback)
    ///
    /// Child process:
    ///
    /// 2. dlopen(libName)
    ///
    /// 3. dlsym("NativeChildProcess_OnConnect")
    ///
    /// 4. dlsym("NativeChildProcess_MainProc")
    ///
    /// 5. ipcRemote = NativeChildProcess_OnConnect()
    ///
    /// 6. NativeChildProcess_MainProc()
    ///
    /// Main process:
    ///
    /// 7. onProcessStartedCallback(ipcRemote, errCode)
    ///
    /// Child process:
    ///
    /// 8. The child process exits after the NativeChildProcess_MainProc() function is returned.
    ///
    ///
    /// # Arguments
    ///
    /// * `libName` - Name of the dynamic library file loaded in the child process. The value cannot be nullptr.
    ///
    /// * `onProcessStarted` - Pointer to the callback function for notifying the child process startup result.
    /// The value cannot be nullptr. For details, see [`OH_Ability_OnNativeChildProcessStarted`].
    ///
    /// # Returns
    ///
    /// * Returns [`NCP_NO_ERROR`] if the call is successful, but the actual startup result is notified by the
    /// callback function.
    ///
    /// Returns [`NCP_ERR_INVALID_PARAM`] if the dynamic library name or callback function pointer is invalid.
    ///
    /// Returns [`NCP_ERR_NOT_SUPPORTED`] if the device does not support the creation of native child processes.
    ///
    /// Returns [`NCP_ERR_MULTI_PROCESS_DISABLED`] if the multi-process mode is disabled on the device.
    ///
    /// Returns [`NCP_ERR_ALREADY_IN_CHILD`] if it is not allowed to create another child process in the child process.
    ///
    /// Returns [`NCP_ERR_MAX_CHILD_PROCESSES_REACHED`] if the maximum number of native child processes is reached.
    ///
    /// For details, see [`Ability_NativeChildProcess_ErrCode`].
    /// [`OH_Ability_OnNativeChildProcessStarted`]
    /// Available since API-level: 12
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_Ability_CreateNativeChildProcess(
        libName: *const ::core::ffi::c_char,
        onProcessStarted: OH_Ability_OnNativeChildProcessStarted,
    ) -> ::core::ffi::c_int;
    /// Creates a child process, loads the specified dynamic library file, and returns the startup result
    /// asynchronously through a callback parameter.
    /// The callback notification is an independent thread. When implementing the callback function,
    /// pay attention to thread synchronization and do not perform time-consuming operations to avoid long-time blocking.
    ///
    /// The dynamic library specified must implement and export the following functions:
    /// 1. OHIPCRemoteStub* NativeChildProcess_OnConnect()
    /// 2. void NativeChildProcess_MainProc()
    ///
    /// The processing logic sequence is shown in the following pseudocode:
    /// Main process:
    /// 1. OH_Ability_CreateNativeChildProcessWithConfigs(libName, configs, onProcessStartedCallback)
    /// Child process:
    /// 2. dlopen(libName)
    /// 3. dlsym("NativeChildProcess_OnConnect")
    /// 4. dlsym("NativeChildProcess_MainProc")
    /// 5. ipcRemote = NativeChildProcess_OnConnect()
    /// 6. NativeChildProcess_MainProc()
    /// Main process:
    /// 7. onProcessStartedCallback(ipcRemote, errCode)
    /// Child process:
    /// 8. The child process exits after the NativeChildProcess_MainProc() function is returned.
    ///
    /// # Arguments
    ///
    /// * `libName` - Name of the dynamic library file loaded in the child process. The value cannot be nullptr.
    ///
    /// * `configs` - Pointer to the child process configs object. The value cannot be nullptr.
    ///
    /// * `onProcessStarted` - Pointer to the callback function for notifying the child process startup result.
    /// The value cannot be nullptr. For details, see [`OH_Ability_OnNativeChildProcessStarted`].
    ///
    /// # Returns
    ///
    /// * Returns [`NCP_NO_ERROR`] if the call is successful, but the actual startup result is notified by the
    /// callback function.
    /// Returns [`NCP_ERR_INVALID_PARAM`] if the dynamic library name or callback function pointer is invalid.
    /// Returns [`NCP_ERR_NOT_SUPPORTED`] if the device does not support the creation of native child processes.
    /// Returns [`NCP_ERR_MULTI_PROCESS_DISABLED`] if the multi-process mode is disabled on the device.
    /// Returns [`NCP_ERR_ALREADY_IN_CHILD`] if it is not allowed to create another child process in the child process.
    /// Returns [`NCP_ERR_MAX_CHILD_PROCESSES_REACHED`] if the maximum number of native child processes is reached.
    /// For details, see [`Ability_NativeChildProcess_ErrCode`].
    /// [`OH_Ability_OnNativeChildProcessStarted`]
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Ability_CreateNativeChildProcessWithConfigs(
        libName: *const ::core::ffi::c_char,
        configs: *mut Ability_ChildProcessConfigs,
        onProcessStarted: OH_Ability_OnNativeChildProcessStarted,
    ) -> Ability_NativeChildProcessResult;
    /// Starts a child process, loads the specified dynamic library file.
    ///
    /// The dynamic library specified must implement a function with NativeChildProcess_Args as a
    /// pamameter(function name can be customized), and export the function, such as:
    ///
    /// 1. void Main(NativeChildProcess_Args args);
    ///
    /// The processing logic sequence is shown in the following pseudocode:
    ///
    /// Main process:
    ///
    /// 1. OH_Ability_StartNativeChildProcess(entryPoint, args, options)
    ///
    /// Child process:
    ///
    /// 2. dlopen(libName)
    ///
    /// 3. dlsym("Main")
    ///
    /// 4. Main(args)
    ///
    /// 5. The child process exits after the Main(args) function is returned
    ///
    ///
    /// # Arguments
    ///
    /// * `entry` - Dynamic library and entry function loaded in child process, such as "libEntry.so:Main".
    /// The value cannot be nullptr.
    ///
    /// * `args` - The arguments passed to the child process.
    /// For details, see [`NativeChildProcess_Args`].
    ///
    /// * `options` - The child process options.
    /// For details, see [`NativeChildProcess_Options`].
    ///
    /// * `pid` - The started child process id.
    ///
    /// # Returns
    ///
    /// * Returns [`NCP_NO_ERROR`] if the call is successful.
    ///
    /// Returns [`NCP_ERR_INVALID_PARAM`] if the dynamic library name or callback function pointer is invalid.
    ///
    /// Returns [`NCP_ERR_NOT_SUPPORTED`] if the device does not support the creation of native child processes.
    ///
    /// Returns [`NCP_ERR_ALREADY_IN_CHILD`] if it is not allowed to create another child process in the child process.
    ///
    /// Returns [`NCP_ERR_MAX_CHILD_PROCESSES_REACHED`] if the maximum number of native child processes is reached.
    ///
    /// For details, see [`Ability_NativeChildProcess_ErrCode`].
    /// [`OH_Ability_OnNativeChildProcessStarted`]
    /// Available since API-level: 13
    #[cfg(feature = "api-13")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
    pub fn OH_Ability_StartNativeChildProcess(
        entry: *const ::core::ffi::c_char,
        args: NativeChildProcess_Args,
        options: NativeChildProcess_Options,
        pid: *mut i32,
    ) -> Ability_NativeChildProcessResult;
    /// Starts a child process, loads the specified dynamic library file.
    ///
    /// The dynamic library specified must implement a function with NativeChildProcess_Args as a
    /// pamameter(function name can be customized), and export the function, such as:
    /// 1. void Main(NativeChildProcess_Args args);
    ///
    /// The processing logic sequence is shown in the following pseudocode:
    /// Main process:
    /// 1. OH_Ability_StartNativeChildProcessWithConfigs(entryPoint, args, configs, &pid)
    /// Child process:
    /// 2. dlopen(libName)
    /// 3. dlsym("Main")
    /// 4. Main(args)
    /// 5. The child process exits after the Main(args) function is returned
    ///
    /// # Arguments
    ///
    /// * `entry` - Dynamic library and entry function loaded in child process, such as "libEntry.so:Main".
    /// The value cannot be nullptr.
    ///
    /// * `args` - The arguments passed to the child process.
    /// For details, see [`NativeChildProcess_Args`].
    ///
    /// * `configs` - Pointer to the child process configs object. The value cannot be null.
    /// For details, see [`Ability_ChildProcessConfigs`].
    ///
    /// * `pid` - The started child process id.
    ///
    /// # Returns
    ///
    /// * Returns [`NCP_NO_ERROR`] if the call is successful.
    /// Returns [`NCP_ERR_INVALID_PARAM`] if the dynamic library name or callback function pointer is invalid.
    /// Returns [`NCP_ERR_NOT_SUPPORTED`] if the device does not support the creation of native child processes.
    /// Returns [`NCP_ERR_ALREADY_IN_CHILD`] if it is not allowed to create another child process in the child process.
    /// Returns [`NCP_ERR_MAX_CHILD_PROCESSES_REACHED`] if the maximum number of native child processes is reached.
    /// For details, see [`Ability_NativeChildProcess_ErrCode`].
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Ability_StartNativeChildProcessWithConfigs(
        entry: *const ::core::ffi::c_char,
        args: NativeChildProcess_Args,
        configs: *mut Ability_ChildProcessConfigs,
        pid: *mut i32,
    ) -> Ability_NativeChildProcessResult;
    /// Child process get self NativeChildProcess_Args.
    ///
    ///
    /// # Returns
    ///
    /// * Returns a pointer to the arguments passed to current child process.
    ///
    /// For details, see [`NativeChildProcess_Args`].
    ///
    /// Available since API-level: 17
    #[cfg(feature = "api-17")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-17")))]
    pub fn OH_Ability_GetCurrentChildProcessArgs() -> *mut NativeChildProcess_Args;
    /// Register a native child process exit callback.
    /// Registering the same callback repeatedly will only keep one.
    ///
    /// # Arguments
    ///
    /// * `onProcessExit` - Pointer to the callback function to handle the exit of a native child process.
    /// For details, see [`OH_Ability_OnNativeChildProcessExit`].
    ///
    /// # Returns
    ///
    /// * Returns [`NCP_NO_ERROR`] if the call is successful.
    /// Returns [`NCP_ERR_INTERNAL`] if internal error occurs.
    /// For details, see [`Ability_NativeChildProcess_ErrCode`].
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Ability_RegisterNativeChildProcessExitCallback(
        onProcessExit: OH_Ability_OnNativeChildProcessExit,
    ) -> Ability_NativeChildProcessResult;
    /// Unregister a native child process exit callback.
    ///
    /// # Arguments
    ///
    /// * `onProcessExit` - Pointer to the callback function to handle the exit of a native child process.
    /// For details, see [`OH_Ability_OnNativeChildProcessExit`].
    ///
    /// # Returns
    ///
    /// * Returns [`NCP_NO_ERROR`] if the call is successful.
    /// Returns [`NCP_ERR_INTERNAL`] if internal error occurs.
    /// Returns [`NCP_ERR_CALLBACK_NOT_EXIST`] if the callback is not exist.
    /// For details, see [`Ability_NativeChildProcess_ErrCode`].
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Ability_UnregisterNativeChildProcessExitCallback(
        onProcessExit: OH_Ability_OnNativeChildProcessExit,
    ) -> Ability_NativeChildProcessResult;
}