mqueue.h
上传用户:szlgq88
上传日期:2009-04-28
资源大小:48287k
文件大小:4k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /* Copyright (C) 2004 Free Software Foundation, Inc.
  2.    This file is part of the GNU C Library.
  3.    Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
  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, write to the Free
  14.    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15.    02111-1307 USA.  */
  16. #ifndef _MQUEUE_H
  17. #define _MQUEUE_H 1
  18. #include <features.h>
  19. #include <sys/types.h>
  20. #include <fcntl.h>
  21. #define __need_sigevent_t
  22. #include <bits/siginfo.h>
  23. #define __need_timespec
  24. #include <time.h>
  25. /* Get the definition of mqd_t and struct mq_attr.  */
  26. #include <bits/mqueue.h>
  27. __BEGIN_DECLS
  28. /* Establish connection between a process and a message queue NAME and
  29.    return message queue descriptor or (mqd_t) -1 on error.  OFLAG determines
  30.    the type of access used.  If O_CREAT is on OFLAG, the third argument is
  31.    taken as a `mode_t', the mode of the created message queue, and the fourth
  32.    argument is taken as `struct mq_attr *', pointer to message queue
  33.    attributes.  If the fourth argument is NULL, default attributes are
  34.    used.  */
  35. extern mqd_t mq_open (const char *__name, int __oflag, ...) __THROW;
  36. /* Removes the association between message queue descriptor MQDES and its
  37.    message queue.  */
  38. extern int mq_close (mqd_t __mqdes) __THROW;
  39. /* Query status and attributes of message queue MQDES.  */
  40. extern int mq_getattr (mqd_t __mqdes, struct mq_attr *__mqstat) __THROW;
  41. /* Set attributes associated with message queue MQDES and if OMQSTAT is
  42.    not NULL also query its old attributes.  */
  43. extern int mq_setattr (mqd_t __mqdes,
  44.        const struct mq_attr *__restrict __mqstat,
  45.        struct mq_attr *__restrict __omqstat) __THROW;
  46. /* Remove message queue named NAME.  */
  47. extern int mq_unlink (const char *__name) __THROW;
  48. /* Register notification upon message arrival to an empty message queue
  49.    MQDES.  */
  50. extern int mq_notify (mqd_t __mqdes, const struct sigevent *__notification)
  51.      __THROW;
  52. /* Receive the oldest from highest priority messages in message queue
  53.    MQDES.  */
  54. extern ssize_t mq_receive (mqd_t __mqdes, char *__msg_ptr, size_t __msg_len,
  55.    unsigned int *__msg_prio);
  56. /* Add message pointed by MSG_PTR to message queue MQDES.  */
  57. extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len,
  58.     unsigned int __msg_prio);
  59. #ifdef __USE_XOPEN2K
  60. /* Receive the oldest from highest priority messages in message queue
  61.    MQDES, stop waiting if ABS_TIMEOUT expires.  */
  62. extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr,
  63. size_t __msg_len,
  64. unsigned int *__restrict __msg_prio,
  65. const struct timespec *__restrict __abs_timeout);
  66. /* Add message pointed by MSG_PTR to message queue MQDES, stop blocking
  67.    on full message queue if ABS_TIMEOUT expires.  */
  68. extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr,
  69.  size_t __msg_len, unsigned int __msg_prio,
  70.  const struct timespec *__abs_timeout);
  71. #endif
  72. __END_DECLS                                                      
  73. #endif /* mqueue.h */