An embedded system under the support of copy and cascade nesting epoll simulation method

By implementing epoll character device drivers and interfaces in both kernel and user modes of embedded systems, the problem of embedded systems being unable to copy and cascade nested epoll is solved. This achieves compatibility with Linux epoll and complex I/O management capabilities, thereby improving the software ecosystem and application scenarios of embedded devices.

CN120066701BActive Publication Date: 2025-12-19JIANGSU AUTOMATION RESEARCH INSTITUTE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411984515.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-12-19
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

Embedded systems such as DeltaOS and ACoreOS, which are similar to VxWorks operating systems, cannot effectively support the copying and cascading nested epoll functionality. This results in the inability to efficiently manage timer files, signal files, domain sockets, and input device file descriptors, and makes them incompatible with modern epoll multiplexed I/O systems.

Method used

Install the epoll character device driver in the kernel mode of the embedded system, implement the epollFdOpen, epollFdClose and epollFdIoctl control interfaces, and create an epoll instance in user mode. Implement copy and cascading nesting functions through the epoll_create, epoll_ctl and epoll_wait interfaces, and convert them into select system calls for multiplexing I/O.

Benefits of technology

It implements a compatible interface between embedded systems and Linux epoll, supports the replication and cascading monitoring of epoll file descriptors, improves the software ecosystem and device application flexibility of embedded systems, and can manage complex multi-channel I/O multiplexing scenarios such as the Wayland graphics system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066701B_ABST
    Figure CN120066701B_ABST
Patent Text Reader

Abstract

The application discloses an embedded system supporting copy and cascade nesting of an epoll simulation method, which is compatible with the standard interface of an epoll resource device creation, control and event waiting in a user state by using a native multi-channel I / O multiplexing interface select function of an embedded system, and the interface character device driver interface of the epoll device creation, opening, control and closing is designed in a kernel state, all file descriptors and corresponding epoll events of a user state epoll instance are saved to the kernel state through a control interface, so that the copied epoll copies can be cascaded to other epoll instances to perform listening. The application realizes the interface compatible with Linux epoll of the embedded system, effectively supports and satisfies the IO multiplexing ability requirement of the Wayland graphics system on the network domain socket, the signalfd signal file, the timerfd timer file and the evdevfd input device file classification management and cascade listening, and can promote the embedded system software ecology and the expansion of embedded device application scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of IO multiplexing simulation, in particular to an epoll simulation method supporting duplication and cascade nesting under an embedded system. BACKGROUND

[0002] The select, poll and epoll mechanisms of I / O multiplexing and event listening are provided under the Linux type operating system to meet the needs of different I / O input and output application scenarios. However, for the DeltaOS system, the ACoreOS system and other VxWorks type embedded real-time operating systems, the original system only provides the select mechanism, and for most complex software systems based on the epoll type I / O multiplexing, such as the Weston window management system based on the Wayland graphic service protocol, the select mechanism cannot support the implementation of advanced nested classification management and dup duplication listening functions for various file descriptors such as the timer file timerfd, the signal file signalfd, the domain socket and the input device file evdevfd. For the embedded scenario, the performance of the select mechanism can basically meet most needs, and therefore, an epoll interface library supporting duplication and cascade nesting can be simulated based on the original select interface of such a system. SUMMARY

[0003] The present application aims to provide an epoll simulation method supporting duplication and cascade nesting under an embedded system, which realizes the interface compatible with the Linux epoll of the embedded system and provides the realizability for enriching the embedded system software ecology and expanding the embedded device application scenarios.

[0004] In order to achieve the purpose of the present application, the present application provides an epoll simulation method supporting duplication and cascade nesting under an embedded system, comprising the following steps:

[0005] Step 1, installing an epoll character type device driver in the kernel state of the embedded operating system, opening the epollFdOpen, closing the epollFdClose, controlling the bottom interface function pointer of the epollFdIoctl, registering to the system driver layer through the system standard driver installation interface, and installing the character device with the name like / epollfd to the I / O layer through the system standard character device interface;

[0006] Step 2, complete the kernel state of the epollFdOpen opening, epollFdClose closing, epollFdIoctl control bottom interface function, and complete the management of the file fd handle, the management, release and control of the epoll event information resource of the epoll fd management;

[0007] Step 3, complete the user state of the epoll instance creation interface epoll_create, open the open system call / epollfd character device, complete the resource application in the kernel state, and save the file descriptor information obtained in the user state resource information table in the user state;

