Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mqueue_types.h « cygwin « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4d0d910e43d846bf47078833acce2fc31d7fa4cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* mqueue_types.h: internal POSIX message queue types

This file is part of Cygwin.

This software is a copyrighted work licensed under the terms of the
Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
details. */

#pragma once

#define MQI_MAGIC	0x98765432UL

/* The mq_attr structure is defined using long datatypes per POSIX.
   The mq_fattr is the in-file representation of the mq_attr struct.
   Originally created this way for 32/64 bit interoperability, this
   is of no concern anymore. */
#pragma pack (push, 4)
struct mq_fattr
{
  uint32_t mq_flags;
  uint32_t mq_maxmsg;
  uint32_t mq_msgsize;
  uint32_t mq_curmsgs;
};

struct mq_hdr
{
  struct mq_fattr   mqh_attr;	 /* the queue's attributes */
  int32_t           mqh_head;	 /* index of first message */
  int32_t           mqh_free;	 /* index of first free message */
  int32_t           mqh_nwait;	 /* #threads blocked in mq_receive() */
  pid_t             mqh_pid;	 /* nonzero PID if mqh_event set */
  uint32_t        __mqh_ext[36]; /* free for extensions */
  union {
    struct sigevent mqh_event;	 /* for mq_notify() */
    uint64_t      __mqh_dummy[4];
  };
  uint64_t        __mqh_ext2[4]; /* free for extensions */
  uint32_t          mqh_magic;	 /* Expect MQI_MAGIC here, otherwise it's
				    an old-style message queue. */
};

struct msg_hdr
{
  int32_t         msg_next;	 /* index of next on linked list */
  int32_t         msg_len;	 /* actual length */
  unsigned int    msg_prio;	 /* priority */
};
#pragma pack (pop)

struct mq_info
{
  struct mq_hdr  *mqi_hdr;	 /* start of mmap'ed region */
  HANDLE          mqi_sect;      /* file mapping section handle */
  SIZE_T          mqi_sectsize;  /* file mapping section size */
  mode_t          mqi_mode;      /* st_mode of the mapped file */
  HANDLE          mqi_lock;	 /* mutex lock */
  HANDLE          mqi_waitsend;	 /* and condition variable for full queue */
  HANDLE          mqi_waitrecv;	 /* and condition variable for empty queue */
  uint32_t        mqi_magic;	 /* magic number if open */
};