Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: third_party/crashpad/crashpad/util/mach/mach_message.h

Issue 2555353002: Update Crashpad to 32981a3ee9d7c2769fb27afa038fe2e194cfa329 (Closed)
Patch Set: fix readme Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 //! 46 //!
47 //! A value of this type may be one of the special constants 47 //! A value of this type may be one of the special constants
48 //! #kMachMessageDeadlineNonblocking or #kMachMessageDeadlineWaitIndefinitely. 48 //! #kMachMessageDeadlineNonblocking or #kMachMessageDeadlineWaitIndefinitely.
49 //! Any other values should be produced by calling 49 //! Any other values should be produced by calling
50 //! MachMessageDeadlineFromTimeout(). 50 //! MachMessageDeadlineFromTimeout().
51 //! 51 //!
52 //! Internally, these are currently specified on the same time base as 52 //! Internally, these are currently specified on the same time base as
53 //! ClockMonotonicNanoseconds(), although this is an implementation detail. 53 //! ClockMonotonicNanoseconds(), although this is an implementation detail.
54 using MachMessageDeadline = uint64_t; 54 using MachMessageDeadline = uint64_t;
55 55
56 //! \brief Special constants used as \ref MachMessageDeadline values. 56 //! \brief Special constants used as \ref crashpad::MachMessageDeadline
57 //! "MachMessageDeadline" values.
57 enum : MachMessageDeadline { 58 enum : MachMessageDeadline {
58 //! \brief MachMessageWithDeadline() should not block at all in its operation. 59 //! \brief MachMessageWithDeadline() should not block at all in its operation.
59 kMachMessageDeadlineNonblocking = 0, 60 kMachMessageDeadlineNonblocking = 0,
60 61
61 //! \brief MachMessageWithDeadline() should wait indefinitely for the 62 //! \brief MachMessageWithDeadline() should wait indefinitely for the
62 //! requested operation to complete. 63 //! requested operation to complete.
63 kMachMessageDeadlineWaitIndefinitely = 0xffffffffffffffff, 64 kMachMessageDeadlineWaitIndefinitely = 0xffffffffffffffff,
64 }; 65 };
65 66
66 //! \brief Computes the deadline for a specified timeout value. 67 //! \brief Computes the deadline for a specified timeout value.
(...skipping 24 matching lines...) Expand all
91 //! Like the `mach_msg()` wrapper in `libsyscall`, this function will retry 92 //! Like the `mach_msg()` wrapper in `libsyscall`, this function will retry
92 //! operations when experiencing `MACH_SEND_INTERRUPTED` and 93 //! operations when experiencing `MACH_SEND_INTERRUPTED` and
93 //! `MACH_RCV_INTERRUPTED`, unless \a options contains `MACH_SEND_INTERRUPT` or 94 //! `MACH_RCV_INTERRUPTED`, unless \a options contains `MACH_SEND_INTERRUPT` or
94 //! `MACH_RCV_INTERRUPT`. Unlike `mach_msg()`, which restarts the call with the 95 //! `MACH_RCV_INTERRUPT`. Unlike `mach_msg()`, which restarts the call with the
95 //! full timeout when this occurs, this function continues enforcing the 96 //! full timeout when this occurs, this function continues enforcing the
96 //! user-specified \a deadline. 97 //! user-specified \a deadline.
97 //! 98 //!
98 //! Except as noted, the parameters and return value are identical to those of 99 //! Except as noted, the parameters and return value are identical to those of
99 //! `mach_msg()`. 100 //! `mach_msg()`.
100 //! 101 //!
102 //! \param[in,out] message
103 //! \param[in] options
104 //! \param[in] receive_size
105 //! \param[in] receive_port
101 //! \param[in] deadline The time by which this call should complete. If the 106 //! \param[in] deadline The time by which this call should complete. If the
102 //! deadline is exceeded, this call will return `MACH_SEND_TIMED_OUT` or 107 //! deadline is exceeded, this call will return `MACH_SEND_TIMED_OUT` or
103 //! `MACH_RCV_TIMED_OUT`. 108 //! `MACH_RCV_TIMED_OUT`.
109 //! \param[in] notify_port
104 //! \param[in] run_even_if_expired If `true`, a deadline that is expired when 110 //! \param[in] run_even_if_expired If `true`, a deadline that is expired when
105 //! this function is called will be treated as though a deadline of 111 //! this function is called will be treated as though a deadline of
106 //! #kMachMessageDeadlineNonblocking had been specified. When `false`, an 112 //! #kMachMessageDeadlineNonblocking had been specified. When `false`, an
107 //! expired deadline will result in a `MACH_SEND_TIMED_OUT` or 113 //! expired deadline will result in a `MACH_SEND_TIMED_OUT` or
108 //! `MACH_RCV_TIMED_OUT` return value, even if the deadline is already 114 //! `MACH_RCV_TIMED_OUT` return value, even if the deadline is already
109 //! expired when the function is called. 115 //! expired when the function is called.
116 //!
117 //! \return The return value of `mach_msg()`
110 mach_msg_return_t MachMessageWithDeadline(mach_msg_header_t* message, 118 mach_msg_return_t MachMessageWithDeadline(mach_msg_header_t* message,
111 mach_msg_option_t options, 119 mach_msg_option_t options,
112 mach_msg_size_t receive_size, 120 mach_msg_size_t receive_size,
113 mach_port_name_t receive_port, 121 mach_port_name_t receive_port,
114 MachMessageDeadline deadline, 122 MachMessageDeadline deadline,
115 mach_port_name_t notify_port, 123 mach_port_name_t notify_port,
116 bool run_even_if_expired); 124 bool run_even_if_expired);
117 125
118 //! \brief Initializes a reply message for a MIG server routine based on its 126 //! \brief Initializes a reply message for a MIG server routine based on its
119 //! corresponding request. 127 //! corresponding request.
120 //! 128 //!
121 //! If a request is handled by a server routine, it may be necessary to revise 129 //! If a request is handled by a server routine, it may be necessary to revise
122 //! some of the fields set by this function, such as `msgh_size` and any fields 130 //! some of the fields set by this function, such as `msgh_size` and any fields
123 //! defined in a routine’s reply structure type. 131 //! defined in a routine’s reply structure type.
124 //! 132 //!
125 //! \param[in] in_header The request message to base the reply on. 133 //! \param[in] in_header The request message to base the reply on.
126 //! \param[out] out_header The reply message to initialize. \a out_header will 134 //! \param[out] out_header The reply message to initialize. \a out_header will
127 //! be treated as a `mig_reply_error_t*` and all of its fields will be set 135 //! be treated as a `mig_reply_error_t*` and all of its fields will be set
128 //! except for `RetCode`, which must be set by SetMIGReplyError(). This 136 //! except for `RetCode`, which must be set by SetMIGReplyError(). This
129 //! argument is accepted as a `mach_msg_header_t*` instead of a 137 //! argument is accepted as a `mach_msg_header_t*` instead of a
130 //! `mig_reply_error_t*` because that is the type that callers are expected 138 //! `mig_reply_error_t*` because that is the type that callers are expected
131 //! to possess in the C API. 139 //! to possess in the C API.
132 void PrepareMIGReplyFromRequest(const mach_msg_header_t* in_header, 140 void PrepareMIGReplyFromRequest(const mach_msg_header_t* in_header,
133 mach_msg_header_t* out_header); 141 mach_msg_header_t* out_header);
134 142
135 //! \brief Sets the error code in a reply message for a MIG server routine. 143 //! \brief Sets the error code in a reply message for a MIG server routine.
136 //! 144 //!
137 //! \param[inout] out_header The reply message to operate on. \a out_header will 145 //! \param[in,out] out_header The reply message to operate on. \a out_header
138 //! be treated as a `mig_reply_error_t*` and its `RetCode` field will be 146 //! will be treated as a `mig_reply_error_t*` and its `RetCode` field will
139 //! set. This argument is accepted as a `mach_msg_header_t*` instead of a 147 //! be set. This argument is accepted as a `mach_msg_header_t*` instead of a
140 //! `mig_reply_error_t*` because that is the type that callers are expected 148 //! `mig_reply_error_t*` because that is the type that callers are expected
141 //! to possess in the C API. 149 //! to possess in the C API.
142 //! \param[in] error The error code to store in \a out_header. 150 //! \param[in] error The error code to store in \a out_header.
143 //! 151 //!
144 //! \sa PrepareMIGReplyFromRequest() 152 //! \sa PrepareMIGReplyFromRequest()
145 void SetMIGReplyError(mach_msg_header_t* out_header, kern_return_t error); 153 void SetMIGReplyError(mach_msg_header_t* out_header, kern_return_t error);
146 154
147 //! \brief Returns a Mach message trailer for a message that has been received. 155 //! \brief Returns a Mach message trailer for a message that has been received.
148 //! 156 //!
149 //! This function must only be called on Mach messages that have been received 157 //! This function must only be called on Mach messages that have been received
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 //! `MACH_MSG_TYPE_PORT_RECEIVE`, `MACH_MSG_TYPE_PORT_SEND`, or 193 //! `MACH_MSG_TYPE_PORT_RECEIVE`, `MACH_MSG_TYPE_PORT_SEND`, or
186 //! `MACH_MSG_TYPE_PORT_SEND_ONCE`. 194 //! `MACH_MSG_TYPE_PORT_SEND_ONCE`.
187 //! 195 //!
188 //! \return `true` on success, or `false` on failure with a message logged. 196 //! \return `true` on success, or `false` on failure with a message logged.
189 bool MachMessageDestroyReceivedPort(mach_port_t port, 197 bool MachMessageDestroyReceivedPort(mach_port_t port,
190 mach_msg_type_name_t port_right_type); 198 mach_msg_type_name_t port_right_type);
191 199
192 } // namespace crashpad 200 } // namespace crashpad
193 201
194 #endif // CRASHPAD_UTIL_MACH_MACH_MESSAGE_H_ 202 #endif // CRASHPAD_UTIL_MACH_MACH_MESSAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698