[0008] Step 4, implement the user state epoll instance control interface epoll_ctl, classify processing according to the incoming operation command, and implement three types of standard control respectively: including EPOLL_CTL_ADD adding a monitored file descriptor, EPOLL_CTL_DEL deleting a file descriptor no longer monitored, and EPOLL_CTL_MOD modifying the event required to monitor the specified file descriptor;

[0009] Step 5, implement the upper half of the user state epoll_wait instance waiting event interface: recursively collect all file descriptors to be monitored, and convert the file descriptor set corresponding to the select standard system call according to the file descriptor associated event type; according to the timeout value of the epoll_wait, start the select call to execute the multi-way I / O multiplexing;

[0010] Step 6, implement the lower half of the user state epoll_wait waiting event interface: when the select returns successfully, judge which file descriptor produces I / O event by operating system FD_ISSET standard macro one by one; for the event produced by the file descriptor under the nested epoll instance copy, when the number of files with events is counted and the event information of all file descriptors with events is filled, return to the caller.

[0011] An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the above-mentioned embedded system supporting replication and cascading nested epoll simulation method when executing the program.

[0012] A non-transitory computer readable storage medium, characterized in that the non-transitory computer readable storage medium stores computer instructions for causing the computer to execute the above-mentioned embedded system supporting replication and cascading nested epoll simulation method.

[0013] The computer program product comprises computer program instructions, and when the computer program instructions are executed on a computer, the computer is caused to execute the embedded system supporting replication and cascade nesting of an epoll simulation method.

[0014] Compared with the prior art, the significant progress of the present application is that the present application enables the mainstream embedded system platform to have an interface library compatible with the Linux platform epoll, and can completely support the function of monitoring after the epoll fd is duplicated, and also synchronously supports the function of adding one epoll fd to another epoll fd for nested monitoring, forms a basic environment of the epoll I / O multiplexing technology, and based on the basic environment, more software functions can be realized under such an operating system, for example, the Wayland new type graphic system can realize the multi-I / O multiplexing monitoring capability of network domain sockets, signal signals, timer timers, and evdev input devices, and can be classified and managed, improves flexibility, and can produce a good promoting effect on enriching the embedded system software ecology and expanding the embedded device application scenarios.

[0015] To more clearly illustrate the functional characteristics and structural parameters of the present application, the following further describes the present application in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF DRAWINGS

[0016] The accompanying drawings, which are included to provide a further understanding of the present application, constitute a part of this application, and the illustrative embodiments of the present application and their description serve to explain the present application, and do not limit the present application in any manner. In the drawings:

[0017] Figure 1 is an embedded system supporting replication and cascade nesting of an epoll simulation architecture of the present application;

[0018] Figure 2 is a flowchart of creating an epoll device resource (epoll_create) of the present application;

[0019] Figure 3 is a judgment whether an fd is opened by an epoll device driver of the present application;

[0020] Figure 4 is a flowchart of controlling an epoll device (epoll_ctl) of the present application;

[0021] Figure 5 is a flowchart of waiting for an epoll event (epoll_wait) under a cascade nesting condition of the present application;

[0022] Figure 6is a running result diagram of the epoll instance copy cascaded nested passing event of the present application. DETAILED DESCRIPTION

[0023] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.

[0024] The present application is an embedded system supporting copy and cascaded nested epoll simulation method, combining Figure 1 , comprising the following steps:

[0025] Step 1, install the epoll character device driver in the embedded operating system kernel state, open the epollFdOpen, close the epollFdClose, control the bottom interface function pointer of the epollFdIoctl, register to the system driver layer through the system standard driver installation interface, and install the globally unique name such as / epollfd character device to the I / O layer through the system standard character device interface;

[0026] Step 2, complete the kernel state of the said epollFdOpen opening, epollFdClose closing, epollFdIoctl control bottom interface function, and complete the management, release and control of the file fd handle of the epoll fd management and the epoll event information resource, combining Figure 2 ;

[0027] Step 2-1, the interface of the said epollFdOpen opening responds to the user state epoll_create interface, and performs the work in the kernel: creating a device resource conforming to the embedded system device model in the kernel, and the system I / 0 layer returns the file descriptor corresponding to the device resource to the user state; and creating a resource information table corresponding to the user state epoll instance, and the table item is used to save the file descriptor and the associated listening event pointer managed by the user state epoll instance; the file descriptor and event information pair stored in the information table can be dynamically increased;

