Julien
Julien

Reputation: 1192

Linux Driver - Sharing a WaitHandle (-like) with user space

I have a Windows device driver that I'd like to port to Linux.

Our user-space application often needs to wait for driver events. Here's the mechanism that we use on Windows :

  1. The application creates a WaitHandle
  2. The application gives this WaitHandle to the driver through an ioctl
  3. The driver can access this handle using ObReferenceObjectByHandle and set it with KeSetEvent

What I like with this:

I'd like to keep the same architecture in my Linux driver.

Does anyone know how I could get the same behaviour on Linux ?

Upvotes: 0

Views: 651

Answers (1)

Servateur
Servateur

Reputation: 26

One simple idea would be to create a character device with blocking read. User application reads from the device; such read blocks until the event happens.

Edit:

Another idea is to send signal to userspace application whose handler will set the userspace wait handle (futex probably).

Upvotes: 1

Related Questions