2024-12-16 07:12:49 +03:00
|
|
|
From aed34cc9c28dba5e3735d7c59e1970a32eefc5f4 Mon Sep 17 00:00:00 2001
|
2024-10-29 05:12:06 +03:00
|
|
|
From: Elizabeth Figura <zfigura@codeweavers.com>
|
2024-12-16 07:12:49 +03:00
|
|
|
Date: Fri, 13 Dec 2024 13:34:55 -0600
|
2024-10-29 05:12:06 +03:00
|
|
|
Subject: 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 <zfigura@codeweavers.com>
|
|
|
|
---
|
2024-12-16 07:12:49 +03:00
|
|
|
drivers/misc/ntsync.c | 24 ++++++++++++++++++++++++
|
2024-10-29 05:12:06 +03:00
|
|
|
include/uapi/linux/ntsync.h | 1 +
|
2024-12-16 07:12:49 +03:00
|
|
|
2 files changed, 25 insertions(+)
|
2024-10-29 05:12:06 +03:00
|
|
|
|
|
|
|
--- a/drivers/misc/ntsync.c
|
|
|
|
+++ b/drivers/misc/ntsync.c
|
2024-12-16 07:12:49 +03:00
|
|
|
@@ -629,6 +629,28 @@ static int ntsync_mutex_read(struct ntsy
|
2024-10-29 05:12:06 +03:00
|
|
|
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;
|
2024-12-16 07:12:49 +03:00
|
|
|
@@ -662,6 +684,8 @@ static long ntsync_obj_ioctl(struct file
|
2024-10-29 05:12:06 +03:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
--- a/include/uapi/linux/ntsync.h
|
|
|
|
+++ b/include/uapi/linux/ntsync.h
|
2024-12-16 07:12:49 +03:00
|
|
|
@@ -53,5 +53,6 @@ struct ntsync_wait_args {
|
2024-10-29 05:12:06 +03:00
|
|
|
#define NTSYNC_IOC_EVENT_PULSE _IOR ('N', 0x8a, __u32)
|
|
|
|
#define NTSYNC_IOC_SEM_READ _IOR ('N', 0x8b, struct ntsync_sem_args)
|
|
|
|
#define NTSYNC_IOC_MUTEX_READ _IOR ('N', 0x8c, struct ntsync_mutex_args)
|
|
|
|
+#define NTSYNC_IOC_EVENT_READ _IOR ('N', 0x8d, struct ntsync_event_args)
|
|
|
|
|
|
|
|
#endif
|