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
1515 __u32 max;
1616 };
1717
18+struct ntsync_mutex_args {
19+ __u32 owner;
20+ __u32 count;
21+};
22+
1823 #define NTSYNC_WAIT_REALTIME 0x1
1924
2025 struct ntsync_wait_args {
@@ -23,7 +28,8 @@ struct ntsync_wait_args { · 2 unmodified lines
2328 __u32 count;
2429 __u32 index;
2530 __u32 flags;
26− __u32 pad[3];
31+ __u32 owner;
32+ __u32 pad[2];
2733 };
2834
2935 #define NTSYNC_MAX_WAIT_COUNT 64
@@ -31,6 +37,7 @@ struct ntsync_wait_args { · 1 unmodified line
3137 #define NTSYNC_IOC_CREATE_SEM _IOW ('N', 0x80, struct ntsync_sem_args)
3238 #define NTSYNC_IOC_WAIT_ANY _IOWR('N', 0x82, struct ntsync_wait_args)
3339 #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)
3441
3542 #define NTSYNC_IOC_SEM_RELEASE _IOWR('N', 0x81, __u32)
3643