msg.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. 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. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef _SYS_MSG_H
  16. #define _SYS_MSG_H
  17. #include <features.h>
  18. #define __need_size_t
  19. #include <stddef.h>
  20. /* Get common definition of System V style IPC. */
  21. #include <sys/ipc.h>
  22. /* Get system dependent definition of `struct msqid_ds' and more. */
  23. #include <bits/msq.h>
  24. /* Define types required by the standard. */
  25. #define __need_time_t
  26. #include <time.h>
  27. #ifndef __pid_t_defined
  28. typedef __pid_t pid_t;
  29. # define __pid_t_defined
  30. #endif
  31. #ifndef __ssize_t_defined
  32. typedef __ssize_t ssize_t;
  33. # define __ssize_t_defined
  34. #endif
  35. /* The following System V style IPC functions implement a message queue
  36. system. The definition is found in XPG2. */
  37. #ifdef __USE_GNU
  38. /* Template for struct to be used as argument for `msgsnd' and `msgrcv'. */
  39. struct msgbuf
  40. {
  41. long int mtype; /* type of received/sent message */
  42. char mtext[1]; /* text of the message */
  43. };
  44. #endif
  45. __BEGIN_DECLS
  46. /* Message queue control operation. */
  47. extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW;
  48. /* Get messages queue. */
  49. extern int msgget (key_t __key, int __msgflg) __THROW;
  50. /* Receive message from message queue.
  51. This function is a cancellation point and therefore not marked with
  52. __THROW. */
  53. extern ssize_t msgrcv (int __msqid, void *__msgp, size_t __msgsz,
  54. long int __msgtyp, int __msgflg);
  55. /* Send message to message queue.
  56. This function is a cancellation point and therefore not marked with
  57. __THROW. */
  58. extern int msgsnd (int __msqid, const void *__msgp, size_t __msgsz,
  59. int __msgflg);
  60. __END_DECLS
  61. #endif /* sys/msg.h */