xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame^] | 1 | /* Copyright (C) 1995-2016 Free Software Foundation, Inc. |
| 2 | This file is part of the GNU C Library. |
| 3 | |
| 4 | The GNU C Library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with the GNU C Library; if not, see |
| 16 | <http://www.gnu.org/licenses/>. */ |
| 17 | |
| 18 | #ifndef _SYS_MSG_H |
| 19 | #define _SYS_MSG_H |
| 20 | |
| 21 | #include <features.h> |
| 22 | |
| 23 | #define __need_size_t |
| 24 | #include <stddef.h> |
| 25 | |
| 26 | /* Get common definition of System V style IPC. */ |
| 27 | #include <sys/ipc.h> |
| 28 | |
| 29 | /* Get system dependent definition of `struct msqid_ds' and more. */ |
| 30 | #include <bits/msq.h> |
| 31 | |
| 32 | /* Define types required by the standard. */ |
| 33 | #define __need_time_t |
| 34 | #include <time.h> |
| 35 | |
| 36 | #ifndef __pid_t_defined |
| 37 | typedef __pid_t pid_t; |
| 38 | # define __pid_t_defined |
| 39 | #endif |
| 40 | |
| 41 | #ifndef __ssize_t_defined |
| 42 | typedef __ssize_t ssize_t; |
| 43 | # define __ssize_t_defined |
| 44 | #endif |
| 45 | |
| 46 | /* The following System V style IPC functions implement a message queue |
| 47 | system. The definition is found in XPG2. */ |
| 48 | |
| 49 | #ifdef __USE_GNU |
| 50 | /* Template for struct to be used as argument for `msgsnd' and `msgrcv'. */ |
| 51 | struct msgbuf |
| 52 | { |
| 53 | __syscall_slong_t mtype; /* type of received/sent message */ |
| 54 | char mtext[1]; /* text of the message */ |
| 55 | }; |
| 56 | #endif |
| 57 | |
| 58 | |
| 59 | __BEGIN_DECLS |
| 60 | |
| 61 | /* Message queue control operation. */ |
| 62 | extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW; |
| 63 | |
| 64 | /* Get messages queue. */ |
| 65 | extern int msgget (key_t __key, int __msgflg) __THROW; |
| 66 | |
| 67 | /* Receive message from message queue. |
| 68 | |
| 69 | This function is a cancellation point and therefore not marked with |
| 70 | __THROW. */ |
| 71 | extern ssize_t msgrcv (int __msqid, void *__msgp, size_t __msgsz, |
| 72 | long int __msgtyp, int __msgflg); |
| 73 | |
| 74 | /* Send message to message queue. |
| 75 | |
| 76 | This function is a cancellation point and therefore not marked with |
| 77 | __THROW. */ |
| 78 | extern int msgsnd (int __msqid, const void *__msgp, size_t __msgsz, |
| 79 | int __msgflg); |
| 80 | |
| 81 | __END_DECLS |
| 82 | |
| 83 | #endif /* sys/msg.h */ |