Fix: epoll on linux (#820)

This commit is contained in:
Jabin 2021-10-07 01:45:05 +11:00 committed by GitHub
parent f3b722b9d6
commit 05ff3f2ad9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -69,10 +69,12 @@ namespace Server.Network
public ulong u64;
}
[StructLayout(LayoutKind.Sequential)]
[StructLayout(LayoutKind.Explicit)]
private struct epoll_event
{
[FieldOffset(0)]
public epoll_events events;
[FieldOffset(4)]
public epoll_data data;
}
@ -93,16 +95,16 @@ namespace Server.Network
private static class Linux
{
[DllImport("libc.so.6", SetLastError = true)]
[DllImport("libc", SetLastError = true)]
public static extern int epoll_create1(epoll_flags flags);
[DllImport("libc.so.6", SetLastError = true)]
[DllImport("libc", SetLastError = true)]
public static extern int epoll_close(int epfd);
[DllImport("libc.so.6", SetLastError = true)]
[DllImport("libc", SetLastError = true)]
public static extern int epoll_ctl(int epfd, epoll_op op, int fd, ref epoll_event ee);
[DllImport("libc.so.6", SetLastError = true)]
[DllImport("libc", SetLastError = true)]
public static extern int epoll_wait(int epfd, [In, Out] epoll_event[] ee, int maxevents, int timeout);
}