mqueue.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* Copyright (C) 2003 Krzysztof Benedyczak & Michal Wronski
  2. This program is free software; you can redistribute it and/or
  3. modify it under the terms of the GNU Lesser General Public
  4. License as published by the Free Software Foundation; either
  5. version 2.1 of the License, or (at your option) any later version.
  6. It is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9. Lesser General Public License for more details.
  10. You should have received a copy of the GNU Lesser General Public
  11. License along with this software; if not, write to the Free
  12. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  13. 02111-1307 USA. */
  14. #ifndef _LINUX_MQUEUE_H
  15. #define _LINUX_MQUEUE_H
  16. #define MQ_PRIO_MAX 32768
  17. /* per-uid limit of kernel memory used by mqueue, in bytes */
  18. #define MQ_BYTES_MAX 819200
  19. struct mq_attr {
  20. __kernel_long_t mq_flags; /* message queue flags */
  21. __kernel_long_t mq_maxmsg; /* maximum number of messages */
  22. __kernel_long_t mq_msgsize; /* maximum message size */
  23. __kernel_long_t mq_curmsgs; /* number of messages currently queued */
  24. __kernel_long_t __reserved[4]; /* ignored for input, zeroed for output */
  25. };
  26. /*
  27. * SIGEV_THREAD implementation:
  28. * SIGEV_THREAD must be implemented in user space. If SIGEV_THREAD is passed
  29. * to mq_notify, then
  30. * - sigev_signo must be the file descriptor of an AF_NETLINK socket. It's not
  31. * necessary that the socket is bound.
  32. * - sigev_value.sival_ptr must point to a cookie that is NOTIFY_COOKIE_LEN
  33. * bytes long.
  34. * If the notification is triggered, then the cookie is sent to the netlink
  35. * socket. The last byte of the cookie is replaced with the NOTIFY_?? codes:
  36. * NOTIFY_WOKENUP if the notification got triggered, NOTIFY_REMOVED if it was
  37. * removed, either due to a close() on the message queue fd or due to a
  38. * mq_notify() that removed the notification.
  39. */
  40. #define NOTIFY_NONE 0
  41. #define NOTIFY_WOKENUP 1
  42. #define NOTIFY_REMOVED 2
  43. #define NOTIFY_COOKIE_LEN 32
  44. #endif