Skip to content

Commit cd93969

Browse files
committedSep 25, 2017
Auto merge of #44612 - pylaligand:magenta-to-zircon, r=alexcrichton
The Magenta kernel is now called Zircon.
·
1.88.01.22.0
2 parents 7a9cdc4 + a3aef1a commit cd93969

File tree

11 files changed

+181
-280
lines changed

11 files changed

+181
-280
lines changed
 

‎src/bootstrap/sanity.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,9 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
221221
let run = |cmd: &mut Command| {
222222
cmd.output().map(|output| {
223223
String::from_utf8_lossy(&output.stdout)
224-
.lines().next().unwrap()
225-
.to_string()
224+
.lines().next().unwrap_or_else(|| {
225+
panic!("{:?} failed {:?}", cmd, output)
226+
}).to_string()
226227
})
227228
};
228229
build.lldb_version = run(Command::new("lldb").arg("--version")).ok();

‎src/ci/docker/dist-fuchsia/Dockerfile

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
FROM ubuntu:16.04
22

3-
RUN apt-get update && apt-get install -y --no-install-recommends \
3+
RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y \
4+
build-essential \
5+
bzip2 \
6+
ca-certificates \
7+
cmake \
8+
curl \
9+
file \
410
g++ \
11+
gdb \
12+
git \
13+
libedit-dev \
514
make \
615
ninja-build \
7-
file \
8-
curl \
9-
ca-certificates \
16+
nodejs \
1017
python2.7-dev \
11-
git \
1218
sudo \
13-
bzip2 \
1419
xz-utils \
15-
swig \
16-
libedit-dev \
17-
libncurses5-dev \
18-
patch
19-
20-
RUN curl -L https://cmake.org/files/v3.8/cmake-3.8.0-rc1-Linux-x86_64.tar.gz | \
21-
tar xzf - -C /usr/local --strip-components=1
20+
unzip
2221

2322
WORKDIR /tmp
24-
COPY dist-fuchsia/shared.sh dist-fuchsia/build-toolchain.sh dist-fuchsia/compiler-rt-dso-handle.patch /tmp/
23+
COPY dist-fuchsia/shared.sh dist-fuchsia/build-toolchain.sh /tmp/
2524
RUN /tmp/build-toolchain.sh
2625

2726
COPY scripts/sccache.sh /scripts/
@@ -39,4 +38,4 @@ ENV TARGETS=x86_64-unknown-fuchsia
3938
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
4039

4140
ENV RUST_CONFIGURE_ARGS --target=$TARGETS --enable-extended
42-
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
41+
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS

‎src/ci/docker/dist-fuchsia/build-toolchain.sh

Lines changed: 24 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -14,105 +14,44 @@
1414
set -ex
1515
source shared.sh
1616

17-
# Download sources
18-
SRCS=(
19-
"https://fuchsia.googlesource.com/magenta magenta d17073dc8de344ead3b65e8cc6a12280dec38c84"
20-
"https://llvm.googlesource.com/llvm llvm 3f58a16d8eec385e2b3ebdfbb84ff9d3bf27e025"
21-
"https://llvm.googlesource.com/clang llvm/tools/clang 727ea63e6e82677f6e10e05e08bc7d6bdbae3111"
22-
"https://llvm.googlesource.com/lld llvm/tools/lld a31286c1366e5e89b8872803fded13805a1a084b"
23-
"https://llvm.googlesource.com/lldb llvm/tools/lldb 0b2384abec4cb99ad66687712e07dee4dd9d187e"
24-
"https://llvm.googlesource.com/compiler-rt llvm/runtimes/compiler-rt 9093a35c599fe41278606a20b51095ea8bd5a081"
25-
"https://llvm.googlesource.com/libcxx llvm/runtimes/libcxx 607e0c71ec4f7fd377ad3f6c47b08dbe89f66eaa"
26-
"https://llvm.googlesource.com/libcxxabi llvm/runtimes/libcxxabi 0a3a1a8a5ca5ef69e0f6b7d5b9d13e63e6fd2c19"
27-
"https://llvm.googlesource.com/libunwind llvm/runtimes/libunwind e128003563d99d9ee62247c4cee40f07d21c03e3"
28-
)
29-
30-
fetch() {
31-
mkdir -p $2
32-
pushd $2 > /dev/null
33-
git init
34-
git remote add origin $1
35-
git fetch --depth=1 origin $3
36-
git reset --hard FETCH_HEAD
37-
popd > /dev/null
38-
}
17+
ZIRCON=e9a26dbc70d631029f8ee9763103910b7e3a2fe1
3918

