@@ -17,31 +17,31 @@ use u64;
17
17
18
18
use libc:: { c_int, c_void} ;
19
19
20
- pub type mx_handle_t = i32 ;
21
- pub type mx_vaddr_t = usize ;
22
- pub type mx_rights_t = u32 ;
23
- pub type mx_status_t = i32 ;
20
+ pub type zx_handle_t = i32 ;
21
+ pub type zx_vaddr_t = usize ;
22
+ pub type zx_rights_t = u32 ;
23
+ pub type zx_status_t = i32 ;
24
24
25
- pub type mx_size_t = usize ;
25
+ pub type zx_size_t = usize ;
26
26
27
- pub const MX_HANDLE_INVALID : mx_handle_t = 0 ;
27
+ pub const ZX_HANDLE_INVALID : zx_handle_t = 0 ;
28
28
29
- pub type mx_time_t = u64 ;
30
- pub const MX_TIME_INFINITE : mx_time_t = u64:: MAX ;
29
+ pub type zx_time_t = u64 ;
30
+ pub const ZX_TIME_INFINITE : zx_time_t = u64:: MAX ;
31
31
32
- pub type mx_signals_t = u32 ;
32
+ pub type zx_signals_t = u32 ;
33
33
34
- pub const MX_OBJECT_SIGNAL_3 : mx_signals_t = 1 << 3 ;
34
+ pub const ZX_OBJECT_SIGNAL_3 : zx_signals_t = 1 << 3 ;
35
35
36
- pub const MX_TASK_TERMINATED : mx_signals_t = MX_OBJECT_SIGNAL_3 ;
36
+ pub const ZX_TASK_TERMINATED : zx_signals_t = ZX_OBJECT_SIGNAL_3 ;
37
37
38
- pub const MX_RIGHT_SAME_RIGHTS : mx_rights_t = 1 << 31 ;
38
+ pub const ZX_RIGHT_SAME_RIGHTS : zx_rights_t = 1 << 31 ;
39
39
40
- pub type mx_object_info_topic_t = u32 ;
40
+ pub type zx_object_info_topic_t = u32 ;
41
41
42
- pub const MX_INFO_PROCESS : mx_object_info_topic_t = 3 ;
42
+ pub const ZX_INFO_PROCESS : zx_object_info_topic_t = 3 ;
43
43
44
- pub fn mx_cvt < T > ( t : T ) -> io:: Result < T > where T : TryInto < mx_status_t > +Copy {
44
+ pub fn zx_cvt < T > ( t : T ) -> io:: Result < T > where T : TryInto < zx_status_t > +Copy {
45
45
if let Ok ( status) = TryInto :: try_into ( t) {
46
46
if status < 0 {
47
47
Err ( io:: Error :: from_raw_os_error ( status) )
@@ -53,33 +53,33 @@ pub fn mx_cvt<T>(t: T) -> io::Result<T> where T: TryInto<mx_status_t>+Copy {
53
53
}
54
54
}
55
55
56
- // Safe wrapper around mx_handle_t
56
+ // Safe wrapper around zx_handle_t
57
57
pub struct Handle {
58
- raw : mx_handle_t ,
58
+ raw : zx_handle_t ,
59
59
}
60
60
61
61
impl Handle {
62
- pub fn new ( raw : mx_handle_t ) -> Handle {
62
+ pub fn new ( raw : zx_handle_t ) -> Handle {
63
63
Handle {
64
64
raw,
65
65
}
66
66
}
67
67
68
- pub fn raw ( & self ) -> mx_handle_t {
68
+ pub fn raw ( & self ) -> zx_handle_t {
69
69
self . raw
70
70
}
71
71
}
72
72
73
73
impl Drop for Handle {
74
74
fn drop ( & mut self ) {
75
- unsafe { mx_cvt ( mx_handle_close ( self . raw ) ) . expect ( "Failed to close mx_handle_t " ) ; }
75
+ unsafe { zx_cvt ( zx_handle_close ( self . raw ) ) . expect ( "Failed to close zx_handle_t " ) ; }
76
76
}
77
77
}
78
78
79
- // Common MX_INFO header
79
+ // Common ZX_INFO header
80
80
#[ derive( Default ) ]
81
81
#[ repr( C ) ]
82
- pub struct mx_info_header_t {
82
+ pub struct zx_info_header_t {
83
83
pub topic : u32 , // identifies the info struct
84
84
pub avail_topic_size : u16 , // “native” size of the struct
85
85
pub topic_size : u16 , // size of the returned struct (<=topic_size)
@@ -89,34 +89,34 @@ pub struct mx_info_header_t {
89
89
90
90
#[ derive( Default ) ]
91
91
#[ repr( C ) ]
92
- pub struct mx_record_process_t {
92
+ pub struct zx_record_process_t {
93
93
pub return_code : c_int ,
94
94
}
95
95
96
- // Returned for topic MX_INFO_PROCESS
96
+ // Returned for topic ZX_INFO_PROCESS
97
97
#[ derive( Default ) ]
98
98
#[ repr( C ) ]
99
- pub struct mx_info_process_t {
100
- pub hdr : mx_info_header_t ,
101
- pub rec : mx_record_process_t ,
99
+ pub struct zx_info_process_t {
100
+ pub hdr : zx_info_header_t ,
101
+ pub rec : zx_record_process_t ,
102
102
}
103
103
104
104
extern {
105
- pub fn mx_job_default ( ) -> mx_handle_t ;
105
+ pub fn zx_job_default ( ) -> zx_handle_t ;
106
106
107
- pub fn mx_task_kill ( handle : mx_handle_t ) -> mx_status_t ;
107
+ pub fn zx_task_kill ( handle : zx_handle_t ) -> zx_status_t ;
108
108
109
- pub fn mx_handle_close ( handle : mx_handle_t ) -> mx_status_t ;
109
+ pub fn zx_handle_close ( handle : zx_handle_t ) -> zx_status_t ;
110
110
111
- pub fn mx_handle_duplicate ( handle : mx_handle_t , rights : mx_rights_t ,
112
- out : * const mx_handle_t ) -> mx_handle_t ;
111
+ pub fn zx_handle_duplicate ( handle : zx_handle_t , rights : zx_rights_t ,
112
+ out : * const zx_handle_t ) -> zx_handle_t ;
113
113
114
- pub fn mx_object_wait_one ( handle : mx_handle_t , signals : mx_signals_t , timeout : mx_time_t ,
115
- pending : * mut mx_signals_t ) -> mx_status_t ;
114
+ pub fn zx_object_wait_one ( handle : zx_handle_t , signals : zx_signals_t , timeout : zx_time_t ,
115
+ pending : * mut zx_signals_t ) -> zx_status_t ;
116
116
117
- pub fn mx_object_get_info ( handle : mx_handle_t , topic : u32 , buffer : * mut c_void ,
118
- buffer_size : mx_size_t , actual_size : * mut mx_size_t ,
119
- avail : * mut mx_size_t ) -> mx_status_t ;
117
+ pub fn zx_object_get_info ( handle : zx_handle_t , topic : u32 , buffer : * mut c_void ,
118
+ buffer_size : zx_size_t , actual_size : * mut zx_size_t ,
119
+ avail : * mut zx_size_t ) -> zx_status_t ;
120
120
}
121
121
122
122
// From `enum special_handles` in system/ulib/launchpad/launchpad.c
@@ -133,117 +133,117 @@ pub struct launchpad_t {
133
133
env : * const c_char ,
134
134
env_len : usize ,
135
135
136
- handles : * mut mx_handle_t ,
136
+ handles : * mut zx_handle_t ,
137
137
handles_info : * mut u32 ,
138
138
handle_count : usize ,
139
139
handle_alloc : usize ,
140
140
141
- entry : mx_vaddr_t ,
142
- base : mx_vaddr_t ,
143
- vdso_base : mx_vaddr_t ,
141
+ entry : zx_vaddr_t ,
142
+ base : zx_vaddr_t ,
143
+ vdso_base : zx_vaddr_t ,
144
144
145
145
stack_size : usize ,
146
146
147
- special_handles : [ mx_handle_t ; HND_SPECIAL_COUNT ] ,
147
+ special_handles : [ zx_handle_t ; HND_SPECIAL_COUNT ] ,
148
148
loader_message : bool ,
149
149
}
150
150
151
151
extern {
152
- pub fn launchpad_create ( job : mx_handle_t , name : * const c_char ,
153
- lp : * mut * mut launchpad_t ) -> mx_status_t ;
152
+ pub fn launchpad_create ( job : zx_handle_t , name : * const c_char ,
153
+ lp : * mut * mut launchpad_t ) -> zx_status_t ;
154
154
155
155
pub fn launchpad_go ( lp : * mut launchpad_t ,
156
- proc_handle : * mut mx_handle_t ,
157
- err_msg : * mut * const c_char ) -> mx_status_t ;
156
+ proc_handle : * mut zx_handle_t ,
157
+ err_msg : * mut * const c_char ) -> zx_status_t ;
158
158
159
159
pub fn launchpad_destroy ( lp : * mut launchpad_t ) ;
160
160
161
161
pub fn launchpad_set_args ( lp : * mut launchpad_t , argc : c_int ,
162
- argv : * const * const c_char ) -> mx_status_t ;
162
+ argv : * const * const c_char ) -> zx_status_t ;
163
163
164
- pub fn launchpad_set_environ ( lp : * mut launchpad_t , envp : * const * const c_char ) -> mx_status_t ;
164
+ pub fn launchpad_set_environ ( lp : * mut launchpad_t , envp : * const * const c_char ) -> zx_status_t ;
165
165
166
- pub fn launchpad_clone ( lp : * mut launchpad_t , what : u32 ) -> mx_status_t ;
166
+ pub fn launchpad_clone ( lp : * mut launchpad_t , what : u32 ) -> zx_status_t ;
167
167
168
- pub fn launchpad_clone_fd ( lp : * mut launchpad_t , fd : c_int , target_fd : c_int ) -> mx_status_t ;
168
+ pub fn launchpad_clone_fd ( lp : * mut launchpad_t , fd : c_int , target_fd : c_int ) -> zx_status_t ;
169
169
170
- pub fn launchpad_transfer_fd ( lp : * mut launchpad_t , fd : c_int , target_fd : c_int ) -> mx_status_t ;
170
+ pub fn launchpad_transfer_fd ( lp : * mut launchpad_t , fd : c_int , target_fd : c_int ) -> zx_status_t ;
171
171
172
- pub fn launchpad_elf_load ( lp : * mut launchpad_t , vmo : mx_handle_t ) -> mx_status_t ;
172
+ pub fn launchpad_elf_load ( lp : * mut launchpad_t , vmo : zx_handle_t ) -> zx_status_t ;
173
173
174
- pub fn launchpad_add_vdso_vmo ( lp : * mut launchpad_t ) -> mx_status_t ;
174
+ pub fn launchpad_add_vdso_vmo ( lp : * mut launchpad_t ) -> zx_status_t ;
175
175
176
- pub fn launchpad_load_vdso ( lp : * mut launchpad_t , vmo : mx_handle_t ) -> mx_status_t ;
176
+ pub fn launchpad_load_vdso ( lp : * mut launchpad_t , vmo : zx_handle_t ) -> zx_status_t ;
177
177
178
- pub fn launchpad_vmo_from_file ( filename : * const c_char ) -> mx_handle_t ;
178
+ pub fn launchpad_vmo_from_file ( filename : * const c_char ) -> zx_handle_t ;
179
179
}
180
180
181
181
// Launchpad clone constants
182
182
183
- pub const LP_CLONE_MXIO_ROOT : u32 = 0x0001 ;
184
- pub const LP_CLONE_MXIO_CWD : u32 = 0x0002 ;
185
- // LP_CLONE_MXIO_STDIO = 0x0004
186
- // LP_CLONE_MXIO_ALL = 0x00FF
183
+ pub const LP_CLONE_FDIO_NAMESPACE : u32 = 0x0001 ;
184
+ pub const LP_CLONE_FDIO_CWD : u32 = 0x0002 ;
185
+ // LP_CLONE_FDIO_STDIO = 0x0004
186
+ // LP_CLONE_FDIO_ALL = 0x00FF
187
187
// LP_CLONE_ENVIRON = 0x0100
188
188
// LP_CLONE_DEFAULT_JOB = 0x0200
189
189
// LP_CLONE_ALL = 0xFFFF
190
190
191
191
// Errors
192
192
193
- #[ allow( unused) ] pub const ERR_INTERNAL : mx_status_t = -1 ;
193
+ #[ allow( unused) ] pub const ERR_INTERNAL : zx_status_t = -1 ;
194
194
195
195
// ERR_NOT_SUPPORTED: The operation is not implemented, supported,
196
196
// or enabled.
197
- #[ allow( unused) ] pub const ERR_NOT_SUPPORTED : mx_status_t = -2 ;
197
+ #[ allow( unused) ] pub const ERR_NOT_SUPPORTED : zx_status_t = -2 ;
198
198
199
199
// ERR_NO_RESOURCES: The system was not able to allocate some resource
200
200
// needed for the operation.
201
- #[ allow( unused) ] pub const ERR_NO_RESOURCES : mx_status_t = -3 ;
201
+ #[ allow( unused) ] pub const ERR_NO_RESOURCES : zx_status_t = -3 ;
202
202
203
203
// ERR_NO_MEMORY: The system was not able to allocate memory needed
204
204
// for the operation.
205
- #[ allow( unused) ] pub const ERR_NO_MEMORY : mx_status_t = -4 ;
205
+ #[ allow( unused) ] pub const ERR_NO_MEMORY : zx_status_t = -4 ;
206
206
207
- // ERR_CALL_FAILED: The second phase of mx_channel_call (; did not complete
207
+ // ERR_CALL_FAILED: The second phase of zx_channel_call (; did not complete
208
208
// successfully.
209
- #[ allow( unused) ] pub const ERR_CALL_FAILED : mx_status_t = -5 ;
209
+ #[ allow( unused) ] pub const ERR_CALL_FAILED : zx_status_t = -5 ;
210
210
211
211
// ERR_INTERRUPTED_RETRY: The system call was interrupted, but should be
212
212
// retried. This should not be seen outside of the VDSO.
213
- #[ allow( unused) ] pub const ERR_INTERRUPTED_RETRY : mx_status_t = -6 ;
213
+ #[ allow( unused) ] pub const ERR_INTERRUPTED_RETRY : zx_status_t = -6 ;
214
214
215
215
// ======= Parameter errors =======
216
216
// ERR_INVALID_ARGS: an argument is invalid, ex. null pointer
217
- #[ allow( unused) ] pub const ERR_INVALID_ARGS : mx_status_t = -10 ;
217
+ #[ allow( unused) ] pub const ERR_INVALID_ARGS : zx_status_t = -10 ;
218
218
219
219
// ERR_BAD_HANDLE: A specified handle value does not refer to a handle.
220
- #[ allow( unused) ] pub const ERR_BAD_HANDLE : mx_status_t = -11 ;
220
+ #[ allow( unused) ] pub const ERR_BAD_HANDLE : zx_status_t = -11 ;
221
221
222
222
// ERR_WRONG_TYPE: The subject of the operation is the wrong type to
223
223
// perform the operation.
224
224
// Example: Attempting a message_read on a thread handle.
225
- #[ allow( unused) ] pub const ERR_WRONG_TYPE : mx_status_t = -12 ;
225
+ #[ allow( unused) ] pub const ERR_WRONG_TYPE : zx_status_t = -12 ;
226
226
227
227
// ERR_BAD_SYSCALL: The specified syscall number is invalid.
228
- #[ allow( unused) ] pub const ERR_BAD_SYSCALL : mx_status_t = -13 ;
228
+ #[ allow( unused) ] pub const ERR_BAD_SYSCALL : zx_status_t = -13 ;
229
229
230
230
// ERR_OUT_OF_RANGE: An argument is outside the valid range for this
231
231
// operation.
232
- #[ allow( unused) ] pub const ERR_OUT_OF_RANGE : mx_status_t = -14 ;
232
+ #[ allow( unused) ] pub const ERR_OUT_OF_RANGE : zx_status_t = -14 ;
233
233
234
234
// ERR_BUFFER_TOO_SMALL: A caller provided buffer is too small for
235
235
// this operation.
236
- #[ allow( unused) ] pub const ERR_BUFFER_TOO_SMALL : mx_status_t = -15 ;
236
+ #[ allow( unused) ] pub const ERR_BUFFER_TOO_SMALL : zx_status_t = -15 ;
237
237
238
238
// ======= Precondition or state errors =======
239
239
// ERR_BAD_STATE: operation failed because the current state of the
240
240
// object does not allow it, or a precondition of the operation is
241
241
// not satisfied
242
- #[ allow( unused) ] pub const ERR_BAD_STATE : mx_status_t = -20 ;
242
+ #[ allow( unused) ] pub const ERR_BAD_STATE : zx_status_t = -20 ;
243
243
244
244
// ERR_TIMED_OUT: The time limit for the operation elapsed before
245
245
// the operation completed.
246
- #[ allow( unused) ] pub const ERR_TIMED_OUT : mx_status_t = -21 ;
246
+ #[ allow( unused) ] pub const ERR_TIMED_OUT : zx_status_t = -21 ;
247
247
248
248
// ERR_SHOULD_WAIT: The operation cannot be performed currently but
249
249
// potentially could succeed if the caller waits for a prerequisite
@@ -253,67 +253,67 @@ pub const LP_CLONE_MXIO_CWD: u32 = 0x0002;
253
253
// messages waiting but has an open remote will return ERR_SHOULD_WAIT.
254
254
// Attempting to read from a message pipe that has no messages waiting
255
255
// and has a closed remote end will return ERR_REMOTE_CLOSED.
256
- #[ allow( unused) ] pub const ERR_SHOULD_WAIT : mx_status_t = -22 ;
256
+ #[ allow( unused) ] pub const ERR_SHOULD_WAIT : zx_status_t = -22 ;
257
257
258
258
// ERR_CANCELED: The in-progress operation (e.g. a wait) has been
259
259
// // canceled.
260
- #[ allow( unused) ] pub const ERR_CANCELED : mx_status_t = -23 ;
260
+ #[ allow( unused) ] pub const ERR_CANCELED : zx_status_t = -23 ;
261
261
262
262
// ERR_PEER_CLOSED: The operation failed because the remote end
263
263
// of the subject of the operation was closed.
264
- #[ allow( unused) ] pub const ERR_PEER_CLOSED : mx_status_t = -24 ;
264
+ #[ allow( unused) ] pub const ERR_PEER_CLOSED : zx_status_t = -24 ;
265
265
266
266
// ERR_NOT_FOUND: The requested entity is not found.
267
- #[ allow( unused) ] pub const ERR_NOT_FOUND : mx_status_t = -25 ;
267
+ #[ allow( unused) ] pub const ERR_NOT_FOUND : zx_status_t = -25 ;
268
268
269
269
// ERR_ALREADY_EXISTS: An object with the specified identifier
270
270
// already exists.
271
271
// Example: Attempting to create a file when a file already exists
272
272
// with that name.
273
- #[ allow( unused) ] pub const ERR_ALREADY_EXISTS : mx_status_t = -26 ;
273
+ #[ allow( unused) ] pub const ERR_ALREADY_EXISTS : zx_status_t = -26 ;
274
274
275
275
// ERR_ALREADY_BOUND: The operation failed because the named entity
276
276
// is already owned or controlled by another entity. The operation
277
277
// could succeed later if the current owner releases the entity.
278
- #[ allow( unused) ] pub const ERR_ALREADY_BOUND : mx_status_t = -27 ;
278
+ #[ allow( unused) ] pub const ERR_ALREADY_BOUND : zx_status_t = -27 ;
279
279
280
280
// ERR_UNAVAILABLE: The subject of the operation is currently unable
281
281
// to perform the operation.
282
282
// Note: This is used when there's no direct way for the caller to
283
283
// observe when the subject will be able to perform the operation
284
284
// and should thus retry.
285
- #[ allow( unused) ] pub const ERR_UNAVAILABLE : mx_status_t = -28 ;
285
+ #[ allow( unused) ] pub const ERR_UNAVAILABLE : zx_status_t = -28 ;
286
286
287
287
// ======= Permission check errors =======
288
288
// ERR_ACCESS_DENIED: The caller did not have permission to perform
289
289
// the specified operation.
290
- #[ allow( unused) ] pub const ERR_ACCESS_DENIED : mx_status_t = -30 ;
290
+ #[ allow( unused) ] pub const ERR_ACCESS_DENIED : zx_status_t = -30 ;
291
291
292
292
// ======= Input-output errors =======
293
293
// ERR_IO: Otherwise unspecified error occurred during I/O.
294
- #[ allow( unused) ] pub const ERR_IO : mx_status_t = -40 ;
294
+ #[ allow( unused) ] pub const ERR_IO : zx_status_t = -40 ;
295
295
296
296
// ERR_REFUSED: The entity the I/O operation is being performed on
297
297
// rejected the operation.
298
298
// Example: an I2C device NAK'ing a transaction or a disk controller
299
299
// rejecting an invalid command.
300
- #[ allow( unused) ] pub const ERR_IO_REFUSED : mx_status_t = -41 ;
300
+ #[ allow( unused) ] pub const ERR_IO_REFUSED : zx_status_t = -41 ;
301
301
302
302
// ERR_IO_DATA_INTEGRITY: The data in the operation failed an integrity
303
303
// check and is possibly corrupted.
304
304
// Example: CRC or Parity error.
305
- #[ allow( unused) ] pub const ERR_IO_DATA_INTEGRITY : mx_status_t = -42 ;
305
+ #[ allow( unused) ] pub const ERR_IO_DATA_INTEGRITY : zx_status_t = -42 ;
306
306
307
307
// ERR_IO_DATA_LOSS: The data in the operation is currently unavailable
308
308
// and may be permanently lost.
309
309
// Example: A disk block is irrecoverably damaged.
310
- #[ allow( unused) ] pub const ERR_IO_DATA_LOSS : mx_status_t = -43 ;
310
+ #[ allow( unused) ] pub const ERR_IO_DATA_LOSS : zx_status_t = -43 ;
311
311
312
312
// Filesystem specific errors
313
- #[ allow( unused) ] pub const ERR_BAD_PATH : mx_status_t = -50 ;
314
- #[ allow( unused) ] pub const ERR_NOT_DIR : mx_status_t = -51 ;
315
- #[ allow( unused) ] pub const ERR_NOT_FILE : mx_status_t = -52 ;
313
+ #[ allow( unused) ] pub const ERR_BAD_PATH : zx_status_t = -50 ;
314
+ #[ allow( unused) ] pub const ERR_NOT_DIR : zx_status_t = -51 ;
315
+ #[ allow( unused) ] pub const ERR_NOT_FILE : zx_status_t = -52 ;
316
316
// ERR_FILE_BIG: A file exceeds a filesystem-specific size limit.
317
- #[ allow( unused) ] pub const ERR_FILE_BIG : mx_status_t = -53 ;
317
+ #[ allow( unused) ] pub const ERR_FILE_BIG : zx_status_t = -53 ;
318
318
// ERR_NO_SPACE: Filesystem or device space is exhausted.
319
- #[ allow( unused) ] pub const ERR_NO_SPACE : mx_status_t = -54 ;
319
+ #[ allow( unused) ] pub const ERR_NO_SPACE : zx_status_t = -54 ;
0 commit comments