1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
From 21e5481c63bac11839fcb2c03bcb291867c3f8e1 Mon Sep 17 00:00:00 2001
From: Stelios Tsampas <loathingkernel@gmail.com>
Date: Mon, 23 Dec 2024 11:31:27 +0200
Subject: [PATCH] include: use ntsync.h v7 module header as an in-tree header
---
configure.ac | 1 -
dlls/ntdll/unix/sync.c | 4 +--
include/Makefile.in | 1 +
include/ntsync.h | 61 ++++++++++++++++++++++++++++++++++++++++++
server/inproc_sync.c | 4 ++-
5 files changed, 67 insertions(+), 4 deletions(-)
create mode 100644 include/ntsync.h
diff --git a/configure.ac b/configure.ac
index c9df6380cbb..5ee7e0492b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -432,7 +432,6 @@ AC_CHECK_HEADERS(\
linux/input.h \
linux/ioctl.h \
linux/major.h \
- linux/ntsync.h \
linux/param.h \
linux/seccomp.h \
linux/serial.h \
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c
index 56431dd036d..d85e610b6dd 100644
--- a/dlls/ntdll/unix/sync.c
+++ b/dlls/ntdll/unix/sync.c
@@ -60,8 +60,8 @@
#ifdef HAVE_KQUEUE
# include <sys/event.h>
#endif
-#ifdef HAVE_LINUX_NTSYNC_H
-# include <linux/ntsync.h>
+#ifdef HAVE_LINUX_TYPES_H
+# include "ntsync.h"
#endif
#include "ntstatus.h"
diff --git a/include/Makefile.in b/include/Makefile.in
index 93fe115ab7c..cfc4a739003 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -588,6 +588,7 @@ SOURCES = \
ntsecapi.h \
ntsecpkg.h \
ntstatus.h \
+ ntsync.h \
ntuser.h \
oaidl.idl \
objbase.h \
diff --git a/include/ntsync.h b/include/ntsync.h
new file mode 100644
index 00000000000..7d85cb82ca5
--- /dev/null
+++ b/include/ntsync.h
@@ -0,0 +1,61 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * Kernel support for NT synchronization primitive emulation
+ *
+ * Copyright (C) 2021-2022 Elizabeth Figura <zfigura@codeweavers.com>
+ */
+
+#ifndef __LINUX_NTSYNC_H
+#define __LINUX_NTSYNC_H
+
+#include <linux/types.h>
+
+struct ntsync_sem_args {
+ __u32 count;
+ __u32 max;
+};
+
+struct ntsync_mutex_args {
+ __u32 owner;
+ __u32 count;
+};
+
+struct ntsync_event_args {
+ __u32 manual;
+ __u32 signaled;
+};
+
+#define NTSYNC_WAIT_REALTIME 0x1
+
+struct ntsync_wait_args {
+ __u64 timeout;
+ __u64 objs;
+ __u32 count;
+ __u32 index;
+ __u32 flags;
+ __u32 owner;
+ __u32 alert;
+ __u32 pad;
+};
+
+#define NTSYNC_MAX_WAIT_COUNT 64
+
+#define NTSYNC_IOC_CREATE_SEM _IOW ('N', 0x80, struct ntsync_sem_args)
+#define NTSYNC_IOC_WAIT_ANY _IOWR('N', 0x82, struct ntsync_wait_args)
+#define NTSYNC_IOC_WAIT_ALL _IOWR('N', 0x83, struct ntsync_wait_args)
+#define NTSYNC_IOC_CREATE_MUTEX _IOW ('N', 0x84, struct ntsync_mutex_args)
+#define NTSYNC_IOC_CREATE_EVENT _IOW ('N', 0x87, struct ntsync_event_args)
+
+#define NTSYNC_IOC_SEM_RELEASE _IOWR('N', 0x81, __u32)
+#define NTSYNC_IOC_MUTEX_UNLOCK _IOWR('N', 0x85, struct ntsync_mutex_args)
+#define NTSYNC_IOC_MUTEX_KILL _IOW ('N', 0x86, __u32)
+#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)
+#define NTSYNC_IOC_MUTEX_READ _IOR ('N', 0x8c, struct ntsync_mutex_args)
+#define NTSYNC_IOC_EVENT_READ _IOR ('N', 0x8d, struct ntsync_event_args)
+
+#define HAVE_LINUX_NTSYNC_H
+
+#endif
diff --git a/server/inproc_sync.c b/server/inproc_sync.c
index 2e0480e540b..48a97b28d19 100644
--- a/server/inproc_sync.c
+++ b/server/inproc_sync.c
@@ -33,6 +33,9 @@
#include "handle.h"
#include "request.h"
#include "thread.h"
+#ifdef HAVE_LINUX_TYPES_H
+# include "ntsync.h"
+#endif
#ifdef HAVE_LINUX_NTSYNC_H
@@ -40,7 +43,6 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <linux/ntsync.h>
struct linux_device
{
|