OSDN Git Service

* include/cygwin/config.h (_GLIBC_EXTENSION): Define.
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygwin / include / cygwin / msg.h
1 /* sys/msg.h
2
3    Copyright 2002 Red Hat Inc.
4    Written by Conrad Scott <conrad.scott@dsl.pipex.com>
5
6 This file is part of Cygwin.
7
8 This software is a copyrighted work licensed under the terms of the
9 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
10 details. */
11
12 #ifndef _CYGWIN_MSG_H
13 #define _CYGWIN_MSG_H
14
15 #include <cygwin/ipc.h>
16
17 #ifdef __cplusplus
18 extern "C"
19 {
20 #endif
21
22 /* Message operation flags:
23  */
24 #define MSG_NOERROR 0x01        /* No error if big message. */
25
26 #ifdef _KERNEL
27 /* Command definitions for the semctl () function:
28  */
29 #define MSG_STAT   0x2000       /* For ipcs(8) */
30 #define MSG_INFO   0x2001       /* For ipcs(8) */
31 #endif /* _KERNEL */
32
33 /* Used for the number of messages in the message queue.
34  */
35 typedef unsigned long msgqnum_t;
36
37 /* Used for the number of bytes allowed in a message queue.
38  */
39 typedef unsigned long msglen_t;
40
41 struct msqid_ds
42 {
43   struct ipc_perm msg_perm;     /* Operation permission structure. */
44   msglen_t        msg_cbytes;   /* Number of bytes currently on queue. */
45   msgqnum_t       msg_qnum;     /* Number of messages currently on queue. */
46   msglen_t        msg_qbytes;   /* Maximum number of bytes allowed on queue. */
47   pid_t           msg_lspid;    /* Process ID of last msgsnd (). */
48   pid_t           msg_lrpid;    /* Process ID of last msgrcv (). */
49   timestruc_t     msg_stim;     /* Time of last msgsnd (). */
50   timestruc_t     msg_rtim;     /* Time of last msgrcv (). */
51   timestruc_t     msg_ctim;     /* Time of last change. */
52 #ifdef _KERNEL
53   struct msg     *msg_first;
54   struct msg     *msg_last;
55 #else
56   long            msg_spare4[2];
57 #endif /* _KERNEL */
58 };
59
60 #define msg_stime msg_stim.tv_sec
61 #define msg_rtime msg_rtim.tv_sec
62 #define msg_ctime msg_ctim.tv_sec
63
64 #ifdef _KERNEL
65 /* Buffer type for msgctl (IPC_INFO, ...) as used by ipcs(8).
66  */
67 struct msginfo
68 {
69   long msgmax;          /* Maximum number of bytes per
70                            message. */
71   long msgmnb;          /* Maximum number of bytes on any one
72                            message queue. */
73   long msgmni;          /* Maximum number of message queues,
74                            system wide. */
75   long msgtql;          /* Maximum number of messages, system
76                            wide. */
77   long msgssz;          /* Size of a message segment, must be
78                            small power of 2 greater than 4. */
79   long msgseg;          /* Number of message segments */
80   long msg_spare[2];
81 };
82
83 /* Buffer type for msgctl (MSG_INFO, ...) as used by ipcs(8).
84  */
85 struct msg_info
86 {
87   long msg_ids;         /* Number of allocated queues. */
88   long msg_num;         /* Number of messages, system wide. */
89   long msg_tot;         /* Size in bytes of messages, system wide. */
90 };
91 #endif /* _KERNEL */
92
93 int     msgctl (int msqid, int cmd, struct msqid_ds *buf);
94 int     msgget (key_t key, int msgflg);
95 ssize_t msgrcv (int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
96 int     msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg);
97
98 #ifdef __cplusplus
99 }
100 #endif
101
102 #endif /* _CYGWIN_MSG_H */