#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