Epoll simulation method supporting replication and cascade nesting under embedded system
By installing the epoll character device driver in the embedded operating system, the simulation of the epoll interface library is solved, and the problem of not being able to support complex multi-channel I/O multiplexing and nested classification management in existing embedded systems is realized. The interface compatible with Linux epoll is realized, and the replication and cascading nesting is supported, which enhances system capabilities and device application scenarios.
Patent Information
- Application Number
- CN202411984515.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2044-12-31
AI Technical Summary
The existing embedded real-time operating systems only provide a select mechanism, and cannot support complex multi-channel I/O multiplexing and nested classification management, and it is difficult to implement advanced management of timer files, signal files, domain sockets, etc. under these systems.
Install epoll character device driver in the embedded operating system to implement epollFdOpen, epollFdClose and epollFdIoctl functions, support the creation, control and waiting for user-mode epoll instances, and support for replication and cascading nesting by simulating the epoll interface library.
It realizes compatibility between embedded systems and Linux epoll, supports replication and cascade nesting of epoll fd, enhances the system's ability to manage multiple I/Os and nested classifications, and expands the application scenarios of embedded devices.
Smart Images

Figure CN120066701A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of IO multiplexing simulation, and particularly relates to an epoll simulation method supporting replication and cascading nesting under an embedded system. Background Art
[0002] Under Linux-like operating systems, multiple I / O multiplexing and event listening mechanisms such as select, poll, and epoll are provided to meet the requirements in different I / O input / output application scenarios. For embedded real-time operating systems such as DeltaOS and ACoreOS Tianmai, only the select mechanism is provided natively. For most modern complex software systems based on epoll for multiplexed I / O, such as the Weston window management system based on the Wayland graphics service protocol, it is impossible to support the realization of advanced nested classification management and dup replication listening functions for various file descriptors such as timerfd, signalfd, domain socket, and evdevfd of input devices in the system. For the embedded scenario, the performance of select can basically meet most requirements. Therefore, a set of epoll interface libraries that support replication and cascading nesting can be simulated and implemented based on the native select interface of such systems. Summary of the Invention
[0003] The purpose of the present invention is to provide an epoll simulation method supporting replication and cascading nesting under an embedded system, which realizes an interface compatible with Linux epoll for the embedded system and provides feasibility for enriching the system software ecosystem of the embedded system and expanding the application scenarios of embedded devices.
[0004] To achieve the purpose of the present invention, the present invention provides an epoll simulation method supporting replication and cascading nesting under an embedded system, including the following steps:
[0005] Step 1: Install an epoll character device driver in the kernel state of the embedded operating system, register the pointer of the underlying interface functions such as epollFdOpen, epollFdClose, and epollFdIoctl to the system driver layer through the system standard driver installation interface, and install a character device with a name in the form of / epollfd to the I / O layer through the system standard character device addition interface;
[0006] Step 2: Complete the opening of the epollFdOpen, closing of the epollFdClose, and controlling of the underlying interface functions in the kernel mode, and complete the management, release, and control of the file fd handles for epoll fd management, epoll event information resources;
[0007] Step 3: Complete the epoll instance creation interface epoll_create in the user mode. By opening the open system call / epollfd character device, apply for resources in the kernel mode, and save the obtained file descriptor information in the resource information table in the user mode;
[0008] Step 4: Implement the user-mode epoll instance control interface epoll_ctl, and classify and process according to the incoming operation commands, and implement three types of standard controls respectively: including EPOLL_CTL_ADD to add a file descriptor to be monitored, EPOLL_CTL_DEL to delete a file descriptor that is no longer monitored, and EPOLL_CTL_MOD to modify the events to be monitored for a specified file descriptor;
[0009] Step 5: Implement the upper part of the user-mode epoll_wait instance waiting event interface: recursively collect all file descriptors to be monitored, and convert them into the file descriptor set corresponding to the select standard system call according to the type of monitoring events associated with the file descriptors; start the select call to perform multiplexed I / O according to the timeout value of epoll_wait;
[0010] Step 6: Implement the lower part of the user-mode epoll_wait waiting event interface: after the select successfully returns, use the operating system FD_ISSET standard macro to sequentially determine which file descriptors have generated I / O events. For the events generated by the file descriptors under the nested epoll instance copies, after counting the number of files with events and filling in the event information corresponding to all file descriptors that have generated events, return to the caller.
[0011] An electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that when the processor executes the program, it implements the above-mentioned epoll simulation method supporting replication and cascading nesting under an embedded system.
[0012] A non-transitory computer-readable storage medium, characterized in that the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the computer to execute the above-mentioned epoll simulation method supporting replication and cascading nesting under an embedded system.
[0013] A computer program product includes computer program instructions, characterized in that when the computer program instructions run on a computer, the computer is caused to execute the above-mentioned epoll simulation method that supports replication and cascading nesting under an embedded system.
[0014] Compared with the prior art, the remarkable progress of the present invention lies in that the present invention enables the mainstream embedded system platform to have an interface library compatible with epoll on the Linux platform, and can fully support the function of listening after an epoll fd is duplicated by dup, and also synchronously supports the function of adding an epoll fd to another epoll fd for nested listening, forming a basic environment for the epoll I / O multiplexing technology. Based on this basic environment, more software functions can be realized under such operating systems. For example, it can realize the multiplexing I / O listening capabilities of the Wayland new graphics system for network domain sockets, signal signals, timer timers, and evdev input devices, and can be classified and managed to improve flexibility, and can play a good promoting role in enriching the embedded system software ecosystem and expanding the application scenarios of embedded devices.
[0015] To more clearly illustrate the functional characteristics and structural parameters of the present invention, the following further explains in conjunction with the drawings and specific embodiments. Description of the Drawings
[0016] The drawings described herein are used to provide a further understanding of the present invention, form a part of this application, and the schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:
[0017] Figure 1 is the epoll simulation architecture diagram that supports replication and cascading nesting under the embedded system of the present invention;
[0018] Figure 2 is the flowchart of creating an epoll device resource (epoll_create) of the present invention;
[0019] Figure 3 is to judge whether the fd is opened by the epoll device driver in the present invention;
[0020] Figure 4 is the flowchart of controlling the epoll device (epoll_ctl) of the present invention;
[0021] Figure 5 is the flowchart of waiting for epoll events (epoll_wait) in the case of cascading nesting of the present invention;
[0022] Figure 6It is the operation result diagram of the cascaded nested transfer of epoll instance copies in the present invention. Specific Embodiments
[0023] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0024] An epoll simulation method supporting replication and cascaded nesting in an embedded system of the present invention, in combination with Figure 1 , includes the following steps:
[0025] Step 1: Install an epoll character device driver in the kernel state of the embedded operating system, register the underlying interface function pointers of epollFdOpen open, epollFdClose close, and epollFdIoctl control through the system standard driver installation interface to the system driver layer, and install a character device with a globally unique name in the form of / epollfd to the I / O layer through the system standard character device addition interface;
[0026] Step 2: Complete the underlying interface functions of the epollFdOpen open, epollFdClose close, and epollFdIoctl control in the kernel state, and complete the management, release, and control of the file fd handle for epoll fd management, epoll event information resources, in combination with Figure 2 ;
[0027] Step 2-1: The interface of the epollFdOpen open responds to the user-state epoll_create interface and executes the work in the kernel: creates device resources that conform to the device model of the embedded system in the kernel, and the system I / O layer returns a file descriptor corresponding to the device resources to the user state; and creates a resource information table for the user-state epoll instance, and its table entries are used to save the file descriptors managed by the user-state epoll instance and the pointers to the associated listening events; the pairs of file descriptors and event information stored in the information table can be dynamically increased;
[0028] Step 2-2: The interface of the epollFdClose close responds to the user-state close system call and releases resources in the kernel, including the device resource pointer that conforms to the device model of the embedded system, and the resource information table described in Step 2-1;
[0029] Step 2-3. The interface controlled by the epollFdIoctl mainly responds to the epoll_ctl control interface in user space;
[0030] Step 2-3-1. Define a globally unique function code FIO_EPOLL_NOP in kernel space. The control function is used to determine whether the file descriptor passed in from user space is an ordinary file descriptor (such as a network socket, a timer file, a signal file), or a file descriptor created by the / epollfd character device, so as to support cascaded nested management of epoll instances;
[0031] Step 2-3-2. Define a globally unique control function code FIO_EPOLL_ADD in kernel space. The control function is used to save the epoll instance to be monitored in user space and its associated monitoring event pointer in kernel space, so as to support that after the epoll instance is copied in user space, all sub-file descriptor sets and monitoring event sets monitored by the copy can be obtained from kernel space;
[0032] Step 2-3-3. Define a globally unique control function code FIO_EPOLL_DEL in kernel space. The control function is used to delete the file descriptor saved in kernel space and its corresponding monitoring event information when the user space epoll_ctl performs EPOLL_CTL_DEL to delete the monitored file descriptor;
[0033] Step 2-3-4. Define a globally unique control function code FIO_EPOLL_GET in kernel space. The control function is used to return the sub-file descriptors and associated monitoring event pointers saved by the epoll instance in kernel space to user space when it is detected by the FIO_EPOLL_NOP in user space that the file descriptor to be processed is still an epoll instance.
[0034] Step 3. Complete the epoll instance creation interface epoll_create in user space. By opening the / epollfd character device through the open system call, resource application is completed in kernel space, and the file descriptor information obtained is saved in the resource information table in user space, combined with Figure 3 ;
[0035] Step 3-1. Inside the interface, the / epollfd character device in kernel space is opened to complete the application of device resources in the kernel;
[0036] Step 3-2: Save the file descriptor information returned by the system in the resource information table in the user state; each table entry represents a specific epoll instance file and the resources it manages, and the resources managed by the epoll instance include all the sub-file descriptors it monitors and the pointers to the associated monitoring events.
[0037] Step 4: Combine Figure 4 , complete the user-state epoll instance control interface epoll_ctl, and classify and process according to the incoming operation commands to implement three types of standard controls: 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 events to be monitored for a specified file descriptor.
[0038] Step 4-1: EPOLL_CTL_ADD control command: In the user state, add the file descriptor to be monitored added by the user and the pointer to the associated event to the information table in the user state of the epoll instance to be controlled; and execute ioctl control through the custom command FIO_EPOLL_ADD to synchronously transfer the file descriptor and the pointer to the associated monitoring event to the kernel state for backup storage, so that after the user state executes the copy system call (dup standard interface), it can retrieve the monitored file set corresponding to the copy from the kernel state.
[0039] Step 4-2: EPOLL_CTL_DEL control command: The user state deletes the specified file descriptor that is no longer monitored from the user state information table; execute ioctl control through the custom command FIO_EPOLL_DEL 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 monitored event corresponding to the specified file descriptor in the resource information table with a new monitored event; execute ioctl control through the custom command FIO_EPOLL_DEL / ADD to replace the pointer to the monitored event of the corresponding file descriptor in the kernel with a new event pointer.
[0041] Step 5: Combine Figure 5 , complete the upper part of the user-state epoll_wait instance waiting event interface: recursively collect all the file descriptors to be monitored (including the epoll instance copies formed by cascading and nesting after replication), and convert them into the file descriptor set corresponding to the select standard system call according to the type of the monitored event associated with the file descriptor; start the select call to perform multiplexed I / O according to the timeout value of epoll_wait.
[0042] Step 5-1: For the epoll instance that needs to wait for events, traverse the resource information table of the user-space epoll instance, traverse the file descriptors added to it, and execute ioctl for the file descriptors to determine whether the file descriptors are ordinary file descriptors or file descriptors of the epoll instance. If they are ordinary file descriptors, go to Step 5-2; if they are file descriptors of the epoll instance, go to Step 5-3;
[0043] Step 5-2: For ordinary file descriptors, according to whether the corresponding listening event type is EPOLLIN input, EPOLL OUT output, or EPOLL EXECPTION exception event, convert and add them to the READ read descriptor set, WRITE write descriptor set, or EXCEPTION exception descriptor set of select accordingly;
[0044] Step 5-3: For file descriptors that are epoll instances, obtain all sub-file descriptors and listening events managed by the nested epoll instance through ioctl from the kernel space, return to Step 5-2 for the nested sub-file descriptors, and then perform the conversion and addition processing of the select file descriptor set;
[0045] Step 5-4: After looping through all the listening file descriptors, perform I / O listening through the select system call according to the timeout value parameter of epoll_wait.
[0046] Step 6: Complete the second half of the user-space epoll_wait waiting event interface: When select returns successfully, use the operating system FD_ISSET standard macro to determine which file descriptors generate I / O events in sequence. For the events generated by the file descriptors under the nested epoll instance copy, after counting the number of files with events and filling in the event information corresponding to all the file descriptors that generate events, return to the caller;
[0047] Step 6-1: When select returns successfully, use the system FD_ISSET standard macro to determine which file descriptors generate I / O events in sequence; obtain the user-space resource information table corresponding to the epoll instance waited by epoll_wait, and loop through all the sub-file descriptors managed in the resource information table;
[0048] Step 6-2: Execute ioctl control through the FIO_EPOLL_NOP custom command to determine whether each file descriptor is an ordinary file descriptor or a file descriptor of an epoll instance; if it is an ordinary 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 ordinary file descriptors, according to the types of monitored events, use the standard macro FD_ISSET in select to determine whether the corresponding EPOLL input IN, output OUT, or exception EXCEPTION events occur for the file descriptor. If an event occurs, accumulate the number of files with events, and synchronously update the event information in the monitored event pointer corresponding to the file descriptor that generates the event.
[0050] Step 6-4: For the file descriptor of the epoll instance, perform ioctl control through the custom command FIO_EPOLL_GET to obtain all the file descriptors and monitored event pointers backed up in the kernel for the nested epoll instance, and traverse whether events occur for all its child file descriptors according to the same steps above. If an event occurs for any file descriptor, mark that the nested epoll instance generates an event, and merge the generated event types through an OR operation.
[0051] Step 6-5: When all file descriptors are processed, if there are replicated nests, including all child file descriptors managed by the replicated nested epoll instance, epoll_wait completes the filling of monitored events, and finally returns the actual number of files with events and the monitored event information to the caller.
[0052] Combined with Figure 6 , in an embedded system hardware platform including keyboard and mouse input devices, create an epoll instance 1 through this embodiment to obtain file descriptor 5, add the opened keyboard file descriptor 3 to epoll instance 1, then create an epoll instance 2 to obtain file descriptor 6, add the opened mouse file descriptor 4 to epoll instance 2, use dup to replicate epoll instance 2 to obtain a copy file descriptor 7, and then add the copy descriptor 7 of epoll instance 2 to file descriptor 5 of epoll instance 1; start monitoring epoll instance 1 in the example. When the mouse is operated, epoll instance 1 monitors that an event occurs for the copy of epoll instance 2, and it can be further determined from the copy that the event is generated by the mouse file descriptor; the operation result of the embodiment shows that the events generated by the files managed by the replicated cascaded nested epoll instance can be passed to the upper layer.
[0053] It should be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or elements inherent to such process, method, article or device.
[0054] Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. An epoll simulation method supporting replication and cascade nesting in an embedded system, characterized in that: The following steps are involved: Step 1, install the epoll character device driver in the kernel state of the embedded operating system, open epollFdOpen, close epollFdClose, and control the underlying interface function pointer with epollFdIoctl, register it to the system driver layer through the system standard driver installation interface, and install a character device with a name such as / epollfd to the I / 0 layer through the system standard add character device interface; Step 2, complete the epollFdOpen opening, epollFdClose closing, epollFdIoctl control of the underlying interface function in the kernel state, and complete the management, release and control of the file fd handle and epoll event information resources managed by epollfd; Step 3: Complete the epoll instance creation interface epoll_create in the user state, open the open system call / epollfd character device, complete the resource application in the kernel state, and save the obtained file descriptor information in the user state in the resource information table of the user state; Step 4: Complete the user-state epoll instance control interface epoll_ctl, classify and process the incoming operation commands, and implement three types of standard controls: EPOLL_CTL_ADD adds a monitored file descriptor, EPOLL_CTL_DEL deletes the file descriptor that is no longer monitored, and EPOLL_CTL_MOD modifies the events that the specified file descriptor needs to monitor; Step 5. Complete the upper part of the user-state epoll_wait instance waiting event interface: recursively collect all file descriptors that need to be monitored, 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 multiple I / 0 multiplexing according to the timeout value of epoll_wait; Step 6. Complete the lower half of the user-mode epoll_wait wait event interface: When select returns successfully, use the operating system FD_ISSET standard macro to determine which file descriptors generate I / 0 events in turn. For events generated by file descriptors under nested epoll instance copies, after counting the number of files where events occurred and filling in the event information corresponding to all file descriptors that generated events, return to the caller.
2. According to claim 1, the epoll simulation method supporting replication and cascade nesting in an embedded system is characterized in that: The step 2 comprises the following steps: Step 2-1, the interface opened by the epollFdOpen responds to the user state epoll_create interface and executes the work in the kernel: creates device resources that conform 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 creates a resource information table for the user state epoll instance, whose table entries are used to save the file descriptors managed by the user state epoll instance and their associated listening event pointers; the file descriptor and event information pairs stored in the information table can be dynamically increased; Step 2-2, the interface closed by epollFdClose responds to the close system call of the user state, and releases resources in the kernel, including a device resource pointer that conforms to the embedded system device model, and the resource information table described in step 2-1; Step 2-3, the interface controlled by the epollFdIoctl responds to the epollctl control interface in the user state.
3. The epoll simulation method supporting replication and cascade nesting in an embedded system according to claim 2, characterized in that: The steps 2-3 include the following steps: Step 2-3-1, customize the kernel state globally unique function code FIO_EPOLLNOP, the control function is used to determine whether the file descriptor passed in by the user state is a common file descriptor or a file descriptor created by the / epollfd character device, and is used to support cascade nested management of epoll instances; Step 2-3-2, customize the kernel state globally 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 obtain all the sub-file descriptor sets and monitoring event sets monitored by the copy from the kernel state; Step 2-3-3, customize the kernel-state globally unique control function code FIO_EPOLL_DEL, the control function is used to respond to the user-state epollctl to perform EPOLL_CTL_DEL to delete the listening file descriptor, and delete the file descriptor and its corresponding listening event information stored in the kernel state; Step 2-3-4, customize the kernel state control function code FIO_EPOLL_GET, the control function is used to respond to the user state checking through the FIO_EPOLL_NOP that the file descriptor to be processed is still the epoll instance, and return the sub-file descriptor and the associated listening event pointer saved by the epoll instance in the kernel state to the user state.
4. The epoll simulation method supporting replication and cascade nesting in an embedded system according to claim 1, characterized in that: The step 3 comprises the following steps: Step 3-1: Open the kernel mode / epollfd character device inside the interface and complete the application of device resources in the kernel; Step 3-2: In user state, save the file descriptor information returned by the system in the resource information table of user state; each table entry represents a specific epoll instance file and the resources it manages, and the resources managed by the epoll instance include all the sub-file descriptors it monitors and their associated monitoring event pointers.
5. The epoll simulation method supporting replication and cascade nesting in an embedded system according to claim 1, characterized in that: The step 4 comprises the following steps: Step 4-1, EPOLL_CTL_ADD control command: in the user state, the file descriptor to be monitored and its associated event pointer added by the user are added to the information table of the controlled epoll instance in the user state; and the ioctl control is executed through the FIO_EPOLL_ADD custom command, and the file descriptor and its associated monitoring event pointer are synchronously transferred to the kernel state for backup and preservation, so that the user state can retrieve the monitoring file set corresponding to the copy from the kernel state after executing the copy system call; Step 4-2, EPOLL_CTL_DEL control command: the user state deletes the file descriptor that is no longer specified to be monitored from the user state information table; the ioctl control is executed through the FIO_EPOLL_DEL custom command to delete the corresponding file descriptor and epoll event information in the kernel state; Step 4-3, EPOLL_CTL_MOD modification command: the user state replaces the corresponding listening event in the resource information table where the specified file descriptor is located with a new listening event; the FIO_EPOLL_DEL / ADD custom command is used to execute ioctl control to replace the listening event pointer of the corresponding file descriptor in the kernel with the new event pointer.
6. The epoll simulation method supporting replication and cascade nesting in an embedded system according to claim 1, characterized in that: The step 5 comprises the following steps: Step 5-1, for the epoll instance that needs to wait for an event, traverse the resource information table of the user state epoll instance, traverse the file descriptors added for it, and execute ioctl for the file descriptor to determine whether the file descriptor is a common file descriptor or a file descriptor of the epoll instance. If it is a common file descriptor, go to step 5-2; if it is a file descriptor of the epoll instance, go to step 5-3; Step 5-2: For common file descriptors, according to the corresponding listening event type, whether it is EPOLL IN input, EPOLL OUT output or EPOLL EXECPTION exception event, convert and add to the READ read descriptor set, WRITE write descriptor set, or EXCEPTION exception descriptor set of the select; Step 5-3, for the file descriptor of the epoll instance, all sub-file descriptors and monitoring events managed by the nested epoll instance are obtained from the kernel state through ioctl, and then return to step 5-2 for the nested sub-file descriptors, and then convert and add the select file descriptor set; Step 5-4: After the loop has processed all the monitoring file descriptors, I / O monitoring is performed through the select system call according to the timeout value parameter of epoll_wait.
7. The epoll simulation method supporting replication and cascade nesting in an embedded system according to claim 1, characterized in that: The step 6 comprises the following steps: Step 6-1, when select returns successfully, use the system FD_ISSET standard macro to determine which file descriptors generate I / O events in turn; obtain the user state resource information table corresponding to the epoll instance that epoll_wait is waiting for, and loop through all the child file descriptors managed in the resource information table; Step 6-2, execute ioctl control through the FIO_EPOLL_NOP custom command to determine whether each file descriptor is a common file descriptor or a file descriptor of an epoll instance; if it is a common file descriptor, proceed to step 6-3, if it is an epoll instance file descriptor, proceed to step 6-4; Step 6-3, for common file descriptors, according to the monitoring event type, determine whether the file descriptor has the corresponding EPOLL input IN, output OUT, or abnormal EXECEPTION event by selecting the standard macro FD_ISSET. If an event occurs, the number of files where the event occurs is accumulated, and the event information in the monitoring event pointer corresponding to the file descriptor that generated the event is synchronously updated; Step 6-4, for the file descriptor of the epoll instance, the FI0_EPOLL_GET custom command is used to execute ioctl control, obtain all file descriptors and monitoring event pointers backed up by the nested epoll instance in the kernel, and traverse all its child file descriptors according to the same steps as above to see if an event is generated. If any file descriptor generates an event, the nested epoll instance is marked as generating an event, and the generated event types are merged through an OR operation; Step 6-5, when all file descriptors are processed, including all child file descriptors managed by the nested epoll instances if there are any, epoll_wait completes the filling of the listening events, and finally returns the number of files that actually generated the events and the listening event information to the caller.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.
9. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the computer to execute any one of claims 1 to 7.
10. A computer program product comprising computer program instructions, characterized in that When the computer program instructions are executed on a computer, the computer is caused to perform the method according to 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
Communication method of asynchronous network input and output component
CN118250331A