40-
for i in "${SRCS[@]}"; do
41-
fetch $i
42-
done
19+
mkdir -p zircon
20+
pushd zircon > /dev/null
4321

44-
# Remove this once https://reviews.llvm.org/D28791 is resolved
45-
cd llvm/runtimes/compiler-rt
46-
patch -Np1 < /tmp/compiler-rt-dso-handle.patch
47-
cd ../../..
22+
# Download sources
23+
git init
24+
git remote add origin https://fuchsia.googlesource.com/zircon
25+
git fetch --depth=1 origin $ZIRCON
26+
git reset --hard FETCH_HEAD
4827

49-
# Build toolchain
50-
cd llvm
51-
mkdir build
52-
cd build
53-
hide_output cmake -GNinja \
54-
-DFUCHSIA_SYSROOT=${PWD}/../../magenta/third_party/ulib/musl \
55-
-DLLVM_ENABLE_LTO=OFF \
56-
-DCLANG_BOOTSTRAP_PASSTHROUGH=LLVM_ENABLE_LTO \
57-
-C ../tools/clang/cmake/caches/Fuchsia.cmake \
58-
..
59-
hide_output ninja stage2-distribution
60-
hide_output ninja stage2-install-distribution
61-
cd ../..
28+
# Download toolchain
29+
./scripts/download-toolchain
30+
chmod -R a+rx prebuilt/downloads/clang+llvm-x86_64-linux
31+
cp -a prebuilt/downloads/clang+llvm-x86_64-linux/. /usr/local
6232

63-
# Build sysroot
64-
rm -rf llvm/runtimes/compiler-rt
65-
./magenta/scripts/download-toolchain
66-
67-
build_sysroot() {
33+
build() {
6834
local arch="$1"
6935

7036
case "${arch}" in
71-
x86_64) tgt="magenta-pc-x86-64" ;;
72-
aarch64) tgt="magenta-qemu-arm64" ;;
37+
x86_64) tgt="zircon-pc-x86-64" ;;
38+
aarch64) tgt="zircon-qemu-arm64" ;;
7339
esac
7440

75-
hide_output make -C magenta -j$(getconf _NPROCESSORS_ONLN) $tgt
41+
hide_output make -j$(getconf _NPROCESSORS_ONLN) $tgt
7642
dst=/usr/local/${arch}-unknown-fuchsia
7743
mkdir -p $dst
78-
cp -r magenta/build-${tgt}/sysroot/include $dst/
79-
cp -r magenta/build-${tgt}/sysroot/lib $dst/
80-
81-
cd llvm
82-
mkdir build-runtimes-${arch}
83-
cd build-runtimes-${arch}
84-
hide_output cmake -GNinja \
85-
-DCMAKE_C_COMPILER=clang \
86-
-DCMAKE_CXX_COMPILER=clang++ \
87-
-DCMAKE_AR=/usr/local/bin/llvm-ar \
88-
-DCMAKE_RANLIB=/usr/local/bin/llvm-ranlib \
89-
-DCMAKE_INSTALL_PREFIX= \
90-
-DLLVM_MAIN_SRC_DIR=${PWD}/.. \
91-
-DLLVM_BINARY_DIR=${PWD}/../build \
92-
-DLLVM_ENABLE_WERROR=OFF \
93-
-DCMAKE_BUILD_TYPE=Release \
94-
-DLLVM_INCLUDE_TESTS=ON \
95-
-DCMAKE_SYSTEM_NAME=Fuchsia \
96-
-DCMAKE_C_COMPILER_TARGET=${arch}-fuchsia \
97-
-DCMAKE_CXX_COMPILER_TARGET=${arch}-fuchsia \
98-
-DUNIX=1 \
99-
-DLIBCXX_HAS_MUSL_LIBC=ON \
100-
-DLIBCXXABI_USE_LLVM_UNWINDER=ON \
101-
-DCMAKE_SYSROOT=${dst} \
102-
-DCMAKE_C_COMPILER_FORCED=TRUE \
103-
-DCMAKE_CXX_COMPILER_FORCED=TRUE \
104-
-DLLVM_ENABLE_LIBCXX=ON \
105-
-DCMAKE_EXE_LINKER_FLAGS="-nodefaultlibs -lc" \
106-
-DCMAKE_SHARED_LINKER_FLAGS="$(clang --target=${arch}-fuchsia -print-libgcc-file-name)" \
107-
../runtimes
108-
hide_output env DESTDIR="${dst}" ninja install
109-
cd ../..
44+
cp -a build-${tgt}/sysroot/include $dst/
45+
cp -a build-${tgt}/sysroot/lib $dst/
11046
}
11147