[0028] Step 2-2, the interface of the said epollFdClose closing responds to the close system call of the user state, and releases the resources in the kernel, including the device resource pointer conforming to the embedded system device model and the resource information table described in step 2-1;

[0029] Step 2-3, the interface controlled by the epollFdIoctl mainly responds to the user state epoll_ctl control interface;

[0030] Step 2-3-1, define the kernel state global unique function code FIO_EPOLL_NOP, the control function is used to judge whether the file descriptor passed in by the user state is a normal file descriptor (such as network socket, timer file, signal file) or a file descriptor created by the / epollfd character device, which is used to support the cascade nested management of the epoll instance;

[0031] Step 2-3-2, define the kernel state global unique control function code FIO_EPOLL_ADD, the control function is used to keep the epoll instance to be monitored in the user state and its associated monitoring event pointer into the kernel state, so as to support the user state to copy the epoll instance, and to obtain all the file descriptor sets and monitoring event sets monitored by the copy from the kernel state;

[0032] Step 2-3-3, define the kernel state global unique control function code FIO_EPOLL_DEL, the control function is used to delete the file descriptor and its corresponding monitoring event information saved in the kernel state in response to the user state epoll_ctl EPOLL_CTL_DEL to delete the monitoring file descriptor;

[0033] Step 2-3-4, define the kernel state global unique control function code FIO_EPOLL_GET, the control function is used to return the file descriptor and the associated monitoring event pointer saved in the kernel state of the epoll instance to the user state in response to the user state through the FIO_EPOLL_NOP checking that the file descriptor to be processed is still an epoll instance.

[0034] Step 3, complete the user state epoll instance creation interface epoll_create, open the open system call / epollfd character device, complete the resource application in the kernel state, save the file descriptor information obtained in the user state resource information table in the user state, and combine Figure 3 ;

[0035] Step 3-1, open the kernel state / epollfd character device in the interface, complete the device resource application in the kernel;

[0036] Step 3-2, save the file descriptor information returned by the system in the user state resource information table in the user state; each table entry represents a specific epoll instance file and the resources managed thereby, and the resources managed by the epoll instance include all child file descriptors and their associated monitoring event pointers.

[0037] Step 4, combining Figure 4 , complete the user state epoll instance control interface epoll_ctl, and perform classification processing according to the incoming operation command, to realize three types of standard control: including EPOLL_CTL_ADD to add a monitored file descriptor, EPOLL_CTL_DEL to delete a file descriptor that is no longer monitored, and EPOLL_CTL_MOD to modify the event required to be monitored by a specified file descriptor;

[0038] Step 4-1, EPOLL_CTL_ADD control command: add the user-added file descriptor to be monitored and its associated event pointer to the information table of the controlled epoll instance in the user state; and execute ioctl control through the FIO_EPOLL_ADD custom command to synchronize the file descriptor and its associated monitoring event pointer to the kernel state for backup, so that the user state can take out the monitoring file set corresponding to the copy from the kernel state after executing the copy system call (dup standard interface);

[0039] Step 4-2, EPOLL_CTL_DEL control command: the user state deletes the file descriptor that is no longer monitored from the user state information table; execute ioctl control through the FIO_EPOLL_DEL custom command to delete the corresponding file descriptor and epoll event information in the kernel state;

[0040] Step 4-3, EPOLL_CTL_MOD modification command: the user state replaces the corresponding monitoring event in the resource information table of the specified file descriptor with a new monitoring event; execute ioctl control through the FIO_EPOLL_DEL / ADD custom command to replace the monitoring event pointer of the corresponding file descriptor in the kernel with a new event pointer.

[0041] Step 5, combining Figure 5 , complete the upper half of the user state epoll_wait instance waiting event interface: recursively collect all file descriptors that need to be monitored (including the cascading nested epoll instance copies formed after copying), and convert them into the file descriptor set corresponding to the select standard system call according to the monitoring event type associated with the file descriptor; start the select call to perform multi-way I / O multiplexing according to the timeout value of the epoll_wait;

[0042] Step 5-1, for the epoll instance that needs to wait for an event, traverse the resource information table of the user-mode epoll instance, traverse the file descriptors added thereto, and perform an ioctl determination on the file descriptors as to whether the file descriptors are normal file descriptors or file descriptors of an epoll instance, if they are normal file descriptors, go to Step 5-2, and if they are file descriptors of an epoll instance, go to Step 5-3;

