Skip to content

Commit

Permalink
import uring-sys and iou
Browse files Browse the repository at this point in the history
Those crates are moving in a fairly slow pace, while uring moves fast.
As much as I fully understand that the maintainers have other
commitments, this is harming us a bit.

Importing this inside glommio is, actually a way to avoid a fork in my
view: I consider this temporary and would encourage anyone that is
sending code that touches iou and uring-sys to make a bona fide effort
to upstream them. But by having them as a buffer here, we can detach
our lifetimes.
  • Loading branch information
Glauber Costa committed Mar 2, 2021
1 parent 7a1607f commit c5dede7
Show file tree
Hide file tree
Showing 21 changed files with 3,426 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "glommio/liburing"]
path = glommio/liburing
url = git://git.kernel.dk/liburing
8 changes: 5 additions & 3 deletions glommio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ readme = "../README.md"
log = "0.4"
concurrent-queue = "1.1.2"
futures-lite = "1.11.1"
libc = "0.2.73"
libc = "0.2.77"
socket2 = { version = "0.3.18", features = ["unix", "reuseport"] }
iou = { path = "../../iou" }
uring-sys = { path = "../../uring-sys" }
nix = "0.19.0"
bitflags = "1.2.0"
bitmaps = "2.1.0"
typenum = "1.12"
scoped-tls = "1.0.0"
Expand All @@ -42,6 +41,9 @@ futures = "0.3.5"
fastrand = "1.4.0"
tokio = { version = "0.3.5", default-features = false, features = ["rt", "macros", "rt-multi-thread", "net", "io-util", "time"] }

[build-dependencies]
cc = "1.0.47"

[features]
bench = []

Expand Down
15 changes: 15 additions & 0 deletions glommio/README.uring_sys_iou.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This crate includes imported code for
[uring-sys](https://github.com/ringbahn/uring-sys) and
[iou](https://github.com/ringbahn/iou)
from the ringbahn project.

It is my intention that those imports are temporary and I don't
mean this as a hard fork. On the other hand those crates haven't been
as actively maintained as we would like. They are very central for
what we do, as uring evolves very rapidly, so I have decided to
soft fork them.

Every patch that touches code in those directories should make at
least a good faith effort to merge the code back into iou and uring-sys.
Hopefully with time they will, at their own pace, have all the code
that we need in which case we can revert back to using them externally.
49 changes: 49 additions & 0 deletions glommio/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
use std::env;
use std::fs;
use std::path::*;
use std::process::Command;

use cc::Build;

fn main() {
let project = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
.canonicalize()
.unwrap();
let liburing = project.join("liburing");

// Run the configure script in OUT_DIR to get `compat.h`
let configured_include = configure(&liburing);

let src = liburing.join("src");

// liburing
Build::new()
.file(src.join("setup.c"))
.file(src.join("queue.c"))
.file(src.join("syscall.c"))
.file(src.join("register.c"))
.include(src.join("include"))
.include(&configured_include)
.extra_warnings(false)
.compile("uring");

// (our additional, linkable C bindings)
Build::new()
.file(project.join("rusturing.c"))
.include(src.join("include"))
.include(&configured_include)
.compile("rusturing");
}

fn configure(liburing: &Path) -> PathBuf {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap())
.canonicalize()
.unwrap();
fs::copy(liburing.join("configure"), out_dir.join("configure")).unwrap();
fs::create_dir_all(out_dir.join("src/include/liburing")).unwrap();
Command::new("./configure")
.current_dir(&out_dir)
.output()
.expect("configure script failed");
out_dir.join("src/include")
}
1 change: 1 addition & 0 deletions glommio/liburing
Submodule liburing added at b013df
Loading

0 comments on commit c5dede7

Please sign in to comment.