mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-28 04:46:44 -04:00
unix: add Eventfd function on Linux
Add support for the eventfd2 syscall on Linux. Use the eventfd2 syscall instead of eventfd, as the latter does not provide a flags argument and glibc also maps its eventfd() function to the eventfd2 syscall, see the Notes section in http://man7.org/linux/man-pages/man2/eventfd.2.html Also add the corresponding flags values EFD_CLOEXEC, EFD_NONBLOCK and EFD_SEMAPHORE. Change-Id: Ia8c99e68d5966ab5c7ebe7e45423943fd7d8214e Reviewed-on: https://go-review.googlesource.com/45093 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
committed by
Ian Lance Taylor
parent
b9e8d468b0
commit
0b25a408a5
@@ -511,6 +511,17 @@ func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Eventfd(initval uint, flags int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_EVENTFD2, uintptr(initval), uintptr(flags), 0)
|
||||
fd = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Exit(code int) {
|
||||
Syscall(SYS_EXIT_GROUP, uintptr(code), 0, 0)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user