mqueue.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /********************************************************************************
  2. * include/mqueue.h
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one or more
  5. * contributor license agreements. See the NOTICE file distributed with
  6. * this work for additional information regarding copyright ownership. The
  7. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance with the
  9. * License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. * License for the specific language governing permissions and limitations
  17. * under the License.
  18. *
  19. ********************************************************************************/
  20. #ifndef __INCLUDE_MQUEUE_H
  21. #define __INCLUDE_MQUEUE_H
  22. /********************************************************************************
  23. * Included Files
  24. ********************************************************************************/
  25. #include <sys/types.h>
  26. #include <signal.h>
  27. /********************************************************************************
  28. * Pre-processor Definitions
  29. ********************************************************************************/
  30. #define MQ_NONBLOCK O_NONBLOCK
  31. /********************************************************************************
  32. * Public Type Declarations
  33. ********************************************************************************/
  34. /* Message queue attributes */
  35. struct mq_attr
  36. {
  37. size_t mq_maxmsg; /* Max number of messages in queue */
  38. size_t mq_msgsize; /* Max message size */
  39. unsigned mq_flags; /* Queue flags */
  40. size_t mq_curmsgs; /* Number of messages currently in queue */
  41. };
  42. /* Message queue descriptor */
  43. typedef int mqd_t;
  44. /********************************************************************************
  45. * Public Data
  46. ********************************************************************************/
  47. #ifdef __cplusplus
  48. #define EXTERN extern "C"
  49. extern "C"
  50. {
  51. #else
  52. #define EXTERN extern
  53. #endif
  54. /********************************************************************************
  55. * Public Function Prototypes
  56. ********************************************************************************/
  57. mqd_t mq_open(FAR const char *mq_name, int oflags, ...);
  58. int mq_close(mqd_t mqdes);
  59. int mq_unlink(FAR const char *mq_name);
  60. int mq_send(mqd_t mqdes, FAR const char *msg, size_t msglen,
  61. unsigned int prio);
  62. int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen,
  63. unsigned int prio, FAR const struct timespec *abstime);
  64. ssize_t mq_receive(mqd_t mqdes, FAR char *msg, size_t msglen,
  65. FAR unsigned int *prio);
  66. ssize_t mq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen,
  67. FAR unsigned int *prio,
  68. FAR const struct timespec *abstime);
  69. int mq_notify(mqd_t mqdes, FAR const struct sigevent *notification);
  70. int mq_setattr(mqd_t mqdes, FAR const struct mq_attr *mq_stat,
  71. FAR struct mq_attr *oldstat);
  72. int mq_getattr(mqd_t mqdes, FAR struct mq_attr *mq_stat);
  73. #undef EXTERN
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif /* __INCLUDE_MQUEUE_H */