History

ntsync: Introduce NTSYNC_IOC_CREATE_MUTEX.

This corresponds to the NT syscall NtCreateMutant(). An NT mutex is recursive, with a 32-bit recursion counter. When acquired via NtWaitForMultipleObjects(), the recursion counter is incremented by one. The OS records the thread which acquired it. The OS records the thread which acquired it. However, in order to keep this driver self-contained, the owning thread ID is managed by user-space, and passed as a parameter to all relevant ioctls. The initial owner and recursion count, if any, are specified when the mutex is created.

Elizabeth Figura committed 1 year ago

Commit 5bc24791 parent cdbb9972 files · +79 −4Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/linux/ntsync.h+8−1
@@ -15,6 +15,11 @@ struct ntsync_sem_args { · 14 unmodified lines
15 __u32 max;15 __u32 max;
16};16};
17 17
18struct ntsync_mutex_args {
19 __u32 owner;
20 __u32 count;
21};
22
18#define NTSYNC_WAIT_REALTIME 0x123#define NTSYNC_WAIT_REALTIME 0x1
19 24
20struct ntsync_wait_args {25struct ntsync_wait_args {
@@ -23,7 +28,8 @@ struct ntsync_wait_args { · 2 unmodified lines
23 __u32 count;28 __u32 count;
24 __u32 index;29 __u32 index;
25 __u32 flags;30 __u32 flags;
26 __u32 pad[3];31 __u32 owner;
32 __u32 pad[2];
27};33};
28 34
29#define NTSYNC_MAX_WAIT_COUNT 6435#define NTSYNC_MAX_WAIT_COUNT 64
@@ -31,6 +37,7 @@ struct ntsync_wait_args { · 1 unmodified line
31#define NTSYNC_IOC_CREATE_SEM _IOW ('N', 0x80, struct ntsync_sem_args)37#define NTSYNC_IOC_CREATE_SEM _IOW ('N', 0x80, struct ntsync_sem_args)
32#define NTSYNC_IOC_WAIT_ANY _IOWR('N', 0x82, struct ntsync_wait_args)38#define NTSYNC_IOC_WAIT_ANY _IOWR('N', 0x82, struct ntsync_wait_args)
33#define NTSYNC_IOC_WAIT_ALL _IOWR('N', 0x83, struct ntsync_wait_args)39#define NTSYNC_IOC_WAIT_ALL _IOWR('N', 0x83, struct ntsync_wait_args)
40#define NTSYNC_IOC_CREATE_MUTEX _IOW ('N', 0x84, struct ntsync_mutex_args)
34 41
35#define NTSYNC_IOC_SEM_RELEASE _IOWR('N', 0x81, __u32)42#define NTSYNC_IOC_SEM_RELEASE _IOWR('N', 0x81, __u32)
36 43