msq.win32.h
Go to the documentation of this file.
1 // Copyright (c) 2010-2016 The YP-Spur Authors, except where otherwise indicated.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to
5 // deal in the Software without restriction, including without limitation the
6 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 // sell copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 // SOFTWARE.
20 
21 #ifndef MSQ_WIN32_H
22 #define MSQ_WIN32_H
23 
24 #include <sys/types.h>
25 
26 #ifdef __MINGW32__
27 // Windows用
28 
29 #include <windows.h>
30 
31 #include <unistd.h>
32 
33 #define IPC_CREAT 01000
34 #define IPC_EXCL 02000
35 #define IPC_NOWAIT 04000
36 #define IPC_RMID 0
37 #define IPC_SET 1
38 #define IPC_STAT 2
39 
40 #ifndef __key_t_defined
41 typedef int key_t;
42 #define __key_t_defined
43 #endif // __key_t_defined
44 
45 #ifndef __uid_t_defined
46 typedef int uid_t;
47 #define __uid_t_defined
48 #endif // __uid_t_defined
49 
50 #ifndef __gid_t_defined
51 typedef int gid_t;
52 #define __gid_t_defined
53 #endif // __gid_t_defined
54 
55 typedef unsigned long int msgqnum_t;
56 typedef unsigned long int msglen_t;
57 
58 struct ipc_perm
59 {
60  key_t __key; /* Key. */
61  uid_t uid; /* Owner's user ID. */
62  gid_t gid; /* Owner's group ID. */
63  uid_t cuid; /* Creator's user ID. */
64  gid_t cgid; /* Creator's group ID. */
65  unsigned short int mode; /* Read/write permission. */
66  unsigned short int __pad1;
67  unsigned short int __seq; /* Sequence number. */
68  unsigned short int __pad2;
69  unsigned long int __unused1;
70  unsigned long int __unused2;
71 };
72 struct msqid_ds
73 {
74  struct ipc_perm msg_perm; /* structure describing operation permission */
75  time_t msg_stime; /* time of last msgsnd command */
76  unsigned long int __unused1;
77  time_t msg_rtime; /* time of last msgrcv command */
78  unsigned long int __unused2;
79  time_t msg_ctime; /* time of last change */
80  unsigned long int __unused3;
81  unsigned long int __msg_cbytes; /* current number of bytes on queue */
82  msgqnum_t msg_qnum; /* number of messages currently on queue */
83  msglen_t msg_qbytes; /* max number of bytes allowed on queue */
84  pid_t msg_lspid; /* pid of last msgsnd() */
85  pid_t msg_lrpid; /* pid of last msgrcv() */
86  unsigned long int __unused4;
87  unsigned long int __unused5;
88 };
89 
90 int msgget(key_t key, int msgflg);
91 int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);
92 ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
93 int msgctl(int msqid, int cmd, struct msqid_ds *buf);
94 
95 #else
96 // Linux用
97 
98 #include <sys/ipc.h>
99 #include <sys/msg.h>
100 
101 #endif // __MINGW32__
102 
103 #endif // MSQ_WIN32_H


yp-spur
Author(s):
autogenerated on Sat May 11 2019 02:08:24