QuarkContainer / Quark

A secure container runtime with CRI/OCI interface
Apache License 2.0
324 stars 49 forks source link

epoll: define EpollEvent structure per linux API #1274

Closed shrik3 closed 5 months ago

shrik3 commented 6 months ago

the userData is sometimes defined as [i32; 2] in Quark code. This doesn't make sense to me because the data is used in one piece as a u64 anyways. But I may be wrong.

However I don't see where this array is converted into u64, am I missing something? What's the initial idea of define the userData as [i32; 2] ?

This is tested on both x86 and aarch64, I don't see regression so far. Also fixes #1230

CC @QuarkContainer

shrik3 commented 5 months ago

Note: @CharlyYu fixed a similar issue recently, but the EpollEvent struct is defined in more than 4 places differently depending on how they are used and they all require additional padding for aarch64. I don't want to have 8x struct definitions of the same thing so I propose to use one unified def of this struct.

The Data field could be either a fd (i32), a u32, or a u64 data. If you use Data as i32 it will use the lower 4 bytes and has no conflict with the earlier defs.