Conversation
| version (linux): | ||
| extern (C): | ||
| @system: | ||
| nothrow: |
src/core/sys/linux/sys/eventfd.d
Outdated
| int eventfd (uint count, int flags); | ||
|
|
||
| /* Read event counter and possibly wait for events. */ | ||
| int eventfd_read (int fd, uint* value); |
There was a problem hiding this comment.
Where did you get those signatures from?
According to https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sys/eventfd.h;hb=HEAD they should be:
/* Type for event counter. */
typedef uint64_t eventfd_t;
/* Return file descriptor for generic event channel. Set initial
value to COUNT. */
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);
/* Increment event counter. */
extern int eventfd_write (int __fd, eventfd_t __value);I suggest you add and use the eventfd_t typedef accordingly.
There was a problem hiding this comment.
This is what I was wondering - should I add this typedef. I'll update.
This adds bindings for linux-specific eventfd_* calls.
3360841 to
0748d40
Compare
|
Updated with |
|
@nemanja-boric-sociomantic |
|
Yeah, that's what I thought, but simple grep found some |
|
AFAICS, this was something that @CyberShadow did and is used only for the Win32 bindings. My understanding of this is that the Win32 bindings were originally written in D1 and were later ported to D2 while keeping D1 backwards compatibility and now this is no longer needed. Also none of the other system bindings (stdc/, sys/) use this technique. @CyberShadow can you shed some light on this? |
|
That TypeDef definition was from back when the win32 package was still only available separately, on DSource. At some point Although strong typing for the various integral (or |
|
Thanks for the explanation @CyberShadow. Are you OK with merging this PR? |
|
What's the reason for the large version switch? Looking at the Linux source code, these don't seem to be architecture-dependent constants. |
|
They are architecture-dependent constants, see https://github.molgen.mpg.de/git-mirror/glibc/blob/master/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h https://github.molgen.mpg.de/git-mirror/glibc/blob/master/sysdeps/unix/sysv/linux/alpha/bits/eventfd.h https://github.molgen.mpg.de/git-mirror/glibc/blob/master/sysdeps/unix/sysv/linux/hppa/bits/eventfd.h https://github.molgen.mpg.de/git-mirror/glibc/blob/master/sysdeps/unix/sysv/linux/mips/bits/eventfd.h and the common one https://github.molgen.mpg.de/git-mirror/glibc/blob/master/sysdeps/unix/sysv/linux/bits/eventfd.h I chose the same way |
|
Huh, so they are in glibc. Not in the Linux kernel though, as far as I could tell. |
|
Yeah, I'll give it another look to be 100% sure. |
|
Well there's no harm in doing it the glibc way, so LGTM. |
|
Thanks! |
This adds bindings for linux-specific eventfd_* calls.