ipc_marequest.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Mach Operating System
  3. * Copyright (c) 1991,1990,1989 Carnegie Mellon University
  4. * All Rights Reserved.
  5. *
  6. * Permission to use, copy, modify and distribute this software and its
  7. * documentation is hereby granted, provided that both the copyright
  8. * notice and this permission notice appear in all copies of the
  9. * software, derivative works or modified versions, and any portions
  10. * thereof, and that both notices appear in supporting documentation.
  11. *
  12. * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13. * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14. * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15. *
  16. * Carnegie Mellon requests users of this software to return to
  17. *
  18. * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
  19. * School of Computer Science
  20. * Carnegie Mellon University
  21. * Pittsburgh PA 15213-3890
  22. *
  23. * any improvements or extensions that they make and grant Carnegie Mellon
  24. * the rights to redistribute these changes.
  25. */
  26. /*
  27. * File: ipc/ipc_marequest.h
  28. * Author: Rich Draves
  29. * Date: 1989
  30. *
  31. * Definitions for msg-accepted requests.
  32. */
  33. #ifndef _IPC_IPC_MAREQUEST_H_
  34. #define _IPC_IPC_MAREQUEST_H_
  35. #include <mach/kern_return.h>
  36. #include <mach/port.h>
  37. #include <mach_debug/hash_info.h>
  38. #include <ipc/ipc_types.h>
  39. /*
  40. * A msg-accepted request is made when MACH_SEND_NOTIFY is used
  41. * to force a message to a send right. The IE_BITS_MAREQUEST bit
  42. * in an entry indicates the entry is blocked because MACH_SEND_NOTIFY
  43. * has already been used to force a message. The kmsg holds
  44. * a pointer to the marequest; it is destroyed when the kmsg
  45. * is received/destroyed. (If the send right is destroyed,
  46. * this just changes imar_name. If the space is destroyed,
  47. * the marequest is left unchanged.)
  48. *
  49. * Locking considerations: The imar_space field is read-only and
  50. * points to the space which locks the imar_name field. imar_soright
  51. * is read-only. Normally it is a non-null send-once right for
  52. * the msg-accepted notification, but in compat mode it is null
  53. * and the notification goes to the space's notify port. Normally
  54. * imar_name is non-null, but if the send right is destroyed then
  55. * it is changed to be null. imar_next is locked by a bucket lock;
  56. * imar_name is read-only when the request is in a bucket. (So lookups
  57. * in the bucket can safely check imar_space and imar_name.)
  58. * imar_space and imar_soright both hold references.
  59. */
  60. typedef struct ipc_marequest {
  61. struct ipc_space *imar_space;
  62. mach_port_t imar_name;
  63. struct ipc_port *imar_soright;
  64. struct ipc_marequest *imar_next;
  65. } *ipc_marequest_t;
  66. #define IMAR_NULL ((ipc_marequest_t) 0)
  67. #define IPC_MAREQUEST_SIZE 16
  68. extern void
  69. ipc_marequest_init(void);
  70. #if MACH_IPC_DEBUG
  71. extern unsigned int
  72. ipc_marequest_info(unsigned int *, hash_info_bucket_t *, unsigned int);
  73. #endif /* MACH_IPC_DEBUG */
  74. extern mach_msg_return_t
  75. ipc_marequest_create(ipc_space_t space, ipc_port_t port,
  76. mach_port_t notify, ipc_marequest_t *marequestp);
  77. extern void
  78. ipc_marequest_cancel(ipc_space_t space, mach_port_t name);
  79. extern void
  80. ipc_marequest_rename(ipc_space_t space,
  81. mach_port_t old, mach_port_t new);
  82. extern void
  83. ipc_marequest_destroy(ipc_marequest_t marequest);
  84. #endif /* _IPC_IPC_MAREQUEST_H_ */