112-
build_sysroot "x86_64"
113-
build_sysroot "aarch64"
48+
# Build sysroot
49+
for arch in x86_64 aarch64; do
50+
build ${arch}
51+
done
11452

115-
rm -rf magenta llvm
53+
popd > /dev/null
54+
rm -rf zircon
11655

11756
for arch in x86_64 aarch64; do
11857
for tool in clang clang++; do

‎src/ci/docker/dist-fuchsia/compiler-rt-dso-handle.patch

Lines changed: 0 additions & 41 deletions
This file was deleted.

‎src/libstd/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ fn main() {
6868
if cfg!(feature = "backtrace") {
6969
println!("cargo:rustc-link-lib=backtrace");
7070
}
71-
println!("cargo:rustc-link-lib=magenta");
72-
println!("cargo:rustc-link-lib=mxio");
71+
println!("cargo:rustc-link-lib=zircon");
72+
println!("cargo:rustc-link-lib=fdio");
7373
println!("cargo:rustc-link-lib=launchpad"); // for std::process
7474
}
7575
}

‎src/libstd/sys/unix/process/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ mod process_inner;
1919
#[path = "process_fuchsia.rs"]
2020
mod process_inner;
2121
#[cfg(target_os = "fuchsia")]
22-
mod magenta;
22+
mod zircon;

‎src/libstd/sys/unix/process/process_fuchsia.rs

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use libc;
1313
use mem;
1414
use ptr;
1515

16-
use sys::process::magenta::{Handle, mx_handle_t};
16+
use sys::process::zircon::{Handle, zx_handle_t};
1717
use sys::process::process_common::*;
1818

1919
////////////////////////////////////////////////////////////////////////////////
@@ -51,10 +51,10 @@ impl Command {
5151
}
5252

