man 2 eventfd
says:
SYNOPSIS
#include <sys/eventfd.h> int eventfd(unsigned int initval, int flags);
but in /usr/include/sys/eventfd.h
I see:
extern int eventfd (int __count, int __flags) __THROW;
I hit this because I needed to pass eventfd
as a function pointer and I got a warning when it had the signature described in the manpage. Is this signature non-portable? Do I need to be aware of this in code I write?
The signature in glibc was changed in 2014 with this commit to the glibc tree:
diff --git a/sysdeps/unix/sysv/linux/hppa/sys/eventfd.h b/sysdeps/unix/sysv/linux/hppa/sys/eventfd.h
index 2d198a8..a3c340e 100644 (file)
--- a/sysdeps/unix/sysv/linux/hppa/sys/eventfd.h
+++ b/sysdeps/unix/sysv/linux/hppa/sys/eventfd.h
@@ -40,7 +40,7 @@ __BEGIN_DECLS
/* Return file descriptor for generic event channel. Set initial
value to COUNT. */
-extern int eventfd (int __count, int __flags) __THROW;
+extern int eventfd (unsigned int __count, int __flags) __THROW;
/* Read event counter and possibly wait for events. */
extern int eventfd_read (int __fd, eventfd_t *__value);
I suppose in terms of portability, then, if you have an old version of glibc
, the best you can do is cast your pointer to eventfd
to int (*f)(unsigned int, int)
.