master
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 <linux/types.h>
12
13struct ntsync_sem_args {
14 __u32 count;
15 __u32 max;
16};
17
18struct ntsync_mutex_args {
19 __u32 owner;
20 __u32 count;
21};
22
23struct ntsync_event_args {
24 __u32 manual;
25 __u32 signaled;
26};
27
28#define NTSYNC_WAIT_REALTIME 0x1
29
30struct ntsync_wait_args {
31 __u64 timeout;
32 __u64 objs;
33 __u32 count;
34 __u32 index;
35 __u32 flags;
36 __u32 owner;
37 __u32 alert;
38 __u32 pad;
39};
40
41#define NTSYNC_MAX_WAIT_COUNT 64
42
43#define NTSYNC_IOC_CREATE_SEM _IOW ('N', 0x80, struct ntsync_sem_args)
44#define NTSYNC_IOC_WAIT_ANY _IOWR('N', 0x82, struct ntsync_wait_args)
45#define NTSYNC_IOC_WAIT_ALL _IOWR('N', 0x83, struct ntsync_wait_args)
46#define NTSYNC_IOC_CREATE_MUTEX _IOW ('N', 0x84, struct ntsync_mutex_args)
47#define NTSYNC_IOC_CREATE_EVENT _IOW ('N', 0x87, struct ntsync_event_args)
48
49#define NTSYNC_IOC_SEM_RELEASE _IOWR('N', 0x81, __u32)
50#define NTSYNC_IOC_MUTEX_UNLOCK _IOWR('N', 0x85, struct ntsync_mutex_args)
51#define NTSYNC_IOC_MUTEX_KILL _IOW ('N', 0x86, __u32)
52#define NTSYNC_IOC_EVENT_SET _IOR ('N', 0x88, __u32)
53#define NTSYNC_IOC_EVENT_RESET _IOR ('N', 0x89, __u32)
54#define NTSYNC_IOC_EVENT_PULSE _IOR ('N', 0x8a, __u32)
55#define NTSYNC_IOC_SEM_READ _IOR ('N', 0x8b, struct ntsync_sem_args)
56#define NTSYNC_IOC_MUTEX_READ _IOR ('N', 0x8c, struct ntsync_mutex_args)
57#define NTSYNC_IOC_EVENT_READ _IOR ('N', 0x8d, struct ntsync_event_args)
58
59#endif