5353
unsafe fn do_exec(&mut self, stdio: ChildPipes)
54-
-> io::Result<mx_handle_t> {
55-
use sys::process::magenta::*;
54+
-> io::Result<zx_handle_t> {
55+
use sys::process::zircon::*;
5656

57-
let job_handle = mx_job_default();
57+
let job_handle = zx_job_default();
5858
let envp = match *self.get_envp() {
5959
Some(ref envp) => envp.as_ptr(),
6060
None => ptr::null(),
@@ -67,39 +67,39 @@ impl Command {
6767
}
6868

6969
// Duplicate the job handle
70-
let mut job_copy: mx_handle_t = MX_HANDLE_INVALID;
71-
mx_cvt(mx_handle_duplicate(job_handle, MX_RIGHT_SAME_RIGHTS, &mut job_copy))?;
70+
let mut job_copy: zx_handle_t = ZX_HANDLE_INVALID;
71+
zx_cvt(zx_handle_duplicate(job_handle, ZX_RIGHT_SAME_RIGHTS, &mut job_copy))?;
7272
// Create a launchpad
7373
let mut launchpad: *mut launchpad_t = ptr::null_mut();
74-
mx_cvt(launchpad_create(job_copy, self.get_argv()[0], &mut launchpad))?;
74+
zx_cvt(launchpad_create(job_copy, self.get_argv()[0], &mut launchpad))?;
7575
let launchpad_destructor = LaunchpadDestructor(launchpad);
7676

7777
// Set the process argv
78-
mx_cvt(launchpad_set_args(launchpad, self.get_argv().len() as i32 - 1,
78+
zx_cvt(launchpad_set_args(launchpad, self.get_argv().len() as i32 - 1,
7979
self.get_argv().as_ptr()))?;
8080
// Setup the environment vars
81-
mx_cvt(launchpad_set_environ(launchpad, envp))?;
82-
mx_cvt(launchpad_add_vdso_vmo(launchpad))?;
81+
zx_cvt(launchpad_set_environ(launchpad, envp))?;
82+
zx_cvt(launchpad_add_vdso_vmo(launchpad))?;
8383
// Load the executable
84-
mx_cvt(launchpad_elf_load(launchpad, launchpad_vmo_from_file(self.get_argv()[0])))?;
85-
mx_cvt(launchpad_load_vdso(launchpad, MX_HANDLE_INVALID))?;
86-
mx_cvt(launchpad_clone(launchpad, LP_CLONE_MXIO_ROOT | LP_CLONE_MXIO_CWD))?;
84+
zx_cvt(launchpad_elf_load(launchpad, launchpad_vmo_from_file(self.get_argv()[0])))?;
85+
zx_cvt(launchpad_load_vdso(launchpad, ZX_HANDLE_INVALID))?;
86+
zx_cvt(launchpad_clone(launchpad, LP_CLONE_FDIO_NAMESPACE | LP_CLONE_FDIO_CWD))?;
8787

8888
// Clone stdin, stdout, and stderr
8989
if let Some(fd) = stdio.stdin.fd() {
90-
mx_cvt(launchpad_transfer_fd(launchpad, fd, 0))?;
90+
zx_cvt(launchpad_transfer_fd(launchpad, fd, 0))?;
9191
} else {
92-
mx_cvt(launchpad_clone_fd(launchpad, 0, 0))?;
92+
zx_cvt(launchpad_clone_fd(launchpad, 0, 0))?;
9393
}
9494
if let Some(fd) = stdio.stdout.fd() {
95-
mx_cvt(launchpad_transfer_fd(launchpad, fd, 1))?;
95+
zx_cvt(launchpad_transfer_fd(launchpad, fd, 1))?;
9696
} else {
97-
mx_cvt(launchpad_clone_fd(launchpad, 1, 1))?;
97+
zx_cvt(launchpad_clone_fd(launchpad, 1, 1))?;
9898
}
9999
if let Some(fd) = stdio.stderr.fd() {
100-
mx_cvt(launchpad_transfer_fd(launchpad, fd, 2))?;
100+
zx_cvt(launchpad_transfer_fd(launchpad, fd, 2))?;
101101
} else {
102-
mx_cvt(launchpad_clone_fd(launchpad, 2, 2))?;
102+
zx_cvt(launchpad_clone_fd(launchpad, 2, 2))?;
103103
}
104104

105105
// We don't want FileDesc::drop to be called on any stdio. It would close their fds. The
@@ -113,9 +113,9 @@ impl Command {
113113
// `launchpad_go` destroys the launchpad, so we must not
114114
mem::forget(launchpad_destructor);
115115

116-
let mut process_handle: mx_handle_t = 0;
116+
let mut process_handle: zx_handle_t = 0;
117117
let mut err_msg: *const libc::c_char = ptr::null();
118-
mx_cvt(launchpad_go(launchpad, &mut process_handle, &mut err_msg))?;
118+
zx_cvt(launchpad_go(launchpad, &mut process_handle, &mut err_msg))?;
119119
// FIXME: See if we want to do something with that err_msg
120120

121121
Ok(process_handle)
@@ -136,27 +136,27 @@ impl Process {
136136
}
137137

138138
pub fn kill(&mut self) -> io::Result<()> {
139-
use sys::process::magenta::*;
139+
use sys::process::zircon::*;
140140

141-
unsafe { mx_cvt(mx_task_kill(self.handle.raw()))?; }
141+
unsafe { zx_cvt(zx_task_kill(self.handle.raw()))?; }
142142

143143
Ok(())
144144
}
145145

146146
pub fn wait(&mut self) -> io::Result<ExitStatus> {
147147
use default::Default;
148-
use sys::process::magenta::*;
148+
use sys::process::zircon::*;
149149

150-
let mut proc_info: mx_info_process_t = Default::default();
151-
let mut actual: mx_size_t = 0;
152-
let mut avail: mx_size_t = 0;
150+
let mut proc_info: zx_info_process_t = Default::default();
151+
let mut actual: zx_size_t = 0;
152+
let mut avail: zx_size_t = 0;
153153

154154
unsafe {
155-
mx_cvt(mx_object_wait_one(self.handle.raw(), MX_TASK_TERMINATED,
156-
MX_TIME_INFINITE, ptr::null_mut()))?;
157-
mx_cvt(mx_object_get_info(self.handle.raw(), MX_INFO_PROCESS,
155+
zx_cvt(zx_object_wait_one(self.handle.raw(), ZX_TASK_TERMINATED,
156+
ZX_TIME_INFINITE, ptr::null_mut()))?;
157+
zx_cvt(zx_object_get_info(self.handle.raw(), ZX_INFO_PROCESS,
158158
&mut proc_info as *mut _ as *mut libc::c_void,
159-
mem::size_of::<mx_info_process_t>(), &mut actual,
159+
mem::size_of::<zx_info_process_t>(), &mut actual,
160160
&mut avail))?;
161161
}
162162
if actual != 1 {
@@ -168,14 +168,14 @@ impl Process {
168168

169169
pub fn try_wait(&mut self) -> io::Result<Option<ExitStatus>> {
170170
use default::Default;
171-
use sys::process::magenta::*;
171+
use sys::process::zircon::*;
172172

173-
let mut proc_info: mx_info_process_t = Default::default();
174-
let mut actual: mx_size_t = 0;
175-
let mut avail: mx_size_t = 0;
173+
let mut proc_info: zx_info_process_t = Default::default();
174+
let mut actual: zx_size_t = 0;
175+
let mut avail: zx_size_t = 0;
176176

177177
unsafe {
178-
let status = mx_object_wait_one(self.handle.raw(), MX_TASK_TERMINATED,
178+
let status = zx_object_wait_one(self.handle.raw(), ZX_TASK_TERMINATED,
179179
0, ptr::null_mut());
180180
match status {
181181
0 => { }, // Success
@@ -184,9 +184,9 @@ impl Process {
184184
},
185185
_ => { panic!("Failed to wait on process handle: {}", status); },
186186
}
187-
mx_cvt(mx_object_get_info(self.handle.raw(), MX_INFO_PROCESS,
187+
zx_cvt(zx_object_get_info(self.handle.raw(), ZX_INFO_PROCESS,
188188
&mut proc_info as *mut _ as *mut libc::c_void,
189-
mem::size_of::<mx_info_process_t>(), &mut actual,
189+
mem::size_of::<zx_info_process_t>(), &mut actual,
190190
&mut avail))?;
191191
}
192192
if actual != 1 {

‎src/libstd/sys/unix/process/magenta.rs renamed to ‎src/libstd/sys/unix/process/zircon.rs

Lines changed: 91 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,31 @@ use u64;
1717

1818
use libc::{c_int, c_void};
1919

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;
2424

25-
pub type mx_size_t = usize;
25+
pub type zx_size_t = usize;
2626

27-
pub const MX_HANDLE_INVALID: mx_handle_t = 0;
27+
pub const ZX_HANDLE_INVALID: zx_handle_t = 0;
2828

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;
3131

32-
pub type mx_signals_t = u32;
32+
pub type zx_signals_t = u32;
3333

34-
pub const MX_OBJECT_SIGNAL_3 : mx_signals_t = 1 << 3;
34+
pub const ZX_OBJECT_SIGNAL_3 : zx_signals_t = 1 << 3;
3535

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;
3737

38-
pub const MX_RIGHT_SAME_RIGHTS : mx_rights_t = 1 << 31;
38+
pub const ZX_RIGHT_SAME_RIGHTS : zx_rights_t = 1 << 31;
3939

40-
pub type mx_object_info_topic_t = u32;
40+
pub type zx_object_info_topic_t = u32;
4141

42-
pub const MX_INFO_PROCESS : mx_object_info_topic_t = 3;
42+
pub const ZX_INFO_PROCESS : zx_object_info_topic_t = 3;
4343

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 {
4545
if let Ok(status) = TryInto::try_into(t) {
4646
if status < 0 {
4747
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 {
5353
}
5454
}
5555

56-
// Safe wrapper around mx_handle_t
56+
// Safe wrapper around zx_handle_t
5757
pub struct Handle {
58-
raw: mx_handle_t,
58+
raw: zx_handle_t,
5959
}
6060

6161
impl Handle {
62-
pub fn new(raw: mx_handle_t) -> Handle {
62+
pub fn new(raw: zx_handle_t) -> Handle {
6363
Handle {
6464
raw,
6565
}
6666
}
6767

68-
pub fn raw(&self) -> mx_handle_t {
68+
pub fn raw(&self) -> zx_handle_t {
6969
self.raw
7070
}
7171
}
7272

7373
impl Drop for Handle {
7474
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"); }
7676
}
7777
}
7878

79-
// Common MX_INFO header
79+
// Common ZX_INFO header
8080
#[derive(Default)]
8181
#[repr(C)]
82-
pub struct mx_info_header_t {
82+
pub struct zx_info_header_t {
8383
pub topic: u32, // identifies the info struct
8484
pub avail_topic_size: u16, // “native” size of the struct
8585
pub topic_size: u16, // size of the returned struct (<=topic_size)
@@ -89,34 +89,34 @@ pub struct mx_info_header_t {
8989

9090
#[derive(Default)]
9191
#[repr(C)]
92-
pub struct mx_record_process_t {
92+
pub struct zx_record_process_t {
9393
pub return_code: c_int,
9494
}
9595

96-
// Returned for topic MX_INFO_PROCESS
96+
// Returned for topic ZX_INFO_PROCESS
9797
#[derive(Default)]
9898
#[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,
102102
}
103103

104104
extern {
105-
pub fn mx_job_default() -> mx_handle_t;
105+
pub fn zx_job_default() -> zx_handle_t;
106106

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;
108108

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;
110110

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;
113113

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;
116116

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;
120120
}
121121

122122
// From `enum special_handles` in system/ulib/launchpad/launchpad.c
@@ -133,117 +133,117 @@ pub struct launchpad_t {
133133
env: *const c_char,
134134
env_len: usize,
135135

136-
handles: *mut mx_handle_t,
136+
handles: *mut zx_handle_t,
137137
handles_info: *mut u32,
138138
handle_count: usize,
139139
handle_alloc: usize,
140140

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,
144144

145145
stack_size: usize,
146146

147-
special_handles: [mx_handle_t; HND_SPECIAL_COUNT],
147+
special_handles: [zx_handle_t; HND_SPECIAL_COUNT],
148148
loader_message: bool,
149149
}
150150

151151
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;
154154

155155
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;
158158

159159
pub fn launchpad_destroy(lp: *mut launchpad_t);
160160

161161
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;
163163

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;
165165

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;
167167

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;
169169

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;
171171

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;
173173

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;
175175

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;
177177

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;
179179
}
180180

181181
// Launchpad clone constants
182182

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
187187
// LP_CLONE_ENVIRON = 0x0100
188188
// LP_CLONE_DEFAULT_JOB = 0x0200
189189
// LP_CLONE_ALL = 0xFFFF
190190

191191
// Errors
192192

193-
#[allow(unused)] pub const ERR_INTERNAL: mx_status_t = -1;
193+
#[allow(unused)] pub const ERR_INTERNAL: zx_status_t = -1;
194194

195195
// ERR_NOT_SUPPORTED: The operation is not implemented, supported,
196196
// 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;
198198

199199
// ERR_NO_RESOURCES: The system was not able to allocate some resource
200200
// 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;
202202

203203
// ERR_NO_MEMORY: The system was not able to allocate memory needed
204204
// 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;
206206

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
208208
// 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;
210210

211211
// ERR_INTERRUPTED_RETRY: The system call was interrupted, but should be
212212
// 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;
214214

215215
// ======= Parameter errors =======
216216
// 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;
218218

219219
// 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;
221221

222222
// ERR_WRONG_TYPE: The subject of the operation is the wrong type to
223223
// perform the operation.
224224
// 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;
226226

227227
// 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;
229229

230230
// ERR_OUT_OF_RANGE: An argument is outside the valid range for this
231231
// 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;
233233

234234
// ERR_BUFFER_TOO_SMALL: A caller provided buffer is too small for
235235
// 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;
237237

238238
// ======= Precondition or state errors =======
239239
// ERR_BAD_STATE: operation failed because the current state of the
240240
// object does not allow it, or a precondition of the operation is
241241
// 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;
243243

244244
// ERR_TIMED_OUT: The time limit for the operation elapsed before
245245
// 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;
247247

248248
// ERR_SHOULD_WAIT: The operation cannot be performed currently but
249249
// potentially could succeed if the caller waits for a prerequisite
@@ -253,67 +253,67 @@ pub const LP_CLONE_MXIO_CWD: u32 = 0x0002;
253253
// messages waiting but has an open remote will return ERR_SHOULD_WAIT.
254254
// Attempting to read from a message pipe that has no messages waiting
255255
// 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;
257257

258258
// ERR_CANCELED: The in-progress operation (e.g. a wait) has been
259259
// // canceled.
260-
#[allow(unused)] pub const ERR_CANCELED: mx_status_t = -23;
260+
#[allow(unused)] pub const ERR_CANCELED: zx_status_t = -23;
261261

262262
// ERR_PEER_CLOSED: The operation failed because the remote end
263263
// 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;
265265

266266
// 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;
268268

269269
// ERR_ALREADY_EXISTS: An object with the specified identifier
270270
// already exists.
271271
// Example: Attempting to create a file when a file already exists
272272
// 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;
274274

275275
// ERR_ALREADY_BOUND: The operation failed because the named entity
276276
// is already owned or controlled by another entity. The operation
277277
// 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;
279279

280280
// ERR_UNAVAILABLE: The subject of the operation is currently unable
281281
// to perform the operation.
282282
// Note: This is used when there's no direct way for the caller to
283283
// observe when the subject will be able to perform the operation
284284
// 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;
286286

287287
// ======= Permission check errors =======
288288
// ERR_ACCESS_DENIED: The caller did not have permission to perform
289289
// 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;
291291

292292
// ======= Input-output errors =======
293293
// 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;
295295

296296
// ERR_REFUSED: The entity the I/O operation is being performed on
297297
// rejected the operation.
298298
// Example: an I2C device NAK'ing a transaction or a disk controller
299299
// 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;
301301

302302
// ERR_IO_DATA_INTEGRITY: The data in the operation failed an integrity
303303
// check and is possibly corrupted.
304304
// 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;
306306

307307
// ERR_IO_DATA_LOSS: The data in the operation is currently unavailable
308308
// and may be permanently lost.
309309
// 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;
311311

312312
// 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;
316316
// 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;
318318
// 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;

‎src/libstd/sys/unix/rand.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,15 @@ mod imp {
344344
use io;
345345
use rand::Rng;
346346

347-
#[link(name = "magenta")]
347+
#[link(name = "zircon")]
348348
extern {
349-
fn mx_cprng_draw(buffer: *mut u8, len: usize, actual: *mut usize) -> i32;
349+
fn zx_cprng_draw(buffer: *mut u8, len: usize, actual: *mut usize) -> i32;
350350
}
351351

352352
fn getrandom(buf: &mut [u8]) -> Result<usize, i32> {
353353
unsafe {
354354
let mut actual = 0;
355-
let status = mx_cprng_draw(buf.as_mut_ptr(), buf.len(), &mut actual);
355+
let status = zx_cprng_draw(buf.as_mut_ptr(), buf.len(), &mut actual);
356356
if status == 0 {
357357
Ok(actual)
358358
} else {
@@ -387,7 +387,7 @@ mod imp {
387387
let ret = getrandom(buf);
388388
match ret {
389389
Err(err) => {
390-
panic!("kernel mx_cprng_draw call failed! (returned {}, buf.len() {})",
390+
panic!("kernel zx_cprng_draw call failed! (returned {}, buf.len() {})",
391391
err, buf.len())
392392
}
393393
Ok(actual) => {

‎src/tools/tidy/src/deps.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ static EXCEPTIONS: &'static [&'static str] = &[
3535
"thread-id", // Apache-2.0, mdbook
3636
"cssparser", // MPL-2.0, rustdoc
3737
"smallvec", // MPL-2.0, rustdoc
38+
// FIXME: remove magenta references when "everything" has moved over to using the zircon name.
3839
"magenta-sys", // BSD-3-Clause, rustdoc
3940
"magenta", // BSD-3-Clause, rustdoc
41+
"zircon-sys", // BSD-3-Clause, rustdoc
42+
"zircon", // BSD-3-Clause, rustdoc
4043
"cssparser-macros", // MPL-2.0, rustdoc
4144
"selectors", // MPL-2.0, rustdoc
4245
];

0 commit comments

Comments
 (0)
Please sign in to comment.