xref: /freebsd/sys/dev/ntsync/linux_ntsync.h (revision 73e0d6b44038d1c7764c5013a54ae17a8f680a69)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * Kernel support for NT synchronization primitive emulation
4  *
5  * Copyright (C) 2021-2022 Elizabeth Figura <zfigura@codeweavers.com>
6  */
7 
8 #ifndef __LINUX_NTSYNC_H
9 #define __LINUX_NTSYNC_H
10 
11 #include <sys/types.h>
12 
13 typedef	uint32_t	__u32;
14 typedef	uint64_t	__u64;
15 
16 struct linux_ntsync_sem_args {
17 	__u32 count;
18 	__u32 max;
19 };
20 
21 struct linux_ntsync_mutex_args {
22 	__u32 owner;
23 	__u32 count;
24 };
25 
26 struct linux_ntsync_event_args {
27 	__u32 manual;
28 	__u32 signaled;
29 };
30 
31 #define LINUX_NTSYNC_WAIT_REALTIME	0x1
32 
33 struct linux_ntsync_wait_args {
34 	__u64 timeout;
35 	__u64 objs;
36 	__u32 count;
37 	__u32 index;
38 	__u32 flags;
39 	__u32 owner;
40 	__u32 alert;
41 	__u32 pad;
42 };
43 
44 #define	LNTSYNC_IOC_CREATE_SEM		0x40084e80
45 #define	LNTSYNC_IOC_WAIT_ANY		0xc0284e82
46 #define	LNTSYNC_IOC_WAIT_ALL		0xc0284e83
47 #define	LNTSYNC_IOC_CREATE_MUTEX	0x40084e84
48 #define	LNTSYNC_IOC_CREATE_EVENT	0x40084e87
49 #define	LNTSYNC_IOC_SEM_RELEASE		0xc0044e81
50 #define	LNTSYNC_IOC_MUTEX_UNLOCK	0xc0084e85
51 #define	LNTSYNC_IOC_MUTEX_KILL		0x40044e86
52 #define	LNTSYNC_IOC_EVENT_SET		0x80044e88
53 #define	LNTSYNC_IOC_EVENT_RESET		0x80044e89
54 #define	LNTSYNC_IOC_EVENT_PULSE		0x80044e8a
55 #define	LNTSYNC_IOC_SEM_READ		0x80084e8b
56 #define	LNTSYNC_IOC_MUTEX_READ		0x80084e8c
57 #define	LNTSYNC_IOC_EVENT_READ		0x80084e8d
58 
59 #define LNTSYNC_IOCTL_MIN		0x4e80
60 #define LNTSYNC_IOCTL_MAX		0x4eff
61 
62 #endif
63