1
0

msg.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //
  2. // Copyright 2026 Aarav Ravindra Kharade
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. /* Copyright (C) 1995-2026 Free Software Foundation, Inc.
  17. This file is part of the GNU C Library.
  18. The GNU C Library is free software; you can redistribute it and/or
  19. modify it under the terms of the GNU Lesser General Public
  20. License as published by the Free Software Foundation; either
  21. version 2.1 of the License, or (at your option) any later version.
  22. The GNU C Library is distributed in the hope that it will be useful,
  23. but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  25. Lesser General Public License for more details.
  26. You should have received a copy of the GNU Lesser General Public
  27. License along with the GNU C Library; if not, see
  28. <https://www.gnu.org/licenses/>. */
  29. #ifndef _SYS_MSG_H
  30. #define _SYS_MSG_H
  31. #include <features.h>
  32. #define __need_size_t
  33. #include <stddef.h>
  34. /* Get common definition of System V style IPC. */
  35. #include <sys/ipc.h>
  36. /* Get system dependent definition of `struct msqid_ds' and more. */
  37. #include <bits/msq.h>
  38. /* Define types required by the standard. */
  39. #include <bits/types/time_t.h>
  40. #ifndef __pid_t_defined
  41. typedef __pid_t pid_t;
  42. # define __pid_t_defined
  43. #endif
  44. #ifndef __ssize_t_defined
  45. typedef __ssize_t ssize_t;
  46. # define __ssize_t_defined
  47. #endif
  48. /* The following System V style IPC functions implement a message queue
  49. system. The definition is found in XPG2. */
  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. __BEGIN_DECLS
  59. /* Message queue control operation. */
  60. #ifndef __USE_TIME64_REDIRECTS
  61. extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW;
  62. #else
  63. # ifdef __REDIRECT_NTH
  64. extern int __REDIRECT_NTH (msgctl,
  65. (int __msqid, int __cmd, struct msqid_ds *__buf),
  66. __msgctl64);
  67. # else
  68. # define msgctl __msgctl64
  69. # endif
  70. #endif
  71. /* Get messages queue. */
  72. extern int msgget (key_t __key, int __msgflg) __THROW;
  73. /* Receive message from message queue.
  74. This function is a cancellation point and therefore not marked with
  75. __THROW. */
  76. extern ssize_t msgrcv (int __msqid, void *__msgp, size_t __msgsz,
  77. long int __msgtyp, int __msgflg);
  78. /* Send message to message queue.
  79. This function is a cancellation point and therefore not marked with
  80. __THROW. */
  81. extern int msgsnd (int __msqid, const void *__msgp, size_t __msgsz,
  82. int __msgflg);
  83. __END_DECLS
  84. #endif /* sys/msg.h */