WSL icon indicating copy to clipboard operation
WSL copied to clipboard

eventfd using EFD_SEMAPHORE fails with EINVAL (Invalid argument)

Open aidsjorb opened this issue 10 years ago • 5 comments

eventfd appears to work fine using EFD_CLOEXEC | EFD_NONBLOCK but once EFD_SEMAPHORE is included then EINVAL is returned.

The attached zip should contain a cpp file demonstrating the issue. It should also include an strace of the actual execution.

eventfd_failures.zip

aidsjorb avatar May 29 '16 23:05 aidsjorb

Thanks for reporting the issue, the EFD_SEMAPHORE flag is not currently supported by WSL. Outside of the targeted test, did you hit this in a particular application or scenario?

stehufntdev avatar May 31 '16 21:05 stehufntdev

In this scenario it was an application I'm working on myself. I'm using the eventfd as a convenient "interrupt" mechanism for a select call that is waiting for read ready on one or more file descriptors.

The facebook folly library appears to do something similar in its libevent wrapper but they must be doing some ifdef magic to avoid any incompatible environments (it seems to work fine.)

I don't think the EFD_SEMAPHORE option is strictly necessary for my usage so I can get around it for now. Thanks for the heads up.

I appreciate all the work you guys are doing on this!

aidsjorb avatar May 31 '16 22:05 aidsjorb

Thanks I'll close this out for now and add the feature tag.

stehufntdev avatar May 31 '16 23:05 stehufntdev

We need EFD_SEMAPHORE in WSL, so how to reopen this issue?

vladon avatar Feb 01 '17 15:02 vladon

EFD_SEMAPHORE was actually added recently and the fix should be out in insider builds soon.

stehufntdev avatar Feb 01 '17 15:02 stehufntdev