[0043] Step 5-2, for a normal file descriptor, according to whether the corresponding monitored event type is EPOLLIN input, EPOLL OUT output or EPOLL EXECPTION exception event, convert and add to the READ read descriptor set, the WRITE write descriptor set or the EXCEPTION exception descriptor set of the select accordingly;

[0044] Step 5-3, for a file descriptor of an epoll instance, obtain all child file descriptors and monitored events managed by the nested epoll instance from the kernel state through an ioctl, and go back to Step 5-2 for the nested child file descriptors to perform the conversion and addition processing of the select file descriptor set again;

[0045] Step 5-4, after all the monitored file descriptors are processed in the loop, perform I / O monitoring through a select system call according to the timeout time value parameter of the epoll_wait.

[0046] Step 6, complete the lower half of the user-mode epoll_wait waiting event interface: after the select returns successfully, determine which file descriptors generate I / O events through the operating system FD_ISSET standard macro one by one, and when the number of file descriptors that generate events is counted and the event information corresponding to all file descriptors that generate events is filled, return to the caller;

[0047] Step 6-1, after the select returns successfully, determine which file descriptors generate I / O events through the system FD_ISSET standard macro one by one; obtain the user-mode resource information table corresponding to the epoll instance that the epoll_wait waits for, and traverse all child file descriptors managed in the resource information table in a loop;

[0048] Step 6-2, perform an ioctl control through the FIO_EPOLL_NOP custom command to determine whether each file descriptor is a normal file descriptor or a file descriptor of an epoll instance; if it is a normal file descriptor, go to Step 6-3, and if it is a file descriptor of an epoll instance, go to Step 6-4.

[0049] Step 6-3, for common file descriptor, according to the type of the monitored event, determine whether the file descriptor has the corresponding EPOLL input IN, output OUT, or exception EXECEPTION event by select standard macro FD_ISSET, if the event occurs, accumulate the number of files that have the event, and update the event information in the monitored event pointer corresponding to the file descriptor that has the event;

[0050] Step 6-4, for the file descriptor of the epoll instance, execute ioctl control through the FIO_EPOLL_GET custom command to obtain all file descriptors and monitored event pointers of the nested epoll instance backed up in the kernel, and traverse all child file descriptors to determine whether the event occurs, if any file descriptor has the event, identify that the nested epoll instance has the event, and combine the type of the event generated by or operation;

[0051] Step 6-5, when all file descriptors are processed, if there is a copy nest, all child file descriptors managed by the copy nest epoll instance are also included, then the epoll_wait completes the filling of the monitored event, and finally returns the number of files that actually have the event and the monitored event information to the caller.

[0052] In combination Figure 6 In an embedded system hardware platform including keyboard and mouse input devices, an epoll instance 1 is created to obtain a file descriptor 5, the opened keyboard file descriptor 3 is added to the epoll instance 1, an epoll instance 2 is created to obtain a file descriptor 6, the opened mouse file descriptor 4 is added to the epoll instance 2, the epoll instance 2 is duplicated by dup to obtain a copy file descriptor 7, and then the copy descriptor 7 of the epoll instance 2 is added to the file descriptor 5 of the epoll instance 1. The instance starts to monitor the epoll instance 1, and after the mouse is operated, the epoll instance 1 monitors that the copy of the epoll instance 2 has the event, and it can be further determined that the mouse file descriptor has the event from the copy. The running results of the embodiment show that the event generated by the file managed by the cascaded nested epoll instance after duplication can be transmitted to the upper layer.

[0053] It is to be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting; it is not intended to exclude myriad other embodiments of the present application that other inventors can develop based on the same general inventive concepts embodied by the described embodiments. That is, although the present application is described in terms of particular embodiments and illustrative figures, it should be apparent that the scope of the present application is not limited to these specific embodiments.

[0054] While the embodiments of the application have been shown and described herein, it will be understood by those skilled in the art that many changes, modifications, substitutions and alterations to these embodiments can be made without departing from the principles and spirits of the application, and it is intended that the scope of the application be limited solely by the scope of the appended claims and the equivalents thereof.

Claims

