Skip to content

Commit 795e173

Browse files
committed
Import the CloudABI system call bindings into the libstd tree.
These automatically generated Rust source files allow us to invoke system calls within CloudABI processes. These will be used by libstd to implement primitives for I/O, threading, etc. These source files are normally part of the 'cloudabi' crate. In the case of libstd, we'd better copy them into the source tree, as having external dependencies in libstd is a bit messy. Original source files can be found here: https://github.com/NuxiNL/cloudabi/tree/master/rust
1 parent 619ced0 commit 795e173

File tree

2 files changed

+2898
-0
lines changed

2 files changed

+2898
-0
lines changed
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright (c) 2018 Nuxi (https://nuxi.nl/) and contributors.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions
5+
// are met:
6+
// 1. Redistributions of source code must retain the above copyright
7+
// notice, this list of conditions and the following disclaimer.
8+
// 2. Redistributions in binary form must reproduce the above copyright
9+
// notice, this list of conditions and the following disclaimer in the
10+
// documentation and/or other materials provided with the distribution.
11+
//
12+
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13+
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15+
// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16+
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17+
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18+
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19+
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20+
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21+
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22+
// SUCH DAMAGE.
23+
24+
// Appease Rust's tidy.
25+
// ignore-license
26+
27+
#[cfg(feature = "bitflags")]
28+
#[macro_use]
29+
extern crate bitflags;
30+
31+
// Minimal implementation of bitflags! in case we can't depend on the bitflags
32+
// crate. Only implements `bits()` and a `from_bits_truncate()` that doesn't
33+
// actually truncate.
34+
#[cfg(not(feature = "bitflags"))]
35+
macro_rules! bitflags {
36+
(
37+
$(#[$attr:meta])*
38+
pub struct $name:ident: $type:ty {
39+
$($(#[$const_attr:meta])* const $const:ident = $val:expr;)*
40+
}
41+
) => {
42+
$(#[$attr])*
43+
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
44+
pub struct $name { bits: $type }
45+
impl $name {
46+
$($(#[$const_attr])* pub const $const: $name = $name{ bits: $val };)*
47+
pub fn bits(&self) -> $type { self.bits }
48+
pub fn from_bits_truncate(bits: $type) -> Self { $name{ bits } }
49+
}
50+
}
51+
}

0 commit comments

Comments
 (0)