summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-07-30 21:21:21 +0000
committermidipix <writeonce@midipix.org>2017-07-31 08:43:34 -0400
commit4a2e495c3aae5ba119844ba689c1eb282c1f49a8 (patch)
tree36fffb95ccc91f4360d701fee852c5f1af924e80 /include
parent7e3ebda55a15849f5cc1e7ab53edfeedd9fae635 (diff)
downloadntapi-4a2e495c3aae5ba119844ba689c1eb282c1f49a8.tar.bz2
ntapi-4a2e495c3aae5ba119844ba689c1eb282c1f49a8.tar.xz
subsystem interfaces: integrated sysv semaphore definitions.
Diffstat (limited to 'include')
-rw-r--r--include/ntapi/nt_ipc.h23
-rw-r--r--include/ntapi/nt_port.h4
-rw-r--r--include/ntapi/nt_sem.h66
-rw-r--r--include/ntapi/nt_tty.h24
4 files changed, 117 insertions, 0 deletions
diff --git a/include/ntapi/nt_ipc.h b/include/ntapi/nt_ipc.h
index d799587..80fc34c 100644
--- a/include/ntapi/nt_ipc.h
+++ b/include/ntapi/nt_ipc.h
@@ -4,6 +4,29 @@
#include "nt_abi.h"
#include "nt_object.h"
+/* friendly ipc guids */
+#define NT_IPC_GUID_SEMCTL {0xe47c05df,0x5f5c,0x4762,{0xa2,0x79,0xd2,0x82,0xf5,0x39,0xea,0xdf}}
+#define NT_IPC_GUID_SEMKEY {0xc6e442c3,0x2ac5,0x4d1d,{0x92,0xf3,0x6e,0x10,0xc6,0x1f,0x53,0x79}}
+#define NT_IPC_GUID_SEMPID {0x571ac9bb,0x22eb,0x43f2,{0x8d,0xd6,0x64,0x39,0x49,0xa6,0xe9,0x1f}}
+
+/* friendly ipc object directory prefixes */
+#define NT_IPC_OBJDIR_PREFIX_SEMCTL {'s','e','m','c','t','l'}
+#define NT_IPC_OBJDIR_PREFIX_SEMKEY {'s','e','m','k','e','y'}
+#define NT_IPC_OBJDIR_PREFIX_SEMPID {'s','e','m','p','i','d'}
+
+
+/* ipc commands */
+#define NT_IPC_CMD_RMID (0)
+#define NT_IPC_CMD_SET (1)
+#define NT_IPC_CMD_STAT (2)
+#define NT_IPC_CMD_INFO (3)
+
+
+/* ipc special keys */
+#define NT_IPC_KEY_PRIVATE (0)
+
+
+/* ipc extension interfaces */
typedef int32_t __stdcall ntapi_ipc_create_pipe(
__out void ** hpipe_read,
__out void ** hpipe_write,
diff --git a/include/ntapi/nt_port.h b/include/ntapi/nt_port.h
index 9bfa440..45755e0 100644
--- a/include/ntapi/nt_port.h
+++ b/include/ntapi/nt_port.h
@@ -35,6 +35,8 @@ typedef enum _nt_port_type {
NT_PORT_TYPE_DAEMON, /* {'d','a','e','m','o','n'} */
NT_PORT_TYPE_SYMLNK, /* {'s','y','m','l','n','k'} */
NT_PORT_TYPE_NTPROC, /* {'n','t','p','r','o','c'} */
+ NT_PORT_TYPE_SEMCTL, /* {'s','e','m','c','t','l'} */
+ NT_PORT_TYPE_SEMSVC, /* {'s','e','m','s','v','c'} */
NT_PORT_TYPE_CAP
} nt_port_type;
@@ -53,6 +55,8 @@ typedef enum _nt_port_subtype {
#define NT_PORT_GUID_DAEMON {0xcf765d9e,0x6bd8,0x4a8d,{0x8a,0x21,0x17,0x34,0xcd,0x3a,0x8d,0xa7}}
#define NT_PORT_GUID_SYMLNK {0xfe1b8480,0x833d,0x44df,{0x90,0x99,0xc1,0xf6,0x9c,0x11,0xd4,0x0b}}
#define NT_PORT_GUID_NTPROC {0xd7f3f3a5,0x3e82,0x4f3e,{0x9d,0x6c,0x36,0x18,0xde,0xfa,0xc6,0x69}}
+#define NT_PORT_GUID_SEMCTL {0x7850be42,0x7eef,0x4c3d,{0xa7,0x05,0xa4,0xd8,0x47,0x3f,0x67,0x56}}
+#define NT_PORT_GUID_SEMSVC {0xa50f4380,0x854a,0x4260,{0x9d,0x8d,0xc2,0xc2,0xa1,0x16,0xde,0xf3}}
/* lpc messages */
#define NT_LPC_REFUSE_CONNECTION 0x0000
diff --git a/include/ntapi/nt_sem.h b/include/ntapi/nt_sem.h
new file mode 100644
index 0000000..768007d
--- /dev/null
+++ b/include/ntapi/nt_sem.h
@@ -0,0 +1,66 @@
+#ifndef _NT_SEM_H_
+#define _NT_SEM_H_
+
+#include "nt_abi.h"
+#include "nt_object.h"
+
+/* semaphore commands */
+#define NT_SEM_CMD_GETPID (11)
+#define NT_SEM_CMD_GETVAL (12)
+#define NT_SEM_CMD_GETALL (13)
+#define NT_SEM_CMD_GETNCNT (14)
+#define NT_SEM_CMD_GETZCNT (15)
+#define NT_SEM_CMD_SETVAL (16)
+#define NT_SEM_CMD_SETALL (17)
+
+
+/* semaphore command flags */
+#define NT_SEM_FLAG_NOWAIT (0x0800)
+#define NT_SEM_FLAG_UNDO (0x1000)
+
+
+/* semaphore info */
+typedef struct __attr_ptr_size_aligned__ _nt_sem_info {
+ void * hport;
+ void * hprocess;
+ void * hthread;
+ void * section;
+ void * section_addr;
+ size_t section_size;
+ void * apc_routine;
+ void * apc_context;
+ int32_t semkey;
+ int32_t semslots;
+ int32_t semid;
+ int32_t semnum;
+ int32_t semcmd;
+ int32_t sempid;
+ int32_t semncnt;
+ int32_t semzcnt;
+ int32_t semval;
+ int32_t semadj;
+ nt_filetime semotime;
+ nt_filetime semctime;
+ uint32_t ipcuid;
+ uint32_t ipcgid;
+ uint32_t ipccuid;
+ uint32_t ipccgid;
+ uint32_t ipcmode;
+ int32_t ipcseq;
+ uint32_t ntaccess;
+ uint32_t ntattr;
+ uint32_t ntshare;
+ uint32_t ntoptions;
+ nt_iosb * riosb;
+ void * hevent[2];
+} nt_sem_info;
+
+
+/* semaphore operation */
+typedef struct _nt_sem_op {
+ uint16_t semnum;
+ int16_t semop;
+ int16_t semflag;
+} nt_sem_op;
+
+#endif
diff --git a/include/ntapi/nt_tty.h b/include/ntapi/nt_tty.h
index dc8c4f3..f0d7c5d 100644
--- a/include/ntapi/nt_tty.h
+++ b/include/ntapi/nt_tty.h
@@ -15,6 +15,7 @@
#include "nt_process.h"
#include "nt_port.h"
#include "nt_termios.h"
+#include "nt_sem.h"
/* tty affiliation */
typedef struct _nt_tty_affiliation {
@@ -59,6 +60,7 @@ typedef enum _nt_tty_opcode {
NT_TTY_QUERY_INFORMATION_THREAD,
NT_TTY_QUERY_INFORMATION_SECTION,
NT_TTY_QUERY_INFORMATION_PTY,
+ NT_TTY_QUERY_INFORMATION_SEMAPHORE,
/* peer daemon calls */
NT_TTY_REQUEST_PEER,
NT_TTY_SIGNAL_PEER,
@@ -73,6 +75,17 @@ typedef enum _nt_tty_opcode {
NT_TTY_PTY_IOCTL,
NT_TTY_PTY_CANCEL,
NT_TTY_PTY_PEEK,
+ /* semaphore */
+ NT_TTY_SEM_ALLOC,
+ NT_TTY_SEM_FREE,
+ NT_TTY_SEM_OPEN,
+ NT_TTY_SEM_CLOSE,
+ NT_TTY_SEM_QUERY,
+ NT_TTY_SEM_SET,
+ NT_TTY_SEM_FCNTL,
+ NT_TTY_SEM_IOCTL,
+ NT_TTY_SEM_CANCEL,
+ NT_TTY_SEM_TRACE,
/* virtual mount system */
NT_TTY_VMS_QUERY,
NT_TTY_VMS_REQUEST,
@@ -100,6 +113,7 @@ typedef enum _nt_tty_server_info_class {
NT_TTY_SERVER_PTS_SLOT_INFORMATION,
NT_TTY_SERVER_DBM_SLOT_INFORMATION,
NT_TTY_SERVER_DBG_SLOT_INFORMATION,
+ NT_TTY_SERVER_SEM_SLOT_INFORMATION,
NT_TTY_SERVER_INFORMATION_CAP
} nt_tty_server_info_class;
@@ -312,6 +326,15 @@ typedef struct __attr_ptr_size_aligned__ _nt_pty_sigctl_msg {
} nt_pty_sigctl_msg;
+typedef struct __attr_ptr_size_aligned__ _nt_sem_info_msg {
+ nt_port_message header;
+ struct {
+ nt_tty_msg_info ttyinfo;
+ nt_sem_info seminfo;
+ } data;
+} nt_sem_info_msg;
+
+
typedef struct __attr_ptr_size_aligned__ _nt_tty_session_msg {
nt_port_message header;
struct {
@@ -333,6 +356,7 @@ typedef struct __attr_ptr_size_aligned__ _nt_tty_port_msg {
nt_pty_io_info ioinfo;
nt_pty_client_info clientinfo;
nt_tty_session_info sessioninfo;
+ nt_sem_info seminfo;
};
} nt_tty_port_msg;