1. An embedded system supporting a copy and cascade nesting of an epoll simulation method, characterized in that, The method comprises the following steps: Step 1, installing an epoll character device driver under the kernel state of an embedded operating system, opening an epollFdOpen, closing an epollFdClose, controlling an epollFdIoctl bottom interface function pointer, registering to a system driver layer through a system standard driver installation interface, and installing a character device with a name such as / epollfd to an I / O layer through a system standard character device interface; Step 2, completing the kernel state of the epollFdOpen opening, the epollFdClose closing, the epollFdIoctl controlling the bottom interface function, and completing the management, release and control of the file fd handle and the epoll event information resource managed by the epollfd; Step 3, completing the user state of the epoll instance creation interface epoll_create, opening an open system call / epollfd character device, completing resource application in the kernel state, and saving the file descriptor information obtained in the user state resource information table in the user state; Step 4, completing the user state of the epoll instance control interface epoll_ctl, classifying processing according to the operation command, and respectively realizing three types of standard control, including EPOLL_CTL_ADD adding a monitored file descriptor, EPOLL_CTL_DEL deleting a file descriptor which is no longer monitored, and EPOLL_CTL_MOD modifying the event required to be monitored by a specified file descriptor; Step 5, completing the upper half of the user state of the epoll_wait instance waiting event interface: recursively collecting all file descriptors required to be monitored, and converting the file descriptor set corresponding to the select standard system call according to the monitoring event type associated with the file descriptor; starting the select call to execute multi-way I / O multiplexing according to the timeout value of the epoll_wait; Step 6, completing the lower half of the user state of the epoll_wait waiting event interface: when the select returns successfully, judging which file descriptor generates an I / O event through an operating system FD_ISSET standard macro; for the event generated by the file descriptor under the nested epoll instance copy, when the number of file descriptors generating events is counted and the event information corresponding to all file descriptors generating events is filled, the event information is returned to the caller.

2. The method of claim 1, wherein the method is implemented in an embedded system. The step 2 comprises the following steps: Step 2-1, the interface of the epollFdOpen opening responds to the user state of the epoll_create interface, and executes the work in the kernel: creating a device resource conforming to the embedded system device model in the kernel, returning a file descriptor corresponding to the device resource to the user state by the system I / O layer, and creating a resource information table corresponding to the user state of the epoll instance, wherein the table item is used to save the file descriptor and the associated monitoring event pointer managed by the user state of the epoll instance; the file descriptor and the event information in the information table can be dynamically increased. Step 2-2, the interface of the closed epollFdClose responds to the close system call in the user mode, and releases the resources in the kernel, including the device resource pointers conforming to the device model of the embedded system and the resource information table described in step 2-1; Step 2-3, the interface of the controlled epollFdIoctl responds to the epoll_ctl control interface in the user mode.

3. The method of claim 2, wherein the method further comprises: The step 2-3 includes the following steps: Step 2-3-1, a kernel global unique function code FIO_EPOLL_NOP is defined, the control function is used to judge whether the file descriptor transmitted from the user mode is a normal file descriptor or a file descriptor created by the / epollfd character device, and is used to support the cascade nested management of the epoll instance; Step 2-3-2, a kernel global unique control function code FIO_EPOLL_ADD is defined, the control function is used to keep the epoll instance to be monitored in the user mode and the associated monitoring event pointer into the kernel mode, so as to support the user mode to copy the epoll instance, and to obtain all the sets of sub-file descriptors and the sets of monitoring events monitored by the copy from the kernel mode; Step 2-3-3, a kernel global unique control function code FIO_EPOLL_DEL is defined, the control function is used to delete the file descriptor and the corresponding monitoring event information saved in the kernel mode in response to the EPOLL_CTL_DEL deletion of the monitoring file descriptor by the user mode epoll_ctl; Step 2-3-4, a kernel control function code FIO_EPOLL_GET is defined, the control function is used to return the sub-file descriptor and the associated monitoring event pointer saved in the kernel mode by the epoll instance to the user mode in response to the user mode checking that the file descriptor to be processed is still the epoll instance by the FIO_EPOLL_NOP.

4. The epoll simulation method supporting replication and cascading nesting in an embedded system according to claim 1, characterized in that, The step 3 includes the following steps: Step 3-1, the device resource is applied in the kernel by opening the kernel / epollfd character device in the interface; Step 3-2, the file descriptor information returned by the system is saved in the resource information table in the user mode; each table entry represents a specific epoll instance file and the resources managed by the epoll instance, and the resources managed by the epoll instance include all the sub-file descriptors and the associated monitoring event pointers monitored by the epoll instance.

