From 301e6a652f9d2bc75add200ff93df58952a4db06 Mon Sep 17 00:00:00 2001 From: Joakim Hassila Date: Fri, 9 Apr 2021 18:47:44 +0200 Subject: [PATCH] Fix bug in eventfd(initval: Int32, flags: Int32) (#1797) Motivation: There is bug in `eventfd(initval: Int32, flags: Int32)` where it doesn't actually pass on the arguments to `CNIOLinux.eventfd()` disregarding the intent of the caller. Modification: Start using the arguments passed in. Result: `eventfd(initval: Int32, flags: Int32)` now works as expected. --- Sources/NIO/Linux.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/NIO/Linux.swift b/Sources/NIO/Linux.swift index 58540674e..2bfca488b 100644 --- a/Sources/NIO/Linux.swift +++ b/Sources/NIO/Linux.swift @@ -57,9 +57,9 @@ internal enum EventFd { } @inline(never) - public static func eventfd(initval: Int32, flags: Int32) throws -> Int32 { + public static func eventfd(initval: UInt32, flags: Int32) throws -> Int32 { return try syscall(blocking: false) { - CNIOLinux.eventfd(0, Int32(EFD_CLOEXEC | EFD_NONBLOCK)) + CNIOLinux.eventfd(initval, flags) }.result } }