Home | History | Annotate | Download | only in sys
      1 /* Copyright (C) 1995-1997,1999,2000,2003,2006,2007
      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, write to the Free
     17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
     18    02111-1307 USA.  */
     19 
     20 #ifndef _SYS_MSG_H
     21 #define _SYS_MSG_H
     22 
     23 #include <features.h>
     24 
     25 #define __need_size_t
     26 #include <stddef.h>
     27 
     28 /* Get common definition of System V style IPC.  */
     29 #include <sys/ipc.h>
     30 
     31 /* Get system dependent definition of `struct msqid_ds' and more.  */
     32 #include <bits/msq.h>
     33 
     34 /* Define types required by the standard.  */
     35 #define	__need_time_t
     36 #include <time.h>
     37 
     38 #ifndef __pid_t_defined
     39 typedef __pid_t pid_t;
     40 # define __pid_t_defined
     41 #endif
     42 
     43 #ifndef __ssize_t_defined
     44 typedef __ssize_t ssize_t;
     45 # define __ssize_t_defined
     46 #endif
     47 
     48 /* The following System V style IPC functions implement a message queue
     49    system.  The definition is found in XPG2.  */
     50 
     51 #ifdef __USE_GNU
     52 /* Template for struct to be used as argument for `msgsnd' and `msgrcv'.  */
     53 struct msgbuf
     54   {
     55     long int mtype;		/* type of received/sent message */
     56     char mtext[1];		/* text of the message */
     57   };
     58 #endif
     59 
     60 
     61 __BEGIN_DECLS
     62 
     63 /* Message queue control operation.  */
     64 extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW;
     65 
     66 /* Get messages queue.  */
     67 extern int msgget (key_t __key, int __msgflg) __THROW;
     68 
     69 /* Receive message from message queue.
     70 
     71    This function is a cancellation point and therefore not marked with
     72    __THROW.  */
     73 extern ssize_t msgrcv (int __msqid, void *__msgp, size_t __msgsz,
     74 		       long int __msgtyp, int __msgflg);
     75 
     76 /* Send message to message queue.
     77 
     78    This function is a cancellation point and therefore not marked with
     79    __THROW.  */
     80 extern int msgsnd (int __msqid, __const void *__msgp, size_t __msgsz,
     81 		   int __msgflg);
     82 
     83 __END_DECLS
     84 
     85 #endif /* sys/msg.h */
     86