[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN105786456B - A kind of method and device for realizing VxWorks task Hook Function function - Google Patents

A kind of method and device for realizing VxWorks task Hook Function function Download PDF

Info

Publication number
CN105786456B
CN105786456B CN201410808650.9A CN201410808650A CN105786456B CN 105786456 B CN105786456 B CN 105786456B CN 201410808650 A CN201410808650 A CN 201410808650A CN 105786456 B CN105786456 B CN 105786456B
Authority
CN
China
Prior art keywords
task
specified event
function
hook
linked list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410808650.9A
Other languages
Chinese (zh)
Other versions
CN105786456A (en
Inventor
李鹏
梁晖
王佩龙
赵云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Maipu Communication Technology Co Ltd
Original Assignee
Maipu Communication Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Maipu Communication Technology Co Ltd filed Critical Maipu Communication Technology Co Ltd
Priority to CN201410808650.9A priority Critical patent/CN105786456B/en
Publication of CN105786456A publication Critical patent/CN105786456A/en
Application granted granted Critical
Publication of CN105786456B publication Critical patent/CN105786456B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses a kind of method and devices for realizing VxWorks task Hook Function function, are related to field of computer technology, and the function of VxWorks task Hook Function can be realized in linux system.Concrete scheme is:Hook Function chained list is defined, Hook Function chained list includes N number of node, N >=0;As N >=1, the data field of node is stored with the mark of a specified event, the pointer of node is oriented to the call back function that specified event defines, and specified event is that when being transplanted to VxWorks task to execute on (SuSE) Linux OS, the event of designated treatment is carried out to VxWorks task;When one function of calling executes the first specified event, Hook Function chained list is traversed, is the corresponding specified event of any node in Hook Function chained list to call the call back function defined for the first specified event, the first specified event.

Description

Method and device for realizing VxWorks task hook function
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for realizing a VxWorks task hook function.
Background
Both the VxWorks operating system and the Linux operating system are embedded operating systems, but source codes of the VxWorks operating system are not disclosed, and the authorization cost of the VxWorks operating system is high; and the source code of the Linux operating system is public, and the use of the Linux operating system does not need to pay any authorization fee.
Due to the source code disclosure of the Linux operating system, the Linux operating system is used without paying any authorization fee, so that due to the cost, a plurality of real-time tasks which can be executed on the existing VxWorks operating system can be considered to be transplanted to the Linux operating system for execution.
However, the design ideas and system architectures of the VxWorks operating system and the Linux operating system are greatly different, and the Linux operating system cannot provide many functions required for processing real-time tasks on the VxWorks operating system, such as VxWorks task hook functions. Hook functions refer to a class of functions that can be dynamically embedded in source code when needed, which is equivalent to "hooking" to the source code for the operating system to call. The VxWorks task hook function mainly comprises the following steps: the method comprises a task switching hook function, a task creating hook function and a task deleting hook function. The task switching hook function can be called during task switching so as to monitor the current task switching process; the task creation hook function can be called when the task is created so as to monitor the current task creation process; the task delete hook function may be called at task delete to monitor the current task delete process.
After a real-time task running on a VxWorks operating system is transplanted to a Linux operating system, in order to monitor processes of switching, creating or deleting the VxWorks task and the like, one problem to be solved is that: how to realize the function of the VxWorks task hook function in the Linux system.
Disclosure of Invention
The embodiment of the invention provides a method and a device for realizing a VxWorks task hook function, which can realize the function of the VxWorks task hook function in a Linux system.
In order to achieve the above purpose, the embodiment of the invention adopts the following technical scheme:
the first aspect of the embodiment of the invention provides a method for realizing a VxWorks task hook function, which comprises the following steps:
defining a hook function linked list, wherein the hook function linked list comprises N nodes, and N is more than or equal to 0; when N is larger than or equal to 1, the data field of the node stores an identifier of a specified event, a pointer of the node points to a callback function defined for the specified event, and the specified event is an event for performing specified processing on a VxWorks task when the VxWorks task is transplanted to a Linux operating system for execution;
and traversing the hook function linked list to call a callback function defined for the first specified event when a function is called to execute the first specified event, wherein the first specified event is a specified event corresponding to any node in the hook function linked list.
With reference to the first aspect, in a first possible implementation manner, the method further includes:
when a hook adding function corresponding to a second specified event is called, adding an identifier of the second specified event stored in a data field into the hook function linked list, wherein a pointer points to a node of a callback function defined for the second specified event;
and when a hook deleting function corresponding to a third specified event is called, deleting a node corresponding to the third specified event from the hook function linked list, wherein the third specified event is a specified event corresponding to any node in the hook function linked list.
With reference to the first aspect, in a second possible implementation manner, the hook function linked list is a task switching hook function linked list;
the first specified event is the switching from a first VxWorks task to a second VxWorks task; or,
the first specified event is the switching of a third VxWorks task to a first Linux task; or,
and the first specified event is the switching of the second Linux task to the fourth VxWorks task.
With reference to the first aspect, in a third possible implementation manner, the hook function linked list is created for a task;
the first specified event is the creation of a first VxWorks task.
With reference to the first aspect, in a fourth possible implementation manner, the hook function linked list is a task deletion hook function linked list;
the first specified event is the deletion of a first VxWorks task.
In a second aspect of the embodiments of the present invention, an apparatus for implementing a function of a hook function of a VxWorks task is provided, including:
the chain table defining module is used for defining a hook function chain table, the hook function chain table comprises N nodes, and N is more than or equal to 0; when N is larger than or equal to 1, the data field of the node stores an identifier of a specified event, a pointer of the node points to a callback function defined for the specified event, and the specified event is an event for performing specified processing on a VxWorks task when the VxWorks task is transplanted to a Linux operating system for execution;
and the function calling module is used for traversing the hook function linked list to call a callback function defined for the first specified event when a function is called to execute the first specified event, wherein the first specified event is a specified event corresponding to any node in the hook function linked list.
With reference to the second aspect, in a first possible implementation manner, the apparatus further includes:
the node adding module is used for adding a mark of a second specified event stored in a data field into the hook function linked list when a hook adding function corresponding to the second specified event is called, and a pointer points to a node of a callback function defined for the second specified event;
and the node deleting module is used for deleting the node corresponding to the third specified event from the hook function linked list when the hook deleting function corresponding to the third specified event is called, wherein the third specified event is the specified event corresponding to any node in the hook function linked list.
With reference to the second aspect, in a second possible implementation manner, the hook function linked list is a task switching hook function linked list;
the first specified event is the switching from a first VxWorks task to a second VxWorks task; or,
the first specified event is the switching of a third VxWorks task to a first Linux task; or,
and the first specified event is the switching of the second Linux task to the fourth VxWorks task.
With reference to the second aspect, in a third possible implementation manner, the hook function linked list is created for a task;
the first specified event is the creation of a first VxWorks task.
With reference to the second aspect, in a fourth possible implementation manner, the hook function linked list is a task deletion hook function linked list;
the first specified event is the deletion of a first VxWorks task.
According to the method and the device for realizing the VxWorks task hook function, the hook function linked list is defined in the Linux system, so that the pointers of the nodes in the linked list point to the callback function defined by the specified event; when a function is called to execute a first specified event, the hook function linked list can be traversed to call a callback function defined for the first specified event. Therefore, the callback function can be called by traversing the hook function linked list so as to realize the monitoring of the first specified event, thereby realizing the function of the VxWorks task hook function in the Linux system.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flow chart of a method for implementing a VxWorks task hook function according to an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating a device for implementing a VxWorks task hook function according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of another apparatus for implementing a VxWorks task hook function according to an embodiment of the present invention;
fig. 4 is a schematic composition diagram of another apparatus for implementing a function of a hook function of a VxWorks task according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The VxWorks operating system provides task hook functions (a task switching hook function, a task creating hook function and a task deleting hook function), and when tasks are switched, created or deleted, a specific callback function can be called by calling the task hook functions so as to monitor the task switching, creating or deleting processes. However, in the Linux operating system, there is no concept of a task hook function, and after a real-time task running on the VxWorks operating system is transplanted onto the Linux operating system, in order to monitor a task switching, task creating, or task deleting process, a function of realizing the VxWorks task hook function needs to be simulated in the Linux system.
The embodiment of the invention provides a method for realizing a VxWorks task hook function, which comprises the following steps of:
and S101, defining a hook function linked list.
The hook function chain table comprises N nodes, wherein N is more than or equal to 0; when N is larger than or equal to 1, the data field of the node stores an identifier of a specified event, the pointer of the node points to a callback function defined for the specified event, and the specified event is an event for performing specified processing on the VxWorks task when the VxWorks task is transplanted to a Linux operating system for execution.
For example, the specified event may be task switch, task creation, or task deletion.
S102, when a function is called to execute a first specified event, traversing the hook function linked list to call a callback function defined for the first specified event.
The first appointed event is an appointed event corresponding to any node in the hook function linked list. For example, the first specified event may be switching from task a to task B, the first specified event may also be creating task a, and the first specified event may also be deleting task a, where task a and task B are tasks for migrating VxWorks tasks to the Linux operating system. The first specified event may be monitored by calling a callback function defined for the first specified event.
It should be noted that, when N is equal to 0, the hook function linked list is empty, and when the hook function linked list is traversed, the callback function is not executed to return directly.
The method for realizing the VxWorks task hook function provided by the embodiment of the invention defines the hook function linked list in the Linux system, so that the pointers of the nodes in the linked list point to the callback function defined by the specified event; when a function is called to execute a first specified event, the hook function linked list can be traversed to call a callback function defined for the first specified event. Therefore, the callback function can be called by traversing the hook function linked list so as to realize the monitoring of the first specified event, thereby realizing the function of the VxWorks task hook function in the Linux system.
Further, in the VxWorks system, a hook adding function and a hook deleting function are also included, and when the hook adding function or the hook deleting function is called, a corresponding function needs to be simulated and realized in the Linux system.
Wherein the hook adding function comprises: the task switching hook adding function taskswitchhookad (), the task creating hook adding function tasskcreatehookatadd () and the task deleting hook adding function tasskdeletehookad ().
The hook deletion function includes: a task switching hook deleting function taskSwitchHookDelete (), a task creating hook deleting function tasskcreatehookddelete () and a task deleting hook deleting function tasdeaddeletehookdelete ().
Specifically, the method for simulating the function of hook adding function in the Linux system includes:
when the hook adding function corresponding to the second specified event is called, the identifier of the second specified event stored in the data field is added into the hook function linked list, and the pointer points to the node of the callback function defined for the second specified event.
The second specified event may be task switching, task creating, or task deleting, for example, the second specified event may be switching from task a to task B, the second specified event may also be creating task a, and the second specified event may also be deleting task a.
The method for simulating the function of realizing the hook deleting function in the Linux system comprises the following steps:
and when the hook deleting function corresponding to the third specified event is called, deleting the node corresponding to the third specified event from the hook function linked list, wherein the third specified event is a specified event corresponding to any node in the hook function linked list.
For example, the third specified event may be switching from task a to task B, the third specified event may also be creating task a, and the third specified event may also be deleting task a.
In the embodiment of the present invention, the method in the embodiment of the present invention is described by taking functions of implementing a task switching hook function, a task creating hook function, and a task deleting hook function in VxWorks as examples.
Exemplarily, when the function of task switching hook functions is realized, the hook function linked list in S101 is the task switching hook function linked list; the first designated event in the S102 is switching from the first VxWorks task to the second VxWorks task, or the first designated event is switching from the third VxWorks task to the first Linux task, or the first designated event is switching from the second Linux task to the fourth VxWorks task. The first VxWorks task, the second VxWorks task, the third VxWorks task and the fourth VxWorks task are all tasks after real-time tasks running on the VxWorks operating system are transplanted to the Linux operating system.
It should be noted that after the task switching hook function linked list is defined, an idle task needs to be defined, the idle task does not do any work and is always in a sleep state, and only plays a role of occupying space in the processing of the task switching hook function.
The prototype of the callback function pointed by the pointer of the node in the task switching hook function linked list is as follows: voidtask switch hookcallback (structtask _ struct _ pOldTask, structtask _ struct _ pNewTask), where pOldtask points to a task structure of a task before task switching, and pNewtask points to a task structure of a task after task switching. The task structure body is used for describing various attributes of the task, such as: task identification, task name, task priority, task entry function, and the like.
When the first specified event is that the first VxWorks task is switched to the second VxWorks task, pOldTask points to a task structure of the first VxWorks task, and pNewTask points to a task structure of the second VxWorks task.
When the first specified event is that the third VxWorks task is switched to the first Linux task, pOldTask points to a task structure of the third VxWorks task, and pNewTask points to a task structure of an idle task.
When the first specified event is that the second Linux task is switched to the fourth VxWorks task, pOldTask points to a task structure of an idle task, and pNewTask points to a task structure of the fourth VxWorks task.
When the first specified event is the three conditions, when the task switching function TaskSwitch () is called, traversing the task switching hook function linked list to call the corresponding callback function, then executing the task switching, and monitoring the task switching process by calling the corresponding callback function; when the first designated event is that a certain Linux task is switched to another Linux task, the task switching is directly executed without any processing.
Assuming that a callback function needs to be added when the task C is switched to the task D (i.e., the second specified event is the switching of the task C to the task D), when the task switching hook adding function taskSwitchHookAdd () is called, a node is added to the task switching hook function linked list, the data field of the node stores the identifier of the switching of the task C to the task D, and the pointer of the node points to the callback function defined for the switching of the task C to the task D.
Assuming that a callback function needs to be deleted when the task a is switched to the task B (i.e., the third specified event is the switching of the task a to the task B), when the task switching hook deletion function taskSwitchHookDelete () is called, a node in the task switching hook function linked list is deleted, an identifier for switching the task a to the task B is stored in a data field of the node, and a pointer of the node points to the callback function defined for switching the task a to the task B.
Illustratively, when the function of creating the hook function by the task is realized, the hook function linked list in S101 creates a hook function linked list for the task; the first specified event in S102 is the creation of a first VxWorks task.
The prototype of the callback function pointed by the pointer of the node in the task creation hook function linked list is as follows: voidstask createhookcalnack (structtask _ struct) — where pTask points to a task structure of a task to be created. The task structure body is used for describing various attributes of the task, such as: task identification, task name, task priority, task entry function, and the like.
Assuming that a callback function needs to be added when creating the task C (i.e., the second specified event is to create the task C), when the task creation hook adding function tasskcreatehookakadadd () is called, a node may be added in the task creation hook function chain table, where a data field of the node stores an identifier of the creation task C, and a pointer of the node points to the callback function defined for creating the task C.
Assuming that a callback function needs to be deleted when creating the task C (i.e., the third specified event is the creation task C), when the task creation hook delete function taskCreateHookDelete () is called, a node in the task creation hook function chain table may be deleted, where a data field of the node stores an identifier of the creation task C, and a pointer of the node points to a callback function defined for the creation task C.
Illustratively, when the function of deleting the hook function by the task is realized, the hook function linked list in S101 is the task deletion hook function linked list; the first specified event in S102 is the deletion of the first VxWorks task.
The prototype of the callback function pointed by the pointer of the node in the task deletion hook function linked list is as follows: void desktop hookcallback (structtask _ struct. pTask), where pTask points to the task construct of the task to be deleted. The task structure body is used for describing various attributes of the task, such as: task identification, task name, task priority, task entry function, and the like.
If a callback function needs to be added when the task C is deleted (that is, the second specified event is the delete task C), when the task delete hook add function taskletehookadd () is called, a node may be added in the task delete hook function linked list, the data field of the node stores the identifier of the delete task C, and the pointer of the node points to the callback function defined for the delete task C.
Assuming that a callback function needs to be deleted when deleting the task C (i.e., the third specified event is creating the task C), when the task delete hook delete function taskdelethokdeleven () is called, the task delete hook create hook function linked list may be deleted, the data field of the node stores the identifier of the deleted task C, and the pointer of the node points to the callback function defined for deleting the task C.
The method for realizing the VxWorks task hook function provided by the embodiment of the invention defines the hook function linked list (comprising a task switching hook function linked list, a task creating hook function linked list and a task deleting hook function linked list) in the Linux system, so that the pointers of the nodes in the linked list point to the callback function defined by the specified event; when a function is called to execute a first specified event, the hook function linked list can be traversed to call a callback function defined for the first specified event. Therefore, the callback function can be called by traversing the hook function linked list to realize the monitoring of the first specified event (for example, the monitoring of the task switching process, the monitoring of the task creating process and the monitoring of the task deleting process), so that the function of the VxWorks task hook function is realized in the Linux system.
The embodiment of the invention provides a device for realizing a VxWorks task hook function, which is used for executing the method shown in FIG. 1, and as shown in FIG. 2, the device comprises: a linked list definition module 21 and a function call module 22.
A linked list defining module 21, configured to define a hook function linked list, where the hook function linked list includes N nodes, and N is greater than or equal to 0; when N is larger than or equal to 1, the data field of the node stores an identifier of a specified event, the pointer of the node points to a callback function defined for the specified event, and the specified event is an event for performing specified processing on the VxWorks task when the VxWorks task is transplanted to a Linux operating system for execution.
The function call module 22 traverses the hook function linked list to call a callback function defined for the first specified event when a function is called to execute the first specified event, where the first specified event is a specified event corresponding to any node in the hook function linked list.
Further, as shown in fig. 3, the apparatus further includes: a node adding module 23 and a node deleting module 24.
The node adding module 23 is configured to add, when the hook adding function corresponding to the second specified event is called, an identifier of the second specified event stored in the data field to the hook function linked list, where the pointer points to a node of the callback function defined for the second specified event.
And the node deleting module 24 is configured to delete a node corresponding to a third specified event from the hook function linked list when the hook deleting function corresponding to the third specified event is called, where the third specified event is a specified event corresponding to any node in the hook function linked list.
In a first application scenario of the embodiment of the present invention, the hook function linked list is a task switching hook function linked list.
The first specified event is that the first VxWorks task is switched to the second VxWorks task; or the first specified event is that the third VxWorks task is switched to the first Linux task; or the first specified event is the switching of the second Linux task to the fourth VxWorks task.
In a second application scenario of the embodiment of the present invention, a hook function linked list is created for a task, and a first specified event is the creation of a first VxWorks task.
In a third application scenario of the embodiment of the present invention, the hook function linked list is a task deletion hook function linked list, and the first specified event is a deletion of a first VxWorks task.
It should be noted that, for specific description of some functional modules in the apparatus for implementing the function of the VxWorks task hook function provided in the embodiment of the present invention, reference may be made to corresponding contents in the method embodiment, and details are not described here again.
According to the device for realizing the VxWorks task hook function, the hook function linked list is defined in the Linux system, so that the pointers of the nodes in the linked list point to the callback function defined by the specified event; when a function is called to execute a first specified event, the hook function linked list can be traversed to call a callback function defined for the first specified event. Therefore, the callback function can be called by traversing the hook function linked list so as to realize the monitoring of the first specified event, thereby realizing the function of the VxWorks task hook function in the Linux system.
The embodiment of the present invention further provides another apparatus for implementing a function of a VxWorks task hook, which is used to execute the method shown in fig. 1, and as shown in fig. 4, the apparatus includes: a memory 31, a processor 32 and a bus system 33.
The memory 31 and the processor 32 are coupled via a bus system 33, wherein the bus system 33 may include a power bus, a control bus, a status signal bus, etc. in addition to a data bus. For clarity of illustration, however, the various buses are labeled as bus system 33 in fig. 4.
A memory 31 for storing a set of codes.
A processor 32, configured to execute the codes stored in the memory 31, and specifically configured to perform the following operations: defining a hook function linked list, wherein the hook function linked list comprises N nodes, and N is more than or equal to 0; when N is larger than or equal to 1, the data field of the node stores an identifier of a specified event, a pointer of the node points to a callback function defined for the specified event, and the specified event is an event for performing specified processing on a VxWorks task when the VxWorks task is transplanted to a Linux operating system for execution; and traversing the hook function linked list to call a callback function defined for the first specified event when a function is called to execute the first specified event, wherein the first specified event is a specified event corresponding to any node in the hook function linked list.
Further, the processor 32 is further configured to: when the hook adding function corresponding to the second specified event is called, adding an identifier of the second specified event stored in the data field into the hook function linked list, wherein the pointer points to a node of the callback function defined for the second specified event; and when the hook deleting function corresponding to the third specified event is called, deleting the node corresponding to the third specified event from the hook function linked list, wherein the third specified event is a specified event corresponding to any node in the hook function linked list.
In a first application scenario of the embodiment of the present invention, the hook function linked list is a task switching hook function linked list. The first specified event is that the first VxWorks task is switched to the second VxWorks task; or the first specified event is that the third VxWorks task is switched to the first Linux task; or the first specified event is the switching of the second Linux task to the fourth VxWorks task.
In a second application scenario of the embodiment of the present invention, a hook function linked list is created for a task, and a first specified event is the creation of a first VxWorks task.
In a third application scenario of the embodiment of the present invention, the hook function linked list is a task deletion hook function linked list, and the first specified event is a deletion of a first VxWorks task.
It should be noted that, for specific description of some functional modules in the apparatus for implementing the function of the VxWorks task hook function provided in the embodiment of the present invention, reference may be made to corresponding contents in the method embodiment, and details are not described here again.
According to the device for realizing the VxWorks task hook function, the hook function linked list is defined in the Linux system, so that the pointers of the nodes in the linked list point to the callback function defined by the specified event; when a function is called to execute a first specified event, the hook function linked list can be traversed to call a callback function defined for the first specified event. Therefore, the callback function can be called by traversing the hook function linked list so as to realize the monitoring of the first specified event, thereby realizing the function of the VxWorks task hook function in the Linux system.
Through the above description of the embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions. For the specific working processes of the system, the apparatus and the unit described above, reference may be made to the corresponding processes in the foregoing method embodiments, and details are not described here again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (10)

1. A method for realizing VxWorks task hook function is characterized by comprising the following steps:
defining a hook function linked list, wherein the hook function linked list comprises N nodes, and N is more than or equal to 0; when N is larger than or equal to 1, the data field of the node stores an identifier of a specified event, a pointer of the node points to a callback function defined for the specified event, and the specified event is an event for performing specified processing on a VxWorks task when the VxWorks task is transplanted to a Linux operating system for execution;
when a function is called to execute a first specified event, traversing the hook function linked list to call a callback function defined for the first specified event, wherein the first specified event is a specified event corresponding to any node in the hook function linked list, and the callback function is used for monitoring the first specified event.
2. The method of claim 1, further comprising:
when a hook adding function corresponding to a second specified event is called, adding an identifier of the second specified event stored in a data field into the hook function linked list, wherein a pointer points to a node of a callback function defined for the second specified event;
and when a hook deleting function corresponding to a third specified event is called, deleting a node corresponding to the third specified event from the hook function linked list, wherein the third specified event is a specified event corresponding to any node in the hook function linked list.
3. The method of claim 1, wherein the hook function linked list is a task switch hook function linked list;
the first specified event is the switching from a first VxWorks task to a second VxWorks task; or,
the first specified event is the switching of a third VxWorks task to a first Linux task; or,
and the first specified event is the switching of the second Linux task to the fourth VxWorks task.
4. The method of claim 1, wherein the hook function linked list creates a hook function linked list for a task;
the first specified event is the creation of a first VxWorks task.
5. The method of claim 1, wherein the hook function linked list is a task delete hook function linked list;
the first specified event is the deletion of a first VxWorks task.
6. A device for realizing functions of VxWorks task hook functions is characterized by comprising the following steps:
the chain table defining module is used for defining a hook function chain table, the hook function chain table comprises N nodes, and N is more than or equal to 0; when N is larger than or equal to 1, the data field of the node stores an identifier of a specified event, a pointer of the node points to a callback function defined for the specified event, and the specified event is an event for performing specified processing on a VxWorks task when the VxWorks task is transplanted to a Linux operating system for execution;
and the function calling module is used for traversing the hook function linked list to call a callback function defined for the first specified event when a function is called to execute the first specified event, wherein the first specified event is a specified event corresponding to any node in the hook function linked list, and the callback function is used for monitoring the first specified event.
7. The apparatus of claim 6, further comprising:
the node adding module is used for adding a mark of a second specified event stored in a data field into the hook function linked list when a hook adding function corresponding to the second specified event is called, and a pointer points to a node of a callback function defined for the second specified event;
and the node deleting module is used for deleting the node corresponding to the third specified event from the hook function linked list when the hook deleting function corresponding to the third specified event is called, wherein the third specified event is the specified event corresponding to any node in the hook function linked list.
8. The apparatus of claim 6, wherein the hook function linked list is a task switch hook function linked list;
the first specified event is the switching from a first VxWorks task to a second VxWorks task; or,
the first specified event is the switching of a third VxWorks task to a first Linux task; or,
and the first specified event is the switching of the second Linux task to the fourth VxWorks task.
9. The apparatus of claim 6, wherein the hook function chain table creates a hook function chain table for a task;
the first specified event is the creation of a first VxWorks task.
10. The apparatus of claim 6, wherein the hook function linked list is a task delete hook function linked list;
the first specified event is the deletion of a first VxWorks task.
CN201410808650.9A 2014-12-22 2014-12-22 A kind of method and device for realizing VxWorks task Hook Function function Active CN105786456B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410808650.9A CN105786456B (en) 2014-12-22 2014-12-22 A kind of method and device for realizing VxWorks task Hook Function function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410808650.9A CN105786456B (en) 2014-12-22 2014-12-22 A kind of method and device for realizing VxWorks task Hook Function function

Publications (2)

Publication Number Publication Date
CN105786456A CN105786456A (en) 2016-07-20
CN105786456B true CN105786456B (en) 2018-10-12

Family

ID=56386485

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410808650.9A Active CN105786456B (en) 2014-12-22 2014-12-22 A kind of method and device for realizing VxWorks task Hook Function function

Country Status (1)

Country Link
CN (1) CN105786456B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107766351B (en) * 2016-08-16 2020-12-25 腾讯科技(深圳)有限公司 File directory identification method and device
CN109522144A (en) * 2018-11-13 2019-03-26 天津津航计算技术研究所 The Fault Locating Method of software crash under VxWorks system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101414341A (en) * 2007-10-15 2009-04-22 北京瑞星国际软件有限公司 Software self-protection method
CN101894045A (en) * 2010-06-18 2010-11-24 阳坚 Real-time Linux operating system
CN103744772A (en) * 2014-01-28 2014-04-23 北京经纬恒润科技有限公司 Method and system for detecting task running performance

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7237123B2 (en) * 2000-09-22 2007-06-26 Ecd Systems, Inc. Systems and methods for preventing unauthorized use of digital content

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101414341A (en) * 2007-10-15 2009-04-22 北京瑞星国际软件有限公司 Software self-protection method
CN101894045A (en) * 2010-06-18 2010-11-24 阳坚 Real-time Linux operating system
CN103744772A (en) * 2014-01-28 2014-04-23 北京经纬恒润科技有限公司 Method and system for detecting task running performance

Also Published As

Publication number Publication date
CN105786456A (en) 2016-07-20

Similar Documents

Publication Publication Date Title
CN109634728B (en) Job scheduling method and device, terminal equipment and readable storage medium
CN108268331B (en) Virtual machine system
US20170318091A1 (en) System, device and process for dynamic tenant structure adjustment in a distributed resource management system
US20130262250A1 (en) Allocation of Application Licenses within Cloud or Infrastructure
JP6481415B2 (en) Data storage management device and data storage management method
CN105429776A (en) Method and system for virtual network function management
JP2017530453A (en) Equal sharing of system resources in workflow execution
CN110162344B (en) Isolation current limiting method and device, computer equipment and readable storage medium
EP3680775A1 (en) Managing metadata for a distributed processing system
US10664376B2 (en) Hierarchical process group management
CN105786456B (en) A kind of method and device for realizing VxWorks task Hook Function function
CN113342554B (en) IO multiplexing method, medium, device and operating system
CN111782210A (en) Page management method and device, electronic equipment and computer readable medium
US10061676B2 (en) Remotely located timing method and device for a processing unit in an information processing system
CN110908644B (en) Configuration method and device of state node, computer equipment and storage medium
CN112817992A (en) Method, device, electronic equipment and readable storage medium for executing change task
CN107346217A (en) A kind of cloud hard disk management method, cloud computing management platform and virtual platform
CN113127187B (en) Method and device for cluster expansion and contraction capacity
CN110879701A (en) Workflow visualization configuration method, server, system and medium
JP2023065558A (en) Method of responding to operation, apparatus of responding to operation, electronic device, and storage medium
CN109857720B (en) Database table monitoring method, device, computer device and readable storage medium
CN114675954A (en) Task scheduling method and device
CN112764729A (en) Application software development method and device, computer equipment and readable storage medium
CN108566293B (en) Electronic device, zk node information notification method, and storage medium
Song et al. Agent UML sequence diagram and meta-model

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant