Back to index

glibc  2.9
msg.h
Go to the documentation of this file.
00001 /* Copyright (C) 1995-1997,1999,2000,2003,2006,2007
00002    Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef _SYS_MSG_H
00021 #define _SYS_MSG_H
00022 
00023 #include <features.h>
00024 
00025 #define __need_size_t
00026 #include <stddef.h>
00027 
00028 /* Get common definition of System V style IPC.  */
00029 #include <sys/ipc.h>
00030 
00031 /* Get system dependent definition of `struct msqid_ds' and more.  */
00032 #include <bits/msq.h>
00033 
00034 /* Define types required by the standard.  */
00035 #define       __need_time_t
00036 #include <time.h>
00037 
00038 #ifndef __pid_t_defined
00039 typedef __pid_t pid_t;
00040 # define __pid_t_defined
00041 #endif
00042 
00043 #ifndef __ssize_t_defined
00044 typedef __ssize_t ssize_t;
00045 # define __ssize_t_defined
00046 #endif
00047 
00048 /* The following System V style IPC functions implement a message queue
00049    system.  The definition is found in XPG2.  */
00050 
00051 #ifdef __USE_GNU
00052 /* Template for struct to be used as argument for `msgsnd' and `msgrcv'.  */
00053 struct msgbuf
00054   {
00055     long int mtype;         /* type of received/sent message */
00056     char mtext[1];          /* text of the message */
00057   };
00058 #endif
00059 
00060 
00061 __BEGIN_DECLS
00062 
00063 /* Message queue control operation.  */
00064 extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW;
00065 
00066 /* Get messages queue.  */
00067 extern int msgget (key_t __key, int __msgflg) __THROW;
00068 
00069 /* Receive message from message queue.
00070 
00071    This function is a cancellation point and therefore not marked with
00072    __THROW.  */
00073 extern ssize_t msgrcv (int __msqid, void *__msgp, size_t __msgsz,
00074                      long int __msgtyp, int __msgflg);
00075 
00076 /* Send message to message queue.
00077 
00078    This function is a cancellation point and therefore not marked with
00079    __THROW.  */
00080 extern int msgsnd (int __msqid, __const void *__msgp, size_t __msgsz,
00081                  int __msgflg);
00082 
00083 __END_DECLS
00084 
00085 #endif /* sys/msg.h */