diff options
| author | Elizabeth Figura <[email protected]> | 2024-12-13 19:34:55 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2025-01-08 12:18:11 +0000 |
| commit | e864071a630cfbbd55251e7b45461003f4f79877 (patch) | |
| tree | a412c9156f2ba43dc4a0896d29a62f7d38b3ecae /drivers/misc/ntsync.c | |
| parent | ntsync: Introduce NTSYNC_IOC_MUTEX_READ. (diff) | |
| download | kernel-e864071a630cfbbd55251e7b45461003f4f79877.tar.gz kernel-e864071a630cfbbd55251e7b45461003f4f79877.zip | |
ntsync: Introduce NTSYNC_IOC_EVENT_READ.
This corresponds to the NT syscall NtQueryEvent().
This returns the signaled state of the event and whether it is manual-reset.
Signed-off-by: Elizabeth Figura <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/misc/ntsync.c')
| -rw-r--r-- | drivers/misc/ntsync.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/misc/ntsync.c b/drivers/misc/ntsync.c index 0047b13b6ebd..78dc405bb759 100644 --- a/drivers/misc/ntsync.c +++ b/drivers/misc/ntsync.c @@ -629,6 +629,28 @@ static int ntsync_mutex_read(struct ntsync_obj *mutex, void __user *argp) return ret; } +static int ntsync_event_read(struct ntsync_obj *event, void __user *argp) +{ + struct ntsync_event_args __user *user_args = argp; + struct ntsync_device *dev = event->dev; + struct ntsync_event_args args; + bool all; + + if (event->type != NTSYNC_TYPE_EVENT) + return -EINVAL; + + all = ntsync_lock_obj(dev, event); + + args.manual = event->u.event.manual; + args.signaled = event->u.event.signaled; + + ntsync_unlock_obj(dev, event, all); + + if (copy_to_user(user_args, &args, sizeof(args))) + return -EFAULT; + return 0; +} + static int ntsync_obj_release(struct inode *inode, struct file *file) { struct ntsync_obj *obj = file->private_data; @@ -662,6 +684,8 @@ static long ntsync_obj_ioctl(struct file *file, unsigned int cmd, return ntsync_event_reset(obj, argp); case NTSYNC_IOC_EVENT_PULSE: return ntsync_event_set(obj, argp, true); + case NTSYNC_IOC_EVENT_READ: + return ntsync_event_read(obj, argp); default: return -ENOIOCTLCMD; } |
