ntsync: Introduce NTSYNC_IOC_CREATE_SEM.
authorElizabeth Figura <zfigura@codeweavers.com>
Fri, 29 Mar 2024 00:05:53 +0000 (19:05 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Apr 2024 13:34:38 +0000 (15:34 +0200)
commitb46271ec40a05580d55f917c9ac52cb93553160a
treec21460fa5ae895c061008ca1026bd33af9d6f691
parent25b9cadb1ee3434b92de9096d4a2ae91820146bf
ntsync: Introduce NTSYNC_IOC_CREATE_SEM.

This corresponds to the NT syscall NtCreateSemaphore().

Semaphores are one of three types of object to be implemented in this driver,
the others being mutexes and events.

An NT semaphore contains a 32-bit counter, and is signaled and can be acquired
when the counter is nonzero. The counter has a maximum value which is specified
at creation time. The initial value of the semaphore is also specified at
creation time. There are no restrictions on the maximum and initial value.

Each object is exposed as an file, to which any number of fds may be opened.
When all fds are closed, the object is deleted.

Objects hold a pointer to the ntsync_device that created them. The device's
reference count is driven by struct file.

Signed-off-by: Elizabeth Figura <zfigura@codeweavers.com>
Link: https://lore.kernel.org/r/20240329000621.148791-3-zfigura@codeweavers.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/userspace-api/ioctl/ioctl-number.rst
drivers/misc/ntsync.c
include/uapi/linux/ntsync.h [new file with mode: 0644]