op_pro_self()

摘要

获取当前正在执行的进程的过程句柄。

语法

op_pro_self ()
参数 类型 说明
无参数

返回类型

Prohandle

当前正在执行的进程的过程句柄。该句柄可用于其他内核过程的调用,以执行与该进程相关的操作。

示例

/* Get the pointer to the module wide variables. */
mod_vars = (TP_Global_State *) op_pro_modmem_access ();

/* Obtain a process handle for the current session process. */
local_process_handle = op_pro_self ();

/* Register new process in module-wide data structure and initialize */
/* parent-to-child communication memory.                             */
tp_sess_init (sess_config_ptr, mod_vars, op_pro_id (local_process_handle);

详情

当前执行的进程常常需要把自身的句柄作为 Process 包和 Interrupt 包中其他内核过程的参数。例如,该句柄可作为获取父进程句柄的参照点。其他典型用途包括获取进程的唯一 id,以及让进程在不再有用时销毁自身。

用途

为调用该内核过程的进程提供过程句柄。该句柄是 Process 包和 Interrupt 包中许多其他内核过程的必需参数。

错误

  • 程序中止:内核过程需要进程上下文。

参考

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com