-
Notifications
You must be signed in to change notification settings - Fork 2
/
wine-ntsync.patch
5630 lines (5239 loc) · 197 KB
/
wine-ntsync.patch
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
From b8045dfd52c1afe7d8f7cdd0b82989ef6add1e16 Mon Sep 17 00:00:00 2001
From: Elizabeth Figura <zfigura@codeweavers.com>
Date: Tue, 31 Oct 2023 12:23:30 -0500
Subject: [PATCH 01/32] gcc 13 warnings
---
dlls/webservices/tests/channel.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dlls/webservices/tests/channel.c b/dlls/webservices/tests/channel.c
index c64027fb86d..ddcf8964f23 100644
--- a/dlls/webservices/tests/channel.c
+++ b/dlls/webservices/tests/channel.c
@@ -1214,6 +1214,9 @@ static const char send_record_begin[] = {
static const char send_record_middle[] = { 0x01, 0x56, 0x0e, 0x42 };
static const char send_record_end[] = { 0x08, 0x02, 0x6e, 0x73, 0x89, 0xff, 0x01, 0x01 };
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#pragma GCC diagnostic ignored "-Wstringop-overflow"
+
static BOOL send_dict_str( int sock, char *addr, const char *str, int dict_str_count )
{
char buf[512], dict_buf[256], body_buf[128], dict_size_buf[5];
--
2.46.0
From cd1fba5b2e1814f4b39c5b08d9f0e4d026f9dff5 Mon Sep 17 00:00:00 2001
From: Elizabeth Figura <zfigura@codeweavers.com>
Date: Mon, 8 Mar 2021 14:31:06 -0600
Subject: [PATCH 02/32] server: Add an object operation to retrieve a fast
synchronization object.
---
server/async.c | 2 ++
server/atom.c | 1 +
server/change.c | 1 +
server/clipboard.c | 1 +
server/completion.c | 1 +
server/console.c | 7 +++++++
server/debugger.c | 2 ++
server/device.c | 4 ++++
server/directory.c | 2 ++
server/event.c | 2 ++
server/fd.c | 4 ++++
server/file.c | 1 +
server/handle.c | 1 +
server/hook.c | 1 +
server/mailslot.c | 4 ++++
server/mapping.c | 3 +++
server/mutex.c | 1 +
server/named_pipe.c | 5 +++++
server/object.c | 6 ++++++
server/object.h | 7 +++++++
server/process.c | 3 +++
server/protocol.def | 12 ++++++++++++
server/queue.c | 2 ++
server/registry.c | 1 +
server/request.c | 1 +
server/semaphore.c | 1 +
server/serial.c | 1 +
server/signal.c | 1 +
server/sock.c | 3 +++
server/symlink.c | 1 +
server/thread.c | 3 +++
server/timer.c | 1 +
server/token.c | 1 +
server/window.c | 1 +
server/winstation.c | 2 ++
35 files changed, 90 insertions(+)
diff --git a/server/async.c b/server/async.c
index 3c9b9588c6e..6a1cdbf5ada 100644
--- a/server/async.c
+++ b/server/async.c
@@ -89,6 +89,7 @@ static const struct object_ops async_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
async_destroy /* destroy */
};
@@ -698,6 +699,7 @@ static const struct object_ops iosb_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
iosb_destroy /* destroy */
};
diff --git a/server/atom.c b/server/atom.c
index ff0799f5880..ba320c4c630 100644
--- a/server/atom.c
+++ b/server/atom.c
@@ -91,6 +91,7 @@ static const struct object_ops atom_table_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
atom_table_destroy /* destroy */
};
diff --git a/server/change.c b/server/change.c
index f773ccf8831..d687deeb21b 100644
--- a/server/change.c
+++ b/server/change.c
@@ -124,6 +124,7 @@ static const struct object_ops dir_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
dir_close_handle, /* close_handle */
dir_destroy /* destroy */
};
diff --git a/server/clipboard.c b/server/clipboard.c
index 8118a467dd8..de9f84f74d0 100644
--- a/server/clipboard.c
+++ b/server/clipboard.c
@@ -88,6 +88,7 @@ static const struct object_ops clipboard_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
clipboard_destroy /* destroy */
};
diff --git a/server/completion.c b/server/completion.c
index 6933195e72d..dd16787c63c 100644
--- a/server/completion.c
+++ b/server/completion.c
@@ -87,6 +87,7 @@ static const struct object_ops completion_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
completion_destroy /* destroy */
};
diff --git a/server/console.c b/server/console.c
index b64283baf4a..5b7e08920e8 100644
--- a/server/console.c
+++ b/server/console.c
@@ -93,6 +93,7 @@ static const struct object_ops console_ops =
NULL, /* unlink_name */
console_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
console_destroy /* destroy */
};
@@ -170,6 +171,7 @@ static const struct object_ops console_server_ops =
NULL, /* unlink_name */
console_server_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
console_server_destroy /* destroy */
};
@@ -239,6 +241,7 @@ static const struct object_ops screen_buffer_ops =
NULL, /* unlink_name */
screen_buffer_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
screen_buffer_destroy /* destroy */
};
@@ -288,6 +291,7 @@ static const struct object_ops console_device_ops =
default_unlink_name, /* unlink_name */
console_device_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
no_destroy /* destroy */
};
@@ -325,6 +329,7 @@ static const struct object_ops console_input_ops =
default_unlink_name, /* unlink_name */
console_input_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
console_input_destroy /* destroy */
};
@@ -382,6 +387,7 @@ static const struct object_ops console_output_ops =
default_unlink_name, /* unlink_name */
console_output_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
console_output_destroy /* destroy */
};
@@ -440,6 +446,7 @@ static const struct object_ops console_connection_ops =
default_unlink_name, /* unlink_name */
console_connection_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
console_connection_close_handle, /* close_handle */
console_connection_destroy /* destroy */
};
diff --git a/server/debugger.c b/server/debugger.c
index c59a0abea77..cee0c57fab3 100644
--- a/server/debugger.c
+++ b/server/debugger.c
@@ -98,6 +98,7 @@ static const struct object_ops debug_event_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
debug_event_destroy /* destroy */
};
@@ -126,6 +127,7 @@ static const struct object_ops debug_obj_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
debug_obj_destroy /* destroy */
};
diff --git a/server/device.c b/server/device.c
index 436dac6bfe9..691c0eb6b5f 100644
--- a/server/device.c
+++ b/server/device.c
@@ -78,6 +78,7 @@ static const struct object_ops irp_call_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
irp_call_destroy /* destroy */
};
@@ -118,6 +119,7 @@ static const struct object_ops device_manager_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
device_manager_destroy /* destroy */
};
@@ -175,6 +177,7 @@ static const struct object_ops device_ops =
default_unlink_name, /* unlink_name */
device_open_file, /* open_file */
device_get_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
device_destroy /* destroy */
};
@@ -227,6 +230,7 @@ static const struct object_ops device_file_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
device_file_get_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
device_file_close_handle, /* close_handle */
device_file_destroy /* destroy */
};
diff --git a/server/directory.c b/server/directory.c
index b3f055dfd01..0c9c103b6ea 100644
--- a/server/directory.c
+++ b/server/directory.c
@@ -81,6 +81,7 @@ static const struct object_ops object_type_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
no_destroy /* destroy */
};
@@ -131,6 +132,7 @@ static const struct object_ops directory_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
directory_destroy /* destroy */
};
diff --git a/server/event.c b/server/event.c
index f1b79b1b35e..d2ed6ae3df7 100644
--- a/server/event.c
+++ b/server/event.c
@@ -84,6 +84,7 @@ static const struct object_ops event_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
event_get_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
no_destroy /* destroy */
};
@@ -131,6 +132,7 @@ static const struct object_ops keyed_event_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
no_destroy /* destroy */
};
diff --git a/server/fd.c b/server/fd.c
index f28937466fc..4c0d054c673 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -181,6 +181,7 @@ static const struct object_ops fd_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
fd_destroy /* destroy */
};
@@ -222,6 +223,7 @@ static const struct object_ops device_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
device_destroy /* destroy */
};
@@ -262,6 +264,7 @@ static const struct object_ops inode_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
inode_destroy /* destroy */
};
@@ -304,6 +307,7 @@ static const struct object_ops file_lock_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
no_destroy /* destroy */
};
diff --git a/server/file.c b/server/file.c
index 76c687833c9..50d1cc21188 100644
--- a/server/file.c
+++ b/server/file.c
@@ -106,6 +106,7 @@ static const struct object_ops file_ops =
NULL, /* unlink_name */
file_open_file, /* open_file */
file_get_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
file_destroy /* destroy */
};
diff --git a/server/handle.c b/server/handle.c
index ef243e06e0b..782889daadc 100644
--- a/server/handle.c
+++ b/server/handle.c
@@ -138,6 +138,7 @@ static const struct object_ops handle_table_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
handle_table_destroy /* destroy */
};
diff --git a/server/hook.c b/server/hook.c
index c2d2823cd61..419995333ba 100644
--- a/server/hook.c
+++ b/server/hook.c
@@ -93,6 +93,7 @@ static const struct object_ops hook_table_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
hook_table_destroy /* destroy */
};
diff --git a/server/mailslot.c b/server/mailslot.c
index 7defbccdb44..40dfc8ad9d3 100644
--- a/server/mailslot.c
+++ b/server/mailslot.c
@@ -93,6 +93,7 @@ static const struct object_ops mailslot_ops =
default_unlink_name, /* unlink_name */
mailslot_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
mailslot_destroy /* destroy */
};
@@ -154,6 +155,7 @@ static const struct object_ops mail_writer_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
mail_writer_destroy /* destroy */
};
@@ -219,6 +221,7 @@ static const struct object_ops mailslot_device_ops =
default_unlink_name, /* unlink_name */
mailslot_device_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
mailslot_device_destroy /* destroy */
};
@@ -249,6 +252,7 @@ static const struct object_ops mailslot_device_file_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
mailslot_device_file_destroy /* destroy */
};
diff --git a/server/mapping.c b/server/mapping.c
index 8a34760b10e..e8980539416 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -79,6 +79,7 @@ static const struct object_ops ranges_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
ranges_destroy /* destroy */
};
@@ -115,6 +116,7 @@ static const struct object_ops shared_map_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
shared_map_destroy /* destroy */
};
@@ -188,6 +190,7 @@ static const struct object_ops mapping_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
mapping_destroy /* destroy */
};
diff --git a/server/mutex.c b/server/mutex.c
index af0efe72132..f7ad1e800c9 100644
--- a/server/mutex.c
+++ b/server/mutex.c
@@ -85,6 +85,7 @@ static const struct object_ops mutex_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
mutex_destroy /* destroy */
};
diff --git a/server/named_pipe.c b/server/named_pipe.c
index dd8c14b30a9..5eb57f320a2 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -131,6 +131,7 @@ static const struct object_ops named_pipe_ops =
default_unlink_name, /* unlink_name */
named_pipe_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
named_pipe_destroy /* destroy */
};
@@ -179,6 +180,7 @@ static const struct object_ops pipe_server_ops =
NULL, /* unlink_name */
pipe_server_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
async_close_obj_handle, /* close_handle */
pipe_server_destroy /* destroy */
};
@@ -223,6 +225,7 @@ static const struct object_ops pipe_client_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
async_close_obj_handle, /* close_handle */
pipe_end_destroy /* destroy */
};
@@ -270,6 +273,7 @@ static const struct object_ops named_pipe_device_ops =
default_unlink_name, /* unlink_name */
named_pipe_device_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
named_pipe_device_destroy /* destroy */
};
@@ -301,6 +305,7 @@ static const struct object_ops named_pipe_device_file_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
named_pipe_device_file_destroy /* destroy */
};
diff --git a/server/object.c b/server/object.c
index 36c9c60fb65..55a1573d11f 100644
--- a/server/object.c
+++ b/server/object.c
@@ -553,6 +553,12 @@ struct fd *no_get_fd( struct object *obj )
return NULL;
}
+struct fast_sync *no_get_fast_sync( struct object *obj )
+{
+ set_error( STATUS_OBJECT_TYPE_MISMATCH );
+ return NULL;
+}
+
unsigned int default_map_access( struct object *obj, unsigned int access )
{
return map_access( access, &obj->ops->type->mapping );
diff --git a/server/object.h b/server/object.h
index 2337ee88231..2b916f26f2f 100644
--- a/server/object.h
+++ b/server/object.h
@@ -42,6 +42,7 @@ struct async;
struct async_queue;
struct winstation;
struct object_type;
+struct fast_sync;
struct unicode_str
@@ -103,6 +104,8 @@ struct object_ops
unsigned int options);
/* return list of kernel objects */
struct list *(*get_kernel_obj_list)(struct object *);
+ /* get a client-waitable fast-synchronization handle to this object */
+ struct fast_sync *(*get_fast_sync)(struct object *);
/* close a handle to this object */
int (*close_handle)(struct object *,struct process *,obj_handle_t);
/* destroy on refcount == 0 */
@@ -221,6 +224,10 @@ extern void reset_event( struct event *event );
extern void abandon_mutexes( struct thread *thread );
+/* fast-synchronization functions */
+
+extern struct fast_sync *no_get_fast_sync( struct object *obj );
+
/* serial functions */
int get_serial_async_timeout(struct object *obj, int type, int count);
diff --git a/server/process.c b/server/process.c
index 155dc050d95..68b4ccff51e 100644
--- a/server/process.c
+++ b/server/process.c
@@ -117,6 +117,7 @@ static const struct object_ops process_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
process_get_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
process_destroy /* destroy */
};
@@ -168,6 +169,7 @@ static const struct object_ops startup_info_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
startup_info_destroy /* destroy */
};
@@ -229,6 +231,7 @@ static const struct object_ops job_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
job_close_handle, /* close_handle */
job_destroy /* destroy */
};
diff --git a/server/protocol.def b/server/protocol.def
index 2c791cbdd46..1f718bf80b8 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3953,3 +3953,15 @@ struct handle_info
@REPLY
int enable; /* previous state of auto-repeat enable */
@END
+
+
+enum fast_sync_type
+{
+ FAST_SYNC_SEMAPHORE = 1,
+ FAST_SYNC_MUTEX,
+ FAST_SYNC_AUTO_EVENT,
+ FAST_SYNC_MANUAL_EVENT,
+ FAST_SYNC_AUTO_SERVER,
+ FAST_SYNC_MANUAL_SERVER,
+ FAST_SYNC_QUEUE,
+};
diff --git a/server/queue.c b/server/queue.c
index 0156a4c66f2..c946b8b4a1c 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -176,6 +176,7 @@ static const struct object_ops msg_queue_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
msg_queue_destroy /* destroy */
};
@@ -213,6 +214,7 @@ static const struct object_ops thread_input_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
thread_input_destroy /* destroy */
};
diff --git a/server/registry.c b/server/registry.c
index 804cfcc638b..f6bb34e322f 100644
--- a/server/registry.c
+++ b/server/registry.c
@@ -192,6 +192,7 @@ static const struct object_ops key_ops =
key_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
key_close_handle, /* close_handle */
key_destroy /* destroy */
};
diff --git a/server/request.c b/server/request.c
index 2691e0c7cff..e0585be3203 100644
--- a/server/request.c
+++ b/server/request.c
@@ -102,6 +102,7 @@ static const struct object_ops master_socket_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
master_socket_destroy /* destroy */
};
diff --git a/server/semaphore.c b/server/semaphore.c
index 53b42a886df..1a89bd0886b 100644
--- a/server/semaphore.c
+++ b/server/semaphore.c
@@ -82,6 +82,7 @@ static const struct object_ops semaphore_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
no_destroy /* destroy */
};
diff --git a/server/serial.c b/server/serial.c
index 209f2e9174e..9a6837c3bff 100644
--- a/server/serial.c
+++ b/server/serial.c
@@ -103,6 +103,7 @@ static const struct object_ops serial_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
serial_destroy /* destroy */
};
diff --git a/server/signal.c b/server/signal.c
index 19b76d44c16..e5def3dc899 100644
--- a/server/signal.c
+++ b/server/signal.c
@@ -74,6 +74,7 @@ static const struct object_ops handler_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
handler_destroy /* destroy */
};
diff --git a/server/sock.c b/server/sock.c
index 06ffd1b81f8..11a6f3465fc 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -465,6 +465,7 @@ static const struct object_ops sock_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
sock_close_handle, /* close_handle */
sock_destroy /* destroy */
};
@@ -3574,6 +3575,7 @@ static const struct object_ops ifchange_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
ifchange_destroy /* destroy */
};
@@ -3795,6 +3797,7 @@ static const struct object_ops socket_device_ops =
default_unlink_name, /* unlink_name */
socket_device_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
no_destroy /* destroy */
};
diff --git a/server/symlink.c b/server/symlink.c
index dd28efd3a75..4a7cf68f269 100644
--- a/server/symlink.c
+++ b/server/symlink.c
@@ -83,6 +83,7 @@ static const struct object_ops symlink_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
symlink_destroy /* destroy */
};
diff --git a/server/thread.c b/server/thread.c
index 6542e1584ab..77ef21a7e9b 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -108,6 +108,7 @@ static const struct object_ops thread_apc_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
thread_apc_destroy /* destroy */
};
@@ -150,6 +151,7 @@ static const struct object_ops context_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
no_destroy /* destroy */
};
@@ -199,6 +201,7 @@ static const struct object_ops thread_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
thread_get_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
destroy_thread /* destroy */
};
diff --git a/server/timer.c b/server/timer.c
index 96dc9d00ca1..d4a69bf8794 100644
--- a/server/timer.c
+++ b/server/timer.c
@@ -88,6 +88,7 @@ static const struct object_ops timer_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
timer_destroy /* destroy */
};
diff --git a/server/token.c b/server/token.c
index da7f0bb7ff2..137dc1a6c7f 100644
--- a/server/token.c
+++ b/server/token.c
@@ -157,6 +157,7 @@ static const struct object_ops token_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
token_destroy /* destroy */
};
diff --git a/server/window.c b/server/window.c
index 564c69bf18d..56f8df33063 100644
--- a/server/window.c
+++ b/server/window.c
@@ -118,6 +118,7 @@ static const struct object_ops window_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
window_destroy /* destroy */
};
diff --git a/server/winstation.c b/server/winstation.c
index 76a23b197a4..87c3e64acac 100644
--- a/server/winstation.c
+++ b/server/winstation.c
@@ -88,6 +88,7 @@ static const struct object_ops winstation_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
winstation_close_handle, /* close_handle */
winstation_destroy /* destroy */
};
@@ -128,6 +129,7 @@ static const struct object_ops desktop_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
desktop_close_handle, /* close_handle */
desktop_destroy /* destroy */
};
--
2.46.0
From 5993bf18a0efb56c1affd2089c6e43ab7e155ead Mon Sep 17 00:00:00 2001
From: Elizabeth Figura <zfigura@codeweavers.com>
Date: Mon, 8 Mar 2021 16:38:18 -0600
Subject: [PATCH 03/32] server: Create fast synchronization objects for events.
---
configure.ac | 1 +
server/Makefile.in | 1 +
server/event.c | 30 ++++-
server/fast_sync.c | 299 +++++++++++++++++++++++++++++++++++++++++++++
server/object.h | 4 +
5 files changed, 333 insertions(+), 2 deletions(-)
create mode 100644 server/fast_sync.c
diff --git a/configure.ac b/configure.ac
index c015c049831..a2e348b3073 100644
--- a/configure.ac
+++ b/configure.ac
@@ -380,6 +380,7 @@ AC_CHECK_HEADERS(\
linux/input.h \
linux/ioctl.h \
linux/major.h \
+ linux/ntsync.h \
linux/param.h \
linux/serial.h \
linux/types.h \
diff --git a/server/Makefile.in b/server/Makefile.in
index 7e571ac2ba6..fb5998bed8b 100644
--- a/server/Makefile.in
+++ b/server/Makefile.in
@@ -12,6 +12,7 @@ SOURCES = \
device.c \
directory.c \
event.c \
+ fast_sync.c \
fd.c \
file.c \
handle.c \
diff --git a/server/event.c b/server/event.c
index d2ed6ae3df7..8c82f8445c4 100644
--- a/server/event.c
+++ b/server/event.c
@@ -56,6 +56,7 @@ struct event
struct list kernel_object; /* list of kernel object pointers */
int manual_reset; /* is it a manual reset event? */
int signaled; /* event has been signaled */
+ struct fast_sync *fast_sync; /* fast synchronization object */
};
static void event_dump( struct object *obj, int verbose );
@@ -63,6 +64,8 @@ static int event_signaled( struct object *obj, struct wait_queue_entry *entry );
static void event_satisfied( struct object *obj, struct wait_queue_entry *entry );
static int event_signal( struct object *obj, unsigned int access);
static struct list *event_get_kernel_obj_list( struct object *obj );
+static struct fast_sync *event_get_fast_sync( struct object *obj );
+static void event_destroy( struct object *obj );
static const struct object_ops event_ops =
{
@@ -84,9 +87,9 @@ static const struct object_ops event_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
event_get_kernel_obj_list, /* get_kernel_obj_list */
- no_get_fast_sync, /* get_fast_sync */
+ event_get_fast_sync, /* get_fast_sync */
no_close_handle, /* close_handle */
- no_destroy /* destroy */
+ event_destroy /* destroy */
};
@@ -152,6 +155,7 @@ struct event *create_event( struct object *root, const struct unicode_str *name,
list_init( &event->kernel_object );
event->manual_reset = manual_reset;
event->signaled = initial_state;
+ event->fast_sync = NULL;
}
}
return event;
@@ -175,11 +179,13 @@ void set_event( struct event *event )
event->signaled = 1;
/* wake up all waiters if manual reset, a single one otherwise */
wake_up( &event->obj, !event->manual_reset );
+ fast_set_event( event->fast_sync );
}
void reset_event( struct event *event )
{
event->signaled = 0;
+ fast_reset_event( event->fast_sync );
}
static void event_dump( struct object *obj, int verbose )
@@ -225,6 +231,26 @@ static struct list *event_get_kernel_obj_list( struct object *obj )
return &event->kernel_object;
}
+static struct fast_sync *event_get_fast_sync( struct object *obj )
+{
+ struct event *event = (struct event *)obj;
+
+ if (!event->fast_sync)
+ {
+ enum fast_sync_type type = event->manual_reset ? FAST_SYNC_MANUAL_EVENT : FAST_SYNC_AUTO_EVENT;
+ event->fast_sync = fast_create_event( type, event->signaled );
+ }
+ if (event->fast_sync) grab_object( event->fast_sync );
+ return event->fast_sync;
+}
+
+static void event_destroy( struct object *obj )
+{
+ struct event *event = (struct event *)obj;
+
+ if (event->fast_sync) release_object( event->fast_sync );
+}
+
struct keyed_event *create_keyed_event( struct object *root, const struct unicode_str *name,
unsigned int attr, const struct security_descriptor *sd )
{
diff --git a/server/fast_sync.c b/server/fast_sync.c
new file mode 100644
index 00000000000..3100abd2630
--- /dev/null
+++ b/server/fast_sync.c
@@ -0,0 +1,299 @@
+/*
+ * Fast synchronization primitives
+ *
+ * Copyright (C) 2021-2022 Elizabeth Figura for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+
+#include <assert.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "winternl.h"
+
+#include "file.h"
+#include "thread.h"
+
+#ifdef HAVE_LINUX_NTSYNC_H
+
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <linux/ntsync.h>
+
+struct linux_device
+{
+ struct object obj; /* object header */
+ struct fd *fd; /* fd for unix fd */
+};
+
+static struct linux_device *linux_device_object;
+
+static void linux_device_dump( struct object *obj, int verbose );
+static struct fd *linux_device_get_fd( struct object *obj );
+static void linux_device_destroy( struct object *obj );
+static enum server_fd_type fast_sync_get_fd_type( struct fd *fd );
+
+static const struct object_ops linux_device_ops =
+{
+ sizeof(struct linux_device), /* size */
+ &no_type, /* type */
+ linux_device_dump, /* dump */
+ no_add_queue, /* add_queue */
+ NULL, /* remove_queue */
+ NULL, /* signaled */
+ NULL, /* satisfied */
+ no_signal, /* signal */
+ linux_device_get_fd, /* get_fd */
+ default_map_access, /* map_access */
+ default_get_sd, /* get_sd */
+ default_set_sd, /* set_sd */
+ no_get_full_name, /* get_full_name */
+ no_lookup_name, /* lookup_name */
+ no_link_name, /* link_name */
+ NULL, /* unlink_name */
+ no_open_file, /* open_file */
+ no_kernel_obj_list, /* get_kernel_obj_list */
+ no_get_fast_sync, /* get_fast_sync */
+ no_close_handle, /* close_handle */
+ linux_device_destroy /* destroy */
+};
+
+static const struct fd_ops fast_sync_fd_ops =
+{
+ default_fd_get_poll_events, /* get_poll_events */