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 #ifndef __pid_t_defined
56 #ifndef _PID_T_
57 typedef int pid_t;
58 #define __pid_t_defined
59 #define _PID_T_
60 #endif // ! _PID_T_
61 #endif // ! __pid_t_defined
62 
63 typedef unsigned long int msgqnum_t;
64 typedef unsigned long int msglen_t;
65 
66 struct ipc_perm
67 {
68  key_t __key; /* Key. */
69  uid_t uid; /* Owner's user ID. */
70  gid_t gid; /* Owner's group ID. */
71  uid_t cuid; /* Creator's user ID. */
72  gid_t cgid; /* Creator's group ID. */
73  unsigned short int mode; /* Read/write permission. */
74  unsigned short int __pad1;
75  unsigned short int __seq; /* Sequence number. */
76  unsigned short int __pad2;
77  unsigned long int __unused1;
78  unsigned long int __unused2;
79 };
80 struct msqid_ds
81 {
82  struct ipc_perm msg_perm; /* structure describing operation permission */
83  time_t msg_stime; /* time of last msgsnd command */
84  unsigned long int __unused1;
85  time_t msg_rtime; /* time of last msgrcv command */
86  unsigned long int __unused2;
87  time_t msg_ctime; /* time of last change */
88  unsigned long int __unused3;
89  unsigned long int __msg_cbytes; /* current number of bytes on queue */
90  msgqnum_t msg_qnum; /* number of messages currently on queue */
91  msglen_t msg_qbytes; /* max number of bytes allowed on queue */
92  pid_t msg_lspid; /* pid of last msgsnd() */
93  pid_t msg_lrpid; /* pid of last msgrcv() */
94  unsigned long int __unused4;
95  unsigned long int __unused5;
96 };
97 
98 int msgget(key_t key, int msgflg);
99 int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);
100 ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
101 int msgctl(int msqid, int cmd, struct msqid_ds *buf);
102 
103 #else
104 // Linux用
105 
106 #include <sys/ipc.h>
107 #include <sys/msg.h>
108 
109 #endif // __MINGW32__
110 
111 #endif // MSQ_WIN32_H


yp-spur
Author(s):
autogenerated on Fri May 7 2021 02:12:17