Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
43cff131
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
43cff131
编写于
9月 15, 2017
作者:
P
P.Y. Laligand
提交者:
James Tucker
9月 24, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The Magenta kernel is now called Zircon.
上级
1ed7d41d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
148 addition
and
145 deletion
+148
-145
src/ci/docker/dist-fuchsia/build-toolchain.sh
src/ci/docker/dist-fuchsia/build-toolchain.sh
+9
-9
src/libstd/build.rs
src/libstd/build.rs
+2
-2
src/libstd/sys/unix/process/mod.rs
src/libstd/sys/unix/process/mod.rs
+1
-1
src/libstd/sys/unix/process/process_fuchsia.rs
src/libstd/sys/unix/process/process_fuchsia.rs
+38
-38
src/libstd/sys/unix/process/zircon.rs
src/libstd/sys/unix/process/zircon.rs
+91
-91
src/libstd/sys/unix/rand.rs
src/libstd/sys/unix/rand.rs
+4
-4
src/tools/tidy/src/deps.rs
src/tools/tidy/src/deps.rs
+3
-0
未找到文件。
src/ci/docker/dist-fuchsia/build-toolchain.sh
浏览文件 @
43cff131
...
@@ -16,7 +16,7 @@ source shared.sh
...
@@ -16,7 +16,7 @@ source shared.sh
# Download sources
# Download sources
SRCS
=(
SRCS
=(
"https://fuchsia.googlesource.com/
magenta magenta
d17073dc8de344ead3b65e8cc6a12280dec38c84"
"https://fuchsia.googlesource.com/
zircon zircon
d17073dc8de344ead3b65e8cc6a12280dec38c84"
"https://llvm.googlesource.com/llvm llvm 3f58a16d8eec385e2b3ebdfbb84ff9d3bf27e025"
"https://llvm.googlesource.com/llvm llvm 3f58a16d8eec385e2b3ebdfbb84ff9d3bf27e025"
"https://llvm.googlesource.com/clang llvm/tools/clang 727ea63e6e82677f6e10e05e08bc7d6bdbae3111"
"https://llvm.googlesource.com/clang llvm/tools/clang 727ea63e6e82677f6e10e05e08bc7d6bdbae3111"
"https://llvm.googlesource.com/lld llvm/tools/lld a31286c1366e5e89b8872803fded13805a1a084b"
"https://llvm.googlesource.com/lld llvm/tools/lld a31286c1366e5e89b8872803fded13805a1a084b"
...
@@ -51,7 +51,7 @@ cd llvm
...
@@ -51,7 +51,7 @@ cd llvm
mkdir
build
mkdir
build
cd
build
cd
build
hide_output cmake
-GNinja
\
hide_output cmake
-GNinja
\
-DFUCHSIA_SYSROOT
=
${
PWD
}
/../../
magenta
/third_party/ulib/musl
\
-DFUCHSIA_SYSROOT
=
${
PWD
}
/../../
zircon
/third_party/ulib/musl
\
-DLLVM_ENABLE_LTO
=
OFF
\
-DLLVM_ENABLE_LTO
=
OFF
\
-DCLANG_BOOTSTRAP_PASSTHROUGH
=
LLVM_ENABLE_LTO
\
-DCLANG_BOOTSTRAP_PASSTHROUGH
=
LLVM_ENABLE_LTO
\
-C
../tools/clang/cmake/caches/Fuchsia.cmake
\
-C
../tools/clang/cmake/caches/Fuchsia.cmake
\
...
@@ -62,21 +62,21 @@ cd ../..
...
@@ -62,21 +62,21 @@ cd ../..
# Build sysroot
# Build sysroot
rm
-rf
llvm/runtimes/compiler-rt
rm
-rf
llvm/runtimes/compiler-rt
./
magenta
/scripts/download-toolchain
./
zircon
/scripts/download-toolchain
build_sysroot
()
{
build_sysroot
()
{
local arch
=
"
$1
"
local arch
=
"
$1
"
case
"
${
arch
}
"
in
case
"
${
arch
}
"
in
x86_64
)
tgt
=
"
magenta
-pc-x86-64"
;;
x86_64
)
tgt
=
"
zircon
-pc-x86-64"
;;
aarch64
)
tgt
=
"
magenta
-qemu-arm64"
;;
aarch64
)
tgt
=
"
zircon
-qemu-arm64"
;;
esac
esac
hide_output make
-C
magenta
-j
$(
getconf _NPROCESSORS_ONLN
)
$tgt
hide_output make
-C
zircon
-j
$(
getconf _NPROCESSORS_ONLN
)
$tgt
dst
=
/usr/local/
${
arch
}
-unknown-fuchsia
dst
=
/usr/local/
${
arch
}
-unknown-fuchsia
mkdir
-p
$dst
mkdir
-p
$dst
cp
-r
magenta
/build-
${
tgt
}
/sysroot/include
$dst
/
cp
-r
zircon
/build-
${
tgt
}
/sysroot/include
$dst
/
cp
-r
magenta
/build-
${
tgt
}
/sysroot/lib
$dst
/
cp
-r
zircon
/build-
${
tgt
}
/sysroot/lib
$dst
/
cd
llvm
cd
llvm
mkdir
build-runtimes-
${
arch
}
mkdir
build-runtimes-
${
arch
}
...
@@ -112,7 +112,7 @@ build_sysroot() {
...
@@ -112,7 +112,7 @@ build_sysroot() {
build_sysroot
"x86_64"
build_sysroot
"x86_64"
build_sysroot
"aarch64"
build_sysroot
"aarch64"
rm
-rf
magenta
llvm
rm
-rf
zircon
llvm
for
arch
in
x86_64 aarch64
;
do
for
arch
in
x86_64 aarch64
;
do
for
tool
in
clang clang++
;
do
for
tool
in
clang clang++
;
do
...
...
src/libstd/build.rs
浏览文件 @
43cff131
...
@@ -68,8 +68,8 @@ fn main() {
...
@@ -68,8 +68,8 @@ fn main() {
if
cfg!
(
feature
=
"backtrace"
)
{
if
cfg!
(
feature
=
"backtrace"
)
{
println!
(
"cargo:rustc-link-lib=backtrace"
);
println!
(
"cargo:rustc-link-lib=backtrace"
);
}
}
println!
(
"cargo:rustc-link-lib=
magenta
"
);
println!
(
"cargo:rustc-link-lib=
zircon
"
);
println!
(
"cargo:rustc-link-lib=
mx
io"
);
println!
(
"cargo:rustc-link-lib=
fd
io"
);
println!
(
"cargo:rustc-link-lib=launchpad"
);
// for std::process
println!
(
"cargo:rustc-link-lib=launchpad"
);
// for std::process
}
}
}
}
...
...
src/libstd/sys/unix/process/mod.rs
浏览文件 @
43cff131
...
@@ -19,4 +19,4 @@
...
@@ -19,4 +19,4 @@
#[path
=
"process_fuchsia.rs"
]
#[path
=
"process_fuchsia.rs"
]
mod
process_inner
;
mod
process_inner
;
#[cfg(target_os
=
"fuchsia"
)]
#[cfg(target_os
=
"fuchsia"
)]
mod
magenta
;
mod
zircon
;
src/libstd/sys/unix/process/process_fuchsia.rs
浏览文件 @
43cff131
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
use
mem
;
use
mem
;
use
ptr
;
use
ptr
;
use
sys
::
process
::
magenta
::{
Handle
,
m
x_handle_t
};
use
sys
::
process
::
zircon
::{
Handle
,
z
x_handle_t
};
use
sys
::
process
::
process_common
::
*
;
use
sys
::
process
::
process_common
::
*
;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
...
@@ -51,10 +51,10 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
...
@@ -51,10 +51,10 @@ pub fn exec(&mut self, default: Stdio) -> io::Error {
}
}
unsafe
fn
do_exec
(
&
mut
self
,
stdio
:
ChildPipes
)
unsafe
fn
do_exec
(
&
mut
self
,
stdio
:
ChildPipes
)
->
io
::
Result
<
m
x_handle_t
>
{
->
io
::
Result
<
z
x_handle_t
>
{
use
sys
::
process
::
magenta
::
*
;
use
sys
::
process
::
zircon
::
*
;
let
job_handle
=
m
x_job_default
();
let
job_handle
=
z
x_job_default
();
let
envp
=
match
*
self
.get_envp
()
{
let
envp
=
match
*
self
.get_envp
()
{
Some
(
ref
envp
)
=>
envp
.as_ptr
(),
Some
(
ref
envp
)
=>
envp
.as_ptr
(),
None
=>
ptr
::
null
(),
None
=>
ptr
::
null
(),
...
@@ -67,39 +67,39 @@ impl Drop for LaunchpadDestructor {
...
@@ -67,39 +67,39 @@ impl Drop for LaunchpadDestructor {
}
}
// Duplicate the job handle
// Duplicate the job handle
let
mut
job_copy
:
mx_handle_t
=
MX
_HANDLE_INVALID
;
let
mut
job_copy
:
zx_handle_t
=
zx
_HANDLE_INVALID
;
mx_cvt
(
mx_handle_duplicate
(
job_handle
,
MX
_RIGHT_SAME_RIGHTS
,
&
mut
job_copy
))
?
;
zx_cvt
(
zx_handle_duplicate
(
job_handle
,
zx
_RIGHT_SAME_RIGHTS
,
&
mut
job_copy
))
?
;
// Create a launchpad
// Create a launchpad
let
mut
launchpad
:
*
mut
launchpad_t
=
ptr
::
null_mut
();
let
mut
launchpad
:
*
mut
launchpad_t
=
ptr
::
null_mut
();
m
x_cvt
(
launchpad_create
(
job_copy
,
self
.get_argv
()[
0
],
&
mut
launchpad
))
?
;
z
x_cvt
(
launchpad_create
(
job_copy
,
self
.get_argv
()[
0
],
&
mut
launchpad
))
?
;
let
launchpad_destructor
=
LaunchpadDestructor
(
launchpad
);
let
launchpad_destructor
=
LaunchpadDestructor
(
launchpad
);
// Set the process argv
// Set the process argv
m
x_cvt
(
launchpad_set_args
(
launchpad
,
self
.get_argv
()
.len
()
as
i32
-
1
,
z
x_cvt
(
launchpad_set_args
(
launchpad
,
self
.get_argv
()
.len
()
as
i32
-
1
,
self
.get_argv
()
.as_ptr
()))
?
;
self
.get_argv
()
.as_ptr
()))
?
;
// Setup the environment vars
// Setup the environment vars
m
x_cvt
(
launchpad_set_environ
(
launchpad
,
envp
))
?
;
z
x_cvt
(
launchpad_set_environ
(
launchpad
,
envp
))
?
;
m
x_cvt
(
launchpad_add_vdso_vmo
(
launchpad
))
?
;
z
x_cvt
(
launchpad_add_vdso_vmo
(
launchpad
))
?
;
// Load the executable
// Load the executable
m
x_cvt
(
launchpad_elf_load
(
launchpad
,
launchpad_vmo_from_file
(
self
.get_argv
()[
0
])))
?
;
z
x_cvt
(
launchpad_elf_load
(
launchpad
,
launchpad_vmo_from_file
(
self
.get_argv
()[
0
])))
?
;
mx_cvt
(
launchpad_load_vdso
(
launchpad
,
MX
_HANDLE_INVALID
))
?
;
zx_cvt
(
launchpad_load_vdso
(
launchpad
,
zx
_HANDLE_INVALID
))
?
;
mx_cvt
(
launchpad_clone
(
launchpad
,
LP_CLONE_MXIO_ROOT
|
LP_CLONE_MX
IO_CWD
))
?
;
zx_cvt
(
launchpad_clone
(
launchpad
,
LP_CLONE_FDIO_ROOT
|
LP_CLONE_FD
IO_CWD
))
?
;
// Clone stdin, stdout, and stderr
// Clone stdin, stdout, and stderr
if
let
Some
(
fd
)
=
stdio
.stdin
.fd
()
{
if
let
Some
(
fd
)
=
stdio
.stdin
.fd
()
{
m
x_cvt
(
launchpad_transfer_fd
(
launchpad
,
fd
,
0
))
?
;
z
x_cvt
(
launchpad_transfer_fd
(
launchpad
,
fd
,
0
))
?
;
}
else
{
}
else
{
m
x_cvt
(
launchpad_clone_fd
(
launchpad
,
0
,
0
))
?
;
z
x_cvt
(
launchpad_clone_fd
(
launchpad
,
0
,
0
))
?
;
}
}
if
let
Some
(
fd
)
=
stdio
.stdout
.fd
()
{
if
let
Some
(
fd
)
=
stdio
.stdout
.fd
()
{
m
x_cvt
(
launchpad_transfer_fd
(
launchpad
,
fd
,
1
))
?
;
z
x_cvt
(
launchpad_transfer_fd
(
launchpad
,
fd
,
1
))
?
;
}
else
{
}
else
{
m
x_cvt
(
launchpad_clone_fd
(
launchpad
,
1
,
1
))
?
;
z
x_cvt
(
launchpad_clone_fd
(
launchpad
,
1
,
1
))
?
;
}
}
if
let
Some
(
fd
)
=
stdio
.stderr
.fd
()
{
if
let
Some
(
fd
)
=
stdio
.stderr
.fd
()
{
m
x_cvt
(
launchpad_transfer_fd
(
launchpad
,
fd
,
2
))
?
;
z
x_cvt
(
launchpad_transfer_fd
(
launchpad
,
fd
,
2
))
?
;
}
else
{
}
else
{
m
x_cvt
(
launchpad_clone_fd
(
launchpad
,
2
,
2
))
?
;
z
x_cvt
(
launchpad_clone_fd
(
launchpad
,
2
,
2
))
?
;
}
}
// We don't want FileDesc::drop to be called on any stdio. It would close their fds. The
// We don't want FileDesc::drop to be called on any stdio. It would close their fds. The
...
@@ -113,9 +113,9 @@ impl Drop for LaunchpadDestructor {
...
@@ -113,9 +113,9 @@ impl Drop for LaunchpadDestructor {
// `launchpad_go` destroys the launchpad, so we must not
// `launchpad_go` destroys the launchpad, so we must not
mem
::
forget
(
launchpad_destructor
);
mem
::
forget
(
launchpad_destructor
);
let
mut
process_handle
:
m
x_handle_t
=
0
;
let
mut
process_handle
:
z
x_handle_t
=
0
;
let
mut
err_msg
:
*
const
libc
::
c_char
=
ptr
::
null
();
let
mut
err_msg
:
*
const
libc
::
c_char
=
ptr
::
null
();
m
x_cvt
(
launchpad_go
(
launchpad
,
&
mut
process_handle
,
&
mut
err_msg
))
?
;
z
x_cvt
(
launchpad_go
(
launchpad
,
&
mut
process_handle
,
&
mut
err_msg
))
?
;
// FIXME: See if we want to do something with that err_msg
// FIXME: See if we want to do something with that err_msg
Ok
(
process_handle
)
Ok
(
process_handle
)
...
@@ -136,27 +136,27 @@ pub fn id(&self) -> u32 {
...
@@ -136,27 +136,27 @@ pub fn id(&self) -> u32 {
}
}
pub
fn
kill
(
&
mut
self
)
->
io
::
Result
<
()
>
{
pub
fn
kill
(
&
mut
self
)
->
io
::
Result
<
()
>
{
use
sys
::
process
::
magenta
::
*
;
use
sys
::
process
::
zircon
::
*
;
unsafe
{
mx_cvt
(
m
x_task_kill
(
self
.handle
.raw
()))
?
;
}
unsafe
{
zx_cvt
(
z
x_task_kill
(
self
.handle
.raw
()))
?
;
}
Ok
(())
Ok
(())
}
}
pub
fn
wait
(
&
mut
self
)
->
io
::
Result
<
ExitStatus
>
{
pub
fn
wait
(
&
mut
self
)
->
io
::
Result
<
ExitStatus
>
{
use
default
::
Default
;
use
default
::
Default
;
use
sys
::
process
::
magenta
::
*
;
use
sys
::
process
::
zircon
::
*
;
let
mut
proc_info
:
m
x_info_process_t
=
Default
::
default
();
let
mut
proc_info
:
z
x_info_process_t
=
Default
::
default
();
let
mut
actual
:
m
x_size_t
=
0
;
let
mut
actual
:
z
x_size_t
=
0
;
let
mut
avail
:
m
x_size_t
=
0
;
let
mut
avail
:
z
x_size_t
=
0
;
unsafe
{
unsafe
{
mx_cvt
(
mx_object_wait_one
(
self
.handle
.raw
(),
MX
_TASK_TERMINATED
,
zx_cvt
(
zx_object_wait_one
(
self
.handle
.raw
(),
zx
_TASK_TERMINATED
,
MX
_TIME_INFINITE
,
ptr
::
null_mut
()))
?
;
zx
_TIME_INFINITE
,
ptr
::
null_mut
()))
?
;
mx_cvt
(
mx_object_get_info
(
self
.handle
.raw
(),
MX
_INFO_PROCESS
,
zx_cvt
(
zx_object_get_info
(
self
.handle
.raw
(),
zx
_INFO_PROCESS
,
&
mut
proc_info
as
*
mut
_
as
*
mut
libc
::
c_void
,
&
mut
proc_info
as
*
mut
_
as
*
mut
libc
::
c_void
,
mem
::
size_of
::
<
m
x_info_process_t
>
(),
&
mut
actual
,
mem
::
size_of
::
<
z
x_info_process_t
>
(),
&
mut
actual
,
&
mut
avail
))
?
;
&
mut
avail
))
?
;
}
}
if
actual
!=
1
{
if
actual
!=
1
{
...
@@ -168,14 +168,14 @@ pub fn wait(&mut self) -> io::Result<ExitStatus> {
...
@@ -168,14 +168,14 @@ pub fn wait(&mut self) -> io::Result<ExitStatus> {
pub
fn
try_wait
(
&
mut
self
)
->
io
::
Result
<
Option
<
ExitStatus
>>
{
pub
fn
try_wait
(
&
mut
self
)
->
io
::
Result
<
Option
<
ExitStatus
>>
{
use
default
::
Default
;
use
default
::
Default
;
use
sys
::
process
::
magenta
::
*
;
use
sys
::
process
::
zircon
::
*
;
let
mut
proc_info
:
m
x_info_process_t
=
Default
::
default
();
let
mut
proc_info
:
z
x_info_process_t
=
Default
::
default
();
let
mut
actual
:
m
x_size_t
=
0
;
let
mut
actual
:
z
x_size_t
=
0
;
let
mut
avail
:
m
x_size_t
=
0
;
let
mut
avail
:
z
x_size_t
=
0
;
unsafe
{
unsafe
{
let
status
=
mx_object_wait_one
(
self
.handle
.raw
(),
MX
_TASK_TERMINATED
,
let
status
=
zx_object_wait_one
(
self
.handle
.raw
(),
zx
_TASK_TERMINATED
,
0
,
ptr
::
null_mut
());
0
,
ptr
::
null_mut
());
match
status
{
match
status
{
0
=>
{
},
// Success
0
=>
{
},
// Success
...
@@ -184,9 +184,9 @@ pub fn try_wait(&mut self) -> io::Result<Option<ExitStatus>> {
...
@@ -184,9 +184,9 @@ pub fn try_wait(&mut self) -> io::Result<Option<ExitStatus>> {
},
},
_
=>
{
panic!
(
"Failed to wait on process handle: {}"
,
status
);
},
_
=>
{
panic!
(
"Failed to wait on process handle: {}"
,
status
);
},
}
}
mx_cvt
(
mx_object_get_info
(
self
.handle
.raw
(),
MX
_INFO_PROCESS
,
zx_cvt
(
zx_object_get_info
(
self
.handle
.raw
(),
zx
_INFO_PROCESS
,
&
mut
proc_info
as
*
mut
_
as
*
mut
libc
::
c_void
,
&
mut
proc_info
as
*
mut
_
as
*
mut
libc
::
c_void
,
mem
::
size_of
::
<
m
x_info_process_t
>
(),
&
mut
actual
,
mem
::
size_of
::
<
z
x_info_process_t
>
(),
&
mut
actual
,
&
mut
avail
))
?
;
&
mut
avail
))
?
;
}
}
if
actual
!=
1
{
if
actual
!=
1
{
...
...
src/libstd/sys/unix/process/
magenta
.rs
→
src/libstd/sys/unix/process/
zircon
.rs
浏览文件 @
43cff131
...
@@ -17,31 +17,31 @@
...
@@ -17,31 +17,31 @@
use
libc
::{
c_int
,
c_void
};
use
libc
::{
c_int
,
c_void
};
pub
type
m
x_handle_t
=
i32
;
pub
type
z
x_handle_t
=
i32
;
pub
type
m
x_vaddr_t
=
usize
;
pub
type
z
x_vaddr_t
=
usize
;
pub
type
m
x_rights_t
=
u32
;
pub
type
z
x_rights_t
=
u32
;
pub
type
m
x_status_t
=
i32
;
pub
type
z
x_status_t
=
i32
;
pub
type
m
x_size_t
=
usize
;
pub
type
z
x_size_t
=
usize
;
pub
const
MX_HANDLE_INVALID
:
m
x_handle_t
=
0
;
pub
const
zx_HANDLE_INVALID
:
z
x_handle_t
=
0
;
pub
type
m
x_time_t
=
u64
;
pub
type
z
x_time_t
=
u64
;
pub
const
MX_TIME_INFINITE
:
m
x_time_t
=
u64
::
MAX
;
pub
const
zx_TIME_INFINITE
:
z
x_time_t
=
u64
::
MAX
;
pub
type
m
x_signals_t
=
u32
;
pub
type
z
x_signals_t
=
u32
;
pub
const
MX_OBJECT_SIGNAL_3
:
m
x_signals_t
=
1
<<
3
;
pub
const
zx_OBJECT_SIGNAL_3
:
z
x_signals_t
=
1
<<
3
;
pub
const
MX_TASK_TERMINATED
:
mx_signals_t
=
MX
_OBJECT_SIGNAL_3
;
pub
const
zx_TASK_TERMINATED
:
zx_signals_t
=
zx
_OBJECT_SIGNAL_3
;
pub
const
MX_RIGHT_SAME_RIGHTS
:
m
x_rights_t
=
1
<<
31
;
pub
const
zx_RIGHT_SAME_RIGHTS
:
z
x_rights_t
=
1
<<
31
;
pub
type
m
x_object_info_topic_t
=
u32
;
pub
type
z
x_object_info_topic_t
=
u32
;
pub
const
MX_INFO_PROCESS
:
m
x_object_info_topic_t
=
3
;
pub
const
zx_INFO_PROCESS
:
z
x_object_info_topic_t
=
3
;
pub
fn
mx_cvt
<
T
>
(
t
:
T
)
->
io
::
Result
<
T
>
where
T
:
TryInto
<
m
x_status_t
>+
Copy
{
pub
fn
zx_cvt
<
T
>
(
t
:
T
)
->
io
::
Result
<
T
>
where
T
:
TryInto
<
z
x_status_t
>+
Copy
{
if
let
Ok
(
status
)
=
TryInto
::
try_into
(
t
)
{
if
let
Ok
(
status
)
=
TryInto
::
try_into
(
t
)
{
if
status
<
0
{
if
status
<
0
{
Err
(
io
::
Error
::
from_raw_os_error
(
status
))
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,33 +53,33 @@ pub fn mx_cvt<T>(t: T) -> io::Result<T> where T: TryInto<mx_status_t>+Copy {
}
}
}
}
// Safe wrapper around
m
x_handle_t
// Safe wrapper around
z
x_handle_t
pub
struct
Handle
{
pub
struct
Handle
{
raw
:
m
x_handle_t
,
raw
:
z
x_handle_t
,
}
}
impl
Handle
{
impl
Handle
{
pub
fn
new
(
raw
:
m
x_handle_t
)
->
Handle
{
pub
fn
new
(
raw
:
z
x_handle_t
)
->
Handle
{
Handle
{
Handle
{
raw
,
raw
,
}
}
}
}
pub
fn
raw
(
&
self
)
->
m
x_handle_t
{
pub
fn
raw
(
&
self
)
->
z
x_handle_t
{
self
.raw
self
.raw
}
}
}
}
impl
Drop
for
Handle
{
impl
Drop
for
Handle
{
fn
drop
(
&
mut
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
mx_cvt
(
mx_handle_close
(
self
.raw
))
.expect
(
"Failed to close m
x_handle_t"
);
}
unsafe
{
zx_cvt
(
zx_handle_close
(
self
.raw
))
.expect
(
"Failed to close z
x_handle_t"
);
}
}
}
}
}
// Common
MX
_INFO header
// Common
zx
_INFO header
#[derive(Default)]
#[derive(Default)]
#[repr(C)]
#[repr(C)]
pub
struct
m
x_info_header_t
{
pub
struct
z
x_info_header_t
{
pub
topic
:
u32
,
// identifies the info struct
pub
topic
:
u32
,
// identifies the info struct
pub
avail_topic_size
:
u16
,
// “native” size of the struct
pub
avail_topic_size
:
u16
,
// “native” size of the struct
pub
topic_size
:
u16
,
// size of the returned struct (<=topic_size)
pub
topic_size
:
u16
,
// size of the returned struct (<=topic_size)
...
@@ -89,34 +89,34 @@ pub struct mx_info_header_t {
...
@@ -89,34 +89,34 @@ pub struct mx_info_header_t {
#[derive(Default)]
#[derive(Default)]
#[repr(C)]
#[repr(C)]
pub
struct
m
x_record_process_t
{
pub
struct
z
x_record_process_t
{
pub
return_code
:
c_int
,
pub
return_code
:
c_int
,
}
}
// Returned for topic
MX
_INFO_PROCESS
// Returned for topic
zx
_INFO_PROCESS
#[derive(Default)]
#[derive(Default)]
#[repr(C)]
#[repr(C)]
pub
struct
m
x_info_process_t
{
pub
struct
z
x_info_process_t
{
pub
hdr
:
m
x_info_header_t
,
pub
hdr
:
z
x_info_header_t
,
pub
rec
:
m
x_record_process_t
,
pub
rec
:
z
x_record_process_t
,
}
}
extern
{
extern
{
pub
fn
mx_job_default
()
->
m
x_handle_t
;
pub
fn
zx_job_default
()
->
z
x_handle_t
;
pub
fn
mx_task_kill
(
handle
:
mx_handle_t
)
->
m
x_status_t
;
pub
fn
zx_task_kill
(
handle
:
zx_handle_t
)
->
z
x_status_t
;
pub
fn
mx_handle_close
(
handle
:
mx_handle_t
)
->
m
x_status_t
;
pub
fn
zx_handle_close
(
handle
:
zx_handle_t
)
->
z
x_status_t
;
pub
fn
mx_handle_duplicate
(
handle
:
mx_handle_t
,
rights
:
m
x_rights_t
,
pub
fn
zx_handle_duplicate
(
handle
:
zx_handle_t
,
rights
:
z
x_rights_t
,
out
:
*
const
mx_handle_t
)
->
m
x_handle_t
;
out
:
*
const
zx_handle_t
)
->
z
x_handle_t
;
pub
fn
mx_object_wait_one
(
handle
:
mx_handle_t
,
signals
:
mx_signals_t
,
timeout
:
m
x_time_t
,
pub
fn
zx_object_wait_one
(
handle
:
zx_handle_t
,
signals
:
zx_signals_t
,
timeout
:
z
x_time_t
,
pending
:
*
mut
mx_signals_t
)
->
m
x_status_t
;
pending
:
*
mut
zx_signals_t
)
->
z
x_status_t
;
pub
fn
mx_object_get_info
(
handle
:
m
x_handle_t
,
topic
:
u32
,
buffer
:
*
mut
c_void
,
pub
fn
zx_object_get_info
(
handle
:
z
x_handle_t
,
topic
:
u32
,
buffer
:
*
mut
c_void
,
buffer_size
:
mx_size_t
,
actual_size
:
*
mut
m
x_size_t
,
buffer_size
:
zx_size_t
,
actual_size
:
*
mut
z
x_size_t
,
avail
:
*
mut
mx_size_t
)
->
m
x_status_t
;
avail
:
*
mut
zx_size_t
)
->
z
x_status_t
;
}
}
// From `enum special_handles` in system/ulib/launchpad/launchpad.c
// From `enum special_handles` in system/ulib/launchpad/launchpad.c
...
@@ -133,117 +133,117 @@ pub struct launchpad_t {
...
@@ -133,117 +133,117 @@ pub struct launchpad_t {
env
:
*
const
c_char
,
env
:
*
const
c_char
,
env_len
:
usize
,
env_len
:
usize
,
handles
:
*
mut
m
x_handle_t
,
handles
:
*
mut
z
x_handle_t
,
handles_info
:
*
mut
u32
,
handles_info
:
*
mut
u32
,
handle_count
:
usize
,
handle_count
:
usize
,
handle_alloc
:
usize
,
handle_alloc
:
usize
,
entry
:
m
x_vaddr_t
,
entry
:
z
x_vaddr_t
,
base
:
m
x_vaddr_t
,
base
:
z
x_vaddr_t
,
vdso_base
:
m
x_vaddr_t
,
vdso_base
:
z
x_vaddr_t
,
stack_size
:
usize
,
stack_size
:
usize
,
special_handles
:
[
m
x_handle_t
;
HND_SPECIAL_COUNT
],
special_handles
:
[
z
x_handle_t
;
HND_SPECIAL_COUNT
],
loader_message
:
bool
,
loader_message
:
bool
,
}
}
extern
{
extern
{
pub
fn
launchpad_create
(
job
:
m
x_handle_t
,
name
:
*
const
c_char
,
pub
fn
launchpad_create
(
job
:
z
x_handle_t
,
name
:
*
const
c_char
,
lp
:
*
mut
*
mut
launchpad_t
)
->
m
x_status_t
;
lp
:
*
mut
*
mut
launchpad_t
)
->
z
x_status_t
;
pub
fn
launchpad_go
(
lp
:
*
mut
launchpad_t
,
pub
fn
launchpad_go
(
lp
:
*
mut
launchpad_t
,
proc_handle
:
*
mut
m
x_handle_t
,
proc_handle
:
*
mut
z
x_handle_t
,
err_msg
:
*
mut
*
const
c_char
)
->
m
x_status_t
;
err_msg
:
*
mut
*
const
c_char
)
->
z
x_status_t
;
pub
fn
launchpad_destroy
(
lp
:
*
mut
launchpad_t
);
pub
fn
launchpad_destroy
(
lp
:
*
mut
launchpad_t
);
pub
fn
launchpad_set_args
(
lp
:
*
mut
launchpad_t
,
argc
:
c_int
,
pub
fn
launchpad_set_args
(
lp
:
*
mut
launchpad_t
,
argc
:
c_int
,
argv
:
*
const
*
const
c_char
)
->
m
x_status_t
;
argv
:
*
const
*
const
c_char
)
->
z
x_status_t
;
pub
fn
launchpad_set_environ
(
lp
:
*
mut
launchpad_t
,
envp
:
*
const
*
const
c_char
)
->
m
x_status_t
;
pub
fn
launchpad_set_environ
(
lp
:
*
mut
launchpad_t
,
envp
:
*
const
*
const
c_char
)
->
z
x_status_t
;
pub
fn
launchpad_clone
(
lp
:
*
mut
launchpad_t
,
what
:
u32
)
->
m
x_status_t
;
pub
fn
launchpad_clone
(
lp
:
*
mut
launchpad_t
,
what
:
u32
)
->
z
x_status_t
;
pub
fn
launchpad_clone_fd
(
lp
:
*
mut
launchpad_t
,
fd
:
c_int
,
target_fd
:
c_int
)
->
m
x_status_t
;
pub
fn
launchpad_clone_fd
(
lp
:
*
mut
launchpad_t
,
fd
:
c_int
,
target_fd
:
c_int
)
->
z
x_status_t
;
pub
fn
launchpad_transfer_fd
(
lp
:
*
mut
launchpad_t
,
fd
:
c_int
,
target_fd
:
c_int
)
->
m
x_status_t
;
pub
fn
launchpad_transfer_fd
(
lp
:
*
mut
launchpad_t
,
fd
:
c_int
,
target_fd
:
c_int
)
->
z
x_status_t
;
pub
fn
launchpad_elf_load
(
lp
:
*
mut
launchpad_t
,
vmo
:
mx_handle_t
)
->
m
x_status_t
;
pub
fn
launchpad_elf_load
(
lp
:
*
mut
launchpad_t
,
vmo
:
zx_handle_t
)
->
z
x_status_t
;
pub
fn
launchpad_add_vdso_vmo
(
lp
:
*
mut
launchpad_t
)
->
m
x_status_t
;
pub
fn
launchpad_add_vdso_vmo
(
lp
:
*
mut
launchpad_t
)
->
z
x_status_t
;
pub
fn
launchpad_load_vdso
(
lp
:
*
mut
launchpad_t
,
vmo
:
mx_handle_t
)
->
m
x_status_t
;
pub
fn
launchpad_load_vdso
(
lp
:
*
mut
launchpad_t
,
vmo
:
zx_handle_t
)
->
z
x_status_t
;
pub
fn
launchpad_vmo_from_file
(
filename
:
*
const
c_char
)
->
m
x_handle_t
;
pub
fn
launchpad_vmo_from_file
(
filename
:
*
const
c_char
)
->
z
x_handle_t
;
}
}
// Launchpad clone constants
// Launchpad clone constants
pub
const
LP_CLONE_
MX
IO_ROOT
:
u32
=
0x0001
;
pub
const
LP_CLONE_
FD
IO_ROOT
:
u32
=
0x0001
;
pub
const
LP_CLONE_
MX
IO_CWD
:
u32
=
0x0002
;
pub
const
LP_CLONE_
FD
IO_CWD
:
u32
=
0x0002
;
// LP_CLONE_
MX
IO_STDIO = 0x0004
// LP_CLONE_
FD
IO_STDIO = 0x0004
// LP_CLONE_
MX
IO_ALL = 0x00FF
// LP_CLONE_
FD
IO_ALL = 0x00FF
// LP_CLONE_ENVIRON = 0x0100
// LP_CLONE_ENVIRON = 0x0100
// LP_CLONE_DEFAULT_JOB = 0x0200
// LP_CLONE_DEFAULT_JOB = 0x0200
// LP_CLONE_ALL = 0xFFFF
// LP_CLONE_ALL = 0xFFFF
// Errors
// Errors
#[allow(unused)]
pub
const
ERR_INTERNAL
:
m
x_status_t
=
-
1
;
#[allow(unused)]
pub
const
ERR_INTERNAL
:
z
x_status_t
=
-
1
;
// ERR_NOT_SUPPORTED: The operation is not implemented, supported,
// ERR_NOT_SUPPORTED: The operation is not implemented, supported,
// or enabled.
// or enabled.
#[allow(unused)]
pub
const
ERR_NOT_SUPPORTED
:
m
x_status_t
=
-
2
;
#[allow(unused)]
pub
const
ERR_NOT_SUPPORTED
:
z
x_status_t
=
-
2
;
// ERR_NO_RESOURCES: The system was not able to allocate some resource
// ERR_NO_RESOURCES: The system was not able to allocate some resource
// needed for the operation.
// needed for the operation.
#[allow(unused)]
pub
const
ERR_NO_RESOURCES
:
m
x_status_t
=
-
3
;
#[allow(unused)]
pub
const
ERR_NO_RESOURCES
:
z
x_status_t
=
-
3
;
// ERR_NO_MEMORY: The system was not able to allocate memory needed
// ERR_NO_MEMORY: The system was not able to allocate memory needed
// for the operation.
// for the operation.
#[allow(unused)]
pub
const
ERR_NO_MEMORY
:
m
x_status_t
=
-
4
;
#[allow(unused)]
pub
const
ERR_NO_MEMORY
:
z
x_status_t
=
-
4
;
// ERR_CALL_FAILED: The second phase of
m
x_channel_call(; did not complete
// ERR_CALL_FAILED: The second phase of
z
x_channel_call(; did not complete
// successfully.
// successfully.
#[allow(unused)]
pub
const
ERR_CALL_FAILED
:
m
x_status_t
=
-
5
;
#[allow(unused)]
pub
const
ERR_CALL_FAILED
:
z
x_status_t
=
-
5
;
// ERR_INTERRUPTED_RETRY: The system call was interrupted, but should be
// ERR_INTERRUPTED_RETRY: The system call was interrupted, but should be
// retried. This should not be seen outside of the VDSO.
// retried. This should not be seen outside of the VDSO.
#[allow(unused)]
pub
const
ERR_INTERRUPTED_RETRY
:
m
x_status_t
=
-
6
;
#[allow(unused)]
pub
const
ERR_INTERRUPTED_RETRY
:
z
x_status_t
=
-
6
;
// ======= Parameter errors =======
// ======= Parameter errors =======
// ERR_INVALID_ARGS: an argument is invalid, ex. null pointer
// ERR_INVALID_ARGS: an argument is invalid, ex. null pointer
#[allow(unused)]
pub
const
ERR_INVALID_ARGS
:
m
x_status_t
=
-
10
;
#[allow(unused)]
pub
const
ERR_INVALID_ARGS
:
z
x_status_t
=
-
10
;
// ERR_BAD_HANDLE: A specified handle value does not refer to a handle.
// ERR_BAD_HANDLE: A specified handle value does not refer to a handle.
#[allow(unused)]
pub
const
ERR_BAD_HANDLE
:
m
x_status_t
=
-
11
;
#[allow(unused)]
pub
const
ERR_BAD_HANDLE
:
z
x_status_t
=
-
11
;
// ERR_WRONG_TYPE: The subject of the operation is the wrong type to
// ERR_WRONG_TYPE: The subject of the operation is the wrong type to
// perform the operation.
// perform the operation.
// Example: Attempting a message_read on a thread handle.
// Example: Attempting a message_read on a thread handle.
#[allow(unused)]
pub
const
ERR_WRONG_TYPE
:
m
x_status_t
=
-
12
;
#[allow(unused)]
pub
const
ERR_WRONG_TYPE
:
z
x_status_t
=
-
12
;
// ERR_BAD_SYSCALL: The specified syscall number is invalid.
// ERR_BAD_SYSCALL: The specified syscall number is invalid.
#[allow(unused)]
pub
const
ERR_BAD_SYSCALL
:
m
x_status_t
=
-
13
;
#[allow(unused)]
pub
const
ERR_BAD_SYSCALL
:
z
x_status_t
=
-
13
;
// ERR_OUT_OF_RANGE: An argument is outside the valid range for this
// ERR_OUT_OF_RANGE: An argument is outside the valid range for this
// operation.
// operation.
#[allow(unused)]
pub
const
ERR_OUT_OF_RANGE
:
m
x_status_t
=
-
14
;
#[allow(unused)]
pub
const
ERR_OUT_OF_RANGE
:
z
x_status_t
=
-
14
;
// ERR_BUFFER_TOO_SMALL: A caller provided buffer is too small for
// ERR_BUFFER_TOO_SMALL: A caller provided buffer is too small for
// this operation.
// this operation.
#[allow(unused)]
pub
const
ERR_BUFFER_TOO_SMALL
:
m
x_status_t
=
-
15
;
#[allow(unused)]
pub
const
ERR_BUFFER_TOO_SMALL
:
z
x_status_t
=
-
15
;
// ======= Precondition or state errors =======
// ======= Precondition or state errors =======
// ERR_BAD_STATE: operation failed because the current state of the
// ERR_BAD_STATE: operation failed because the current state of the
// object does not allow it, or a precondition of the operation is
// object does not allow it, or a precondition of the operation is
// not satisfied
// not satisfied
#[allow(unused)]
pub
const
ERR_BAD_STATE
:
m
x_status_t
=
-
20
;
#[allow(unused)]
pub
const
ERR_BAD_STATE
:
z
x_status_t
=
-
20
;
// ERR_TIMED_OUT: The time limit for the operation elapsed before
// ERR_TIMED_OUT: The time limit for the operation elapsed before
// the operation completed.
// the operation completed.
#[allow(unused)]
pub
const
ERR_TIMED_OUT
:
m
x_status_t
=
-
21
;
#[allow(unused)]
pub
const
ERR_TIMED_OUT
:
z
x_status_t
=
-
21
;
// ERR_SHOULD_WAIT: The operation cannot be performed currently but
// ERR_SHOULD_WAIT: The operation cannot be performed currently but
// potentially could succeed if the caller waits for a prerequisite
// potentially could succeed if the caller waits for a prerequisite
...
@@ -253,67 +253,67 @@ pub fn launchpad_set_args(lp: *mut launchpad_t, argc: c_int,
...
@@ -253,67 +253,67 @@ pub fn launchpad_set_args(lp: *mut launchpad_t, argc: c_int,
// messages waiting but has an open remote will return ERR_SHOULD_WAIT.
// messages waiting but has an open remote will return ERR_SHOULD_WAIT.
// Attempting to read from a message pipe that has no messages waiting
// Attempting to read from a message pipe that has no messages waiting
// and has a closed remote end will return ERR_REMOTE_CLOSED.
// and has a closed remote end will return ERR_REMOTE_CLOSED.
#[allow(unused)]
pub
const
ERR_SHOULD_WAIT
:
m
x_status_t
=
-
22
;
#[allow(unused)]
pub
const
ERR_SHOULD_WAIT
:
z
x_status_t
=
-
22
;
// ERR_CANCELED: The in-progress operation (e.g. a wait) has been
// ERR_CANCELED: The in-progress operation (e.g. a wait) has been
// // canceled.
// // canceled.
#[allow(unused)]
pub
const
ERR_CANCELED
:
m
x_status_t
=
-
23
;
#[allow(unused)]
pub
const
ERR_CANCELED
:
z
x_status_t
=
-
23
;
// ERR_PEER_CLOSED: The operation failed because the remote end
// ERR_PEER_CLOSED: The operation failed because the remote end
// of the subject of the operation was closed.
// of the subject of the operation was closed.
#[allow(unused)]
pub
const
ERR_PEER_CLOSED
:
m
x_status_t
=
-
24
;
#[allow(unused)]
pub
const
ERR_PEER_CLOSED
:
z
x_status_t
=
-
24
;
// ERR_NOT_FOUND: The requested entity is not found.
// ERR_NOT_FOUND: The requested entity is not found.
#[allow(unused)]
pub
const
ERR_NOT_FOUND
:
m
x_status_t
=
-
25
;
#[allow(unused)]
pub
const
ERR_NOT_FOUND
:
z
x_status_t
=
-
25
;
// ERR_ALREADY_EXISTS: An object with the specified identifier
// ERR_ALREADY_EXISTS: An object with the specified identifier
// already exists.
// already exists.
// Example: Attempting to create a file when a file already exists
// Example: Attempting to create a file when a file already exists
// with that name.
// with that name.
#[allow(unused)]
pub
const
ERR_ALREADY_EXISTS
:
m
x_status_t
=
-
26
;
#[allow(unused)]
pub
const
ERR_ALREADY_EXISTS
:
z
x_status_t
=
-
26
;
// ERR_ALREADY_BOUND: The operation failed because the named entity
// ERR_ALREADY_BOUND: The operation failed because the named entity
// is already owned or controlled by another entity. The operation
// is already owned or controlled by another entity. The operation
// could succeed later if the current owner releases the entity.
// could succeed later if the current owner releases the entity.
#[allow(unused)]
pub
const
ERR_ALREADY_BOUND
:
m
x_status_t
=
-
27
;
#[allow(unused)]
pub
const
ERR_ALREADY_BOUND
:
z
x_status_t
=
-
27
;
// ERR_UNAVAILABLE: The subject of the operation is currently unable
// ERR_UNAVAILABLE: The subject of the operation is currently unable
// to perform the operation.
// to perform the operation.
// Note: This is used when there's no direct way for the caller to
// Note: This is used when there's no direct way for the caller to
// observe when the subject will be able to perform the operation
// observe when the subject will be able to perform the operation
// and should thus retry.
// and should thus retry.
#[allow(unused)]
pub
const
ERR_UNAVAILABLE
:
m
x_status_t
=
-
28
;
#[allow(unused)]
pub
const
ERR_UNAVAILABLE
:
z
x_status_t
=
-
28
;
// ======= Permission check errors =======
// ======= Permission check errors =======
// ERR_ACCESS_DENIED: The caller did not have permission to perform
// ERR_ACCESS_DENIED: The caller did not have permission to perform
// the specified operation.
// the specified operation.
#[allow(unused)]
pub
const
ERR_ACCESS_DENIED
:
m
x_status_t
=
-
30
;
#[allow(unused)]
pub
const
ERR_ACCESS_DENIED
:
z
x_status_t
=
-
30
;
// ======= Input-output errors =======
// ======= Input-output errors =======
// ERR_IO: Otherwise unspecified error occurred during I/O.
// ERR_IO: Otherwise unspecified error occurred during I/O.
#[allow(unused)]
pub
const
ERR_IO
:
m
x_status_t
=
-
40
;
#[allow(unused)]
pub
const
ERR_IO
:
z
x_status_t
=
-
40
;
// ERR_REFUSED: The entity the I/O operation is being performed on
// ERR_REFUSED: The entity the I/O operation is being performed on
// rejected the operation.
// rejected the operation.
// Example: an I2C device NAK'ing a transaction or a disk controller
// Example: an I2C device NAK'ing a transaction or a disk controller
// rejecting an invalid command.
// rejecting an invalid command.
#[allow(unused)]
pub
const
ERR_IO_REFUSED
:
m
x_status_t
=
-
41
;
#[allow(unused)]
pub
const
ERR_IO_REFUSED
:
z
x_status_t
=
-
41
;
// ERR_IO_DATA_INTEGRITY: The data in the operation failed an integrity
// ERR_IO_DATA_INTEGRITY: The data in the operation failed an integrity
// check and is possibly corrupted.
// check and is possibly corrupted.
// Example: CRC or Parity error.
// Example: CRC or Parity error.
#[allow(unused)]
pub
const
ERR_IO_DATA_INTEGRITY
:
m
x_status_t
=
-
42
;
#[allow(unused)]
pub
const
ERR_IO_DATA_INTEGRITY
:
z
x_status_t
=
-
42
;
// ERR_IO_DATA_LOSS: The data in the operation is currently unavailable
// ERR_IO_DATA_LOSS: The data in the operation is currently unavailable
// and may be permanently lost.
// and may be permanently lost.
// Example: A disk block is irrecoverably damaged.
// Example: A disk block is irrecoverably damaged.
#[allow(unused)]
pub
const
ERR_IO_DATA_LOSS
:
m
x_status_t
=
-
43
;
#[allow(unused)]
pub
const
ERR_IO_DATA_LOSS
:
z
x_status_t
=
-
43
;
// Filesystem specific errors
// Filesystem specific errors
#[allow(unused)]
pub
const
ERR_BAD_PATH
:
m
x_status_t
=
-
50
;
#[allow(unused)]
pub
const
ERR_BAD_PATH
:
z
x_status_t
=
-
50
;
#[allow(unused)]
pub
const
ERR_NOT_DIR
:
m
x_status_t
=
-
51
;
#[allow(unused)]
pub
const
ERR_NOT_DIR
:
z
x_status_t
=
-
51
;
#[allow(unused)]
pub
const
ERR_NOT_FILE
:
m
x_status_t
=
-
52
;
#[allow(unused)]
pub
const
ERR_NOT_FILE
:
z
x_status_t
=
-
52
;
// ERR_FILE_BIG: A file exceeds a filesystem-specific size limit.
// ERR_FILE_BIG: A file exceeds a filesystem-specific size limit.
#[allow(unused)]
pub
const
ERR_FILE_BIG
:
m
x_status_t
=
-
53
;
#[allow(unused)]
pub
const
ERR_FILE_BIG
:
z
x_status_t
=
-
53
;
// ERR_NO_SPACE: Filesystem or device space is exhausted.
// ERR_NO_SPACE: Filesystem or device space is exhausted.
#[allow(unused)]
pub
const
ERR_NO_SPACE
:
m
x_status_t
=
-
54
;
#[allow(unused)]
pub
const
ERR_NO_SPACE
:
z
x_status_t
=
-
54
;
src/libstd/sys/unix/rand.rs
浏览文件 @
43cff131
...
@@ -344,15 +344,15 @@ mod imp {
...
@@ -344,15 +344,15 @@ mod imp {
use
io
;
use
io
;
use
rand
::
Rng
;
use
rand
::
Rng
;
#[link(name
=
"
magenta
"
)]
#[link(name
=
"
zircon
"
)]
extern
{
extern
{
fn
m
x_cprng_draw
(
buffer
:
*
mut
u8
,
len
:
usize
,
actual
:
*
mut
usize
)
->
i32
;
fn
z
x_cprng_draw
(
buffer
:
*
mut
u8
,
len
:
usize
,
actual
:
*
mut
usize
)
->
i32
;
}
}
fn
getrandom
(
buf
:
&
mut
[
u8
])
->
Result
<
usize
,
i32
>
{
fn
getrandom
(
buf
:
&
mut
[
u8
])
->
Result
<
usize
,
i32
>
{
unsafe
{
unsafe
{
let
mut
actual
=
0
;
let
mut
actual
=
0
;
let
status
=
m
x_cprng_draw
(
buf
.as_mut_ptr
(),
buf
.len
(),
&
mut
actual
);
let
status
=
z
x_cprng_draw
(
buf
.as_mut_ptr
(),
buf
.len
(),
&
mut
actual
);
if
status
==
0
{
if
status
==
0
{
Ok
(
actual
)
Ok
(
actual
)
}
else
{
}
else
{
...
@@ -387,7 +387,7 @@ fn fill_bytes(&mut self, v: &mut [u8]) {
...
@@ -387,7 +387,7 @@ fn fill_bytes(&mut self, v: &mut [u8]) {
let
ret
=
getrandom
(
buf
);
let
ret
=
getrandom
(
buf
);
match
ret
{
match
ret
{
Err
(
err
)
=>
{
Err
(
err
)
=>
{
panic!
(
"kernel
m
x_cprng_draw call failed! (returned {}, buf.len() {})"
,
panic!
(
"kernel
z
x_cprng_draw call failed! (returned {}, buf.len() {})"
,
err
,
buf
.len
())
err
,
buf
.len
())
}
}
Ok
(
actual
)
=>
{
Ok
(
actual
)
=>
{
...
...
src/tools/tidy/src/deps.rs
浏览文件 @
43cff131
...
@@ -35,8 +35,11 @@
...
@@ -35,8 +35,11 @@
"thread-id"
,
// Apache-2.0, mdbook
"thread-id"
,
// Apache-2.0, mdbook
"cssparser"
,
// MPL-2.0, rustdoc
"cssparser"
,
// MPL-2.0, rustdoc
"smallvec"
,
// MPL-2.0, rustdoc
"smallvec"
,
// MPL-2.0, rustdoc
// TODO: remove magenta references when "everything" has moved over to using the zircon name.
"magenta-sys"
,
// BSD-3-Clause, rustdoc
"magenta-sys"
,
// BSD-3-Clause, rustdoc
"magenta"
,
// BSD-3-Clause, rustdoc
"magenta"
,
// BSD-3-Clause, rustdoc
"zircon-sys"
,
// BSD-3-Clause, rustdoc
"zircon"
,
// BSD-3-Clause, rustdoc
"cssparser-macros"
,
// MPL-2.0, rustdoc
"cssparser-macros"
,
// MPL-2.0, rustdoc
"selectors"
,
// MPL-2.0, rustdoc
"selectors"
,
// MPL-2.0, rustdoc
];
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录