1
0

msg.h 2.6 KB

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