Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement libstd for CloudABI. #47268

Merged
merged 6 commits into from
Jan 14, 2018
Merged

Commits on Jan 11, 2018

  1. 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
    EdSchouten committed Jan 11, 2018
    Configuration menu
    Copy the full SHA
    795e173 View commit details
    Browse the repository at this point in the history
  2. Implement libstd for CloudABI.

    Though CloudABI is strongly inspired by POSIX, its absence of features
    that don't work well with capability-based sandboxing makes it different
    enough that adding bits to sys/unix will make things a mess. This change
    therefore adds CloudABI specific platform code under sys/cloudabi and
    borrows parts from sys/unix that can be used without changes.
    
    One of the goals of this implementation is to build as much as possible
    directly on top of CloudABI's system call layer, as opposed to using the
    C library. This is preferred, as the system call layer is supposed to be
    stable, whereas the C library ABI technically is not. An advantage of
    this approach is that it allows us to implement certain interfaces, such
    as mutexes and condition variables more optimally. They can be lighter
    than the ones provided by pthreads.
    
    This change disables some modules that cannot realistically be
    implemented right now. For example, libstd's pathname abstraction is not
    designed with POSIX *at() (e.g., openat()) in mind. The *at() functions
    are the only set of file system APIs available on CloudABI. There is no
    global file system namespace, nor a process working directory.
    Discussions on how to port these modules over are outside the scope of
    this change.
    
    Apart from this change, there are still some other minor fixups that
    need to be made to platform independent code to make things build. These
    will be sent out separately, so they can be reviewed more thoroughly.
    EdSchouten committed Jan 11, 2018
    1 Configuration menu
    Copy the full SHA
    2074526 View commit details
    Browse the repository at this point in the history
  3. Add shims for modules that we can't implement on CloudABI.

    As discussed in rust-lang#47268, libstd isn't ready to have certain functionality
    disabled yet. Follow wasm's approach of adding no-op modules for all of
    the features that we can't implement.
    
    I've placed all of those shims in a shims/ subdirectory, so we (the
    CloudABI folks) can experiment with removing them more easily. It also
    ensures that the code that does work doesn't get polluted with lots of
    useless boilerplate code.
    EdSchouten committed Jan 11, 2018
    Configuration menu
    Copy the full SHA
    d882bb5 View commit details
    Browse the repository at this point in the history
  4. Make tests build on CloudABI.

    There are some tests that need to be disabled on CloudABI specifically,
    due to the fact that the shims cannot be built in combination with
    unix::ext or windows::ext. Also improve the scoping of some imports to
    suppress compiler warnings.
    EdSchouten committed Jan 11, 2018
    Configuration menu
    Copy the full SHA
    d9d97c9 View commit details
    Browse the repository at this point in the history
  5. Make the documentation build work on CloudABI.

    Just like with wasm, we can't just import unix::ext and windows::ext.
    Our shims are not complete enough for that.
    EdSchouten committed Jan 11, 2018
    Configuration menu
    Copy the full SHA
    cc8565b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    6a8d55a View commit details
    Browse the repository at this point in the history