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