Konstantin Demin
8cbaf1dea2
3rd patchs (in alphabetical order): - bbr3 - ntsync5 - openwrt - pf-kernel - xanmod - zen no configuration changes for now
67 lines
1.9 KiB
Diff
67 lines
1.9 KiB
Diff
From 1ef0ea672662bd19e7c6a4eac1067d11e50844b2 Mon Sep 17 00:00:00 2001
|
|
From: Elizabeth Figura <zfigura@codeweavers.com>
|
|
Date: Sun, 19 May 2024 15:24:36 -0500
|
|
Subject: ntsync: Introduce NTSYNC_IOC_SEM_READ.
|
|
|
|
This corresponds to the NT syscall NtQuerySemaphore().
|
|
|
|
This returns the current count and maximum count of the semaphore.
|
|
|
|
Signed-off-by: Elizabeth Figura <zfigura@codeweavers.com>
|
|
---
|
|
drivers/misc/ntsync.c | 26 ++++++++++++++++++++++++++
|
|
include/uapi/linux/ntsync.h | 1 +
|
|
2 files changed, 27 insertions(+)
|
|
|
|
--- a/drivers/misc/ntsync.c
|
|
+++ b/drivers/misc/ntsync.c
|
|
@@ -583,6 +583,30 @@ static int ntsync_event_reset(struct nts
|
|
return 0;
|
|
}
|
|
|
|
+static int ntsync_sem_read(struct ntsync_obj *sem, void __user *argp)
|
|
+{
|
|
+ struct ntsync_sem_args __user *user_args = argp;
|
|
+ struct ntsync_device *dev = sem->dev;
|
|
+ struct ntsync_sem_args args;
|
|
+ bool all;
|
|
+
|
|
+ if (sem->type != NTSYNC_TYPE_SEM)
|
|
+ return -EINVAL;
|
|
+
|
|
+ args.sem = 0;
|
|
+
|
|
+ all = ntsync_lock_obj(dev, sem);
|
|
+
|
|
+ args.count = sem->u.sem.count;
|
|
+ args.max = sem->u.sem.max;
|
|
+
|
|
+ ntsync_unlock_obj(dev, sem, 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;
|
|
@@ -602,6 +626,8 @@ static long ntsync_obj_ioctl(struct file
|
|
switch (cmd) {
|
|
case NTSYNC_IOC_SEM_POST:
|
|
return ntsync_sem_post(obj, argp);
|
|
+ case NTSYNC_IOC_SEM_READ:
|
|
+ return ntsync_sem_read(obj, argp);
|
|
case NTSYNC_IOC_MUTEX_UNLOCK:
|
|
return ntsync_mutex_unlock(obj, argp);
|
|
case NTSYNC_IOC_MUTEX_KILL:
|
|
--- a/include/uapi/linux/ntsync.h
|
|
+++ b/include/uapi/linux/ntsync.h
|
|
@@ -54,5 +54,6 @@ struct ntsync_wait_args {
|
|
#define NTSYNC_IOC_EVENT_SET _IOR ('N', 0x88, __u32)
|
|
#define NTSYNC_IOC_EVENT_RESET _IOR ('N', 0x89, __u32)
|
|
#define NTSYNC_IOC_EVENT_PULSE _IOR ('N', 0x8a, __u32)
|
|
+#define NTSYNC_IOC_SEM_READ _IOR ('N', 0x8b, struct ntsync_sem_args)
|
|
|
|
#endif
|