5. The epoll simulation method supporting replication and cascading nesting in an embedded system according to claim 1, characterized in that, The step 4 includes the following steps: Step 4-1, the EPOLL_CTL_ADD control command: the file descriptor to be monitored and the associated event pointer added by the user are added to the information table of the controlled epoll instance in the user mode; and the FIO_EPOLL_ADD custom command is executed to perform the ioctl control, so as to synchronously transmit the file descriptor and the associated monitoring event pointer to the kernel mode for backup saving, so that the user mode can obtain the monitoring file set corresponding to the copy from the kernel mode after executing the copy system call; Step 4-2, EPOLL_CTL_DEL control command: the user state deletes the file descriptor which is no longer monitored from the user state information table; the FIO_EPOLL_DEL custom command is executed through ioctl control, and the corresponding file descriptor and epoll event information in the kernel state are deleted; Step 4-3, EPOLL_CTL_MOD modification command: the user state replaces the listening event corresponding to the file descriptor in the resource information table with a new listening event; the FIO_EPOLL_DEL / ADD custom command is executed through ioctl control, and the listening event pointer of the corresponding file descriptor in the kernel is replaced with a new event pointer.

6. The method of claim 1, wherein the method further comprises: The step 5 comprises the following steps: Step 5-1, for the epoll instance which needs to wait for an event, the resource information table of the user state epoll instance is traversed, the file descriptor added for it is traversed, and ioctl is executed for the file descriptor to determine whether the file descriptor is a normal file descriptor or an epoll instance file descriptor; if it is a normal file descriptor, step 5-2 is entered, and if it is an epoll instance file descriptor, step 5-3 is entered; Step 5-2, for a normal file descriptor, according to whether the corresponding listening event type is EPOLL IN input, EPOLLOUT output or EPOLL EXECPTION exception event, the corresponding conversion and addition are made to the READ read descriptor set, the WRITE write descriptor set or the EXCEPTION exception descriptor set of select; Step 5-3, for the epoll instance file descriptor, all child file descriptors and listening events managed by the nested epoll instance are obtained from the kernel state through ioctl, and step 5-2 is returned to the nested child file descriptor for select file descriptor set conversion and addition processing; Step 5-4, after all the listening file descriptors are processed in the loop, the I / O monitoring is performed through the select system call according to the timeout time value parameter of the epoll_wait.

7. The method of claim 1, wherein the method further comprises: if the file descriptor is not in the file descriptor set, adding the file descriptor to the file descriptor set; and if the file descriptor is in the file descriptor set, removing the file descriptor from the file descriptor set. The step 6 comprises the following steps: Step 6-1, when select returns successfully, it is judged which file descriptors generate I / O events through the system FD_ISSET standard macro; the user state resource information table corresponding to the epoll instance waited by the epoll_wait is obtained, and all child file descriptors managed in the resource information table are traversed in a loop; Step 6-2, the FIO_EPOLL_NOP custom command is executed through ioctl control to determine whether each file descriptor is a normal file descriptor or an epoll instance file descriptor; if it is a normal file descriptor, step 6-3 is entered, and if it is an epoll instance file descriptor, step 6-4 is entered; Step 6-3, for common file descriptors, according to the type of the monitored event, it is judged by the select standard macro FD_ISSET whether the file descriptor has the corresponding EPOLL IN input, EPOLL OUT output or EPOLL EXECPTION exception event, if the event occurs, the number of file descriptors with the event is accumulated, and the event information in the monitored event pointer corresponding to the file descriptor with the event is updated synchronously; Step 6-4, for the file descriptor of the epoll instance, the FIO_EPOLL_GET custom command is executed to control ioctl, all file descriptors and monitored event pointers of the nested epoll instance backed up in the kernel are obtained, and whether all child file descriptors have the event is traversed according to the same step, if any file descriptor has the event, it is identified that the nested epoll instance has the event, and the type of the event is combined by or operation; Step 6-5, when all file descriptors are processed, if there is a copy nest, all child file descriptors managed by the copy nest epoll instance are also included, then the epoll_wait completes the filling of the monitored event, and finally the number of file descriptors with the actual event and the monitored event information are returned to the caller.

8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the method of any one of claims 1 to 7 when executing the program.

9. A non-transitory computer-readable storage medium, comprising: The non-transitory computer readable storage medium stores computer instructions for causing the computer to execute the method of any one of claims 1 to 7.

10. A computer program product comprising computer program instructions, characterised in that, When the computer program instructions run on the computer, the computer executes the method of any one of claims 1 to 7. When the computer program instructions run on the computer, the computer executes the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Window image display method and device and storage medium

    CN113448662A

  • Device and method for converting serial port to udp based on ebi bus

    CN113468081A