Commit ada3d79a authored by Stefan Lankes's avatar Stefan Lankes
Browse files

add option to disable smoltcp

parent dad82540
[package]
name = "hermit"
name = "libhermit"
version = "0.3.9"
authors = [
"Stefan Lankes <slankes@eonerc.rwth-aachen.de>",
......@@ -8,22 +8,24 @@ authors = [
build = "build.rs"
license = "MIT/Apache-2.0"
readme = "README.md"
categories = ["no-std"]
keywords = ["unikernel", "libos"]
categories = ["os"]
description = """
A Rust-based, lightweight unikernel
"""
[lib]
crate-type = ["staticlib"]
#[lib]
#crate-type = ["staticlib"]
[features]
#default = ["vga"]
#default = ["network"]
vga = []
rustc-dep-of-std = [] #"core", "compiler_builtins/rustc-dep-of-std"]
network = ["smoltcp"]
rustc-dep-of-std = ["core", "compiler_builtins/rustc-dep-of-std"]
[dependencies]
#core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" }
#compiler_builtins = { version = "0.1.0", optional = true }
core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" }
compiler_builtins = { version = "0.1", optional = true }
bitflags = "1.0.*"
spin = "0.5"
#byteorder = { version = "1.0", default-features = false }
......@@ -35,6 +37,7 @@ default-features = false
[dependencies.smoltcp]
version = "0.5"
optional = true
#git = "https://github.com/hermitcore/smoltcp.git"
default-features = false
features = ["log", "verbose", "alloc", "socket-udp", "socket-tcp", "proto-ipv4"]
......
......@@ -5,4 +5,5 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.
#[cfg(feature = "network")]
pub mod net;
......@@ -52,6 +52,7 @@ extern crate spin;
extern crate x86;
#[macro_use]
extern crate log;
#[cfg(feature = "network")]
extern crate smoltcp;
#[macro_use]
......@@ -70,6 +71,7 @@ mod errno;
#[cfg(not(test))]
mod kernel_message_buffer;
mod mm;
#[cfg(not(feature = "rustc-dep-of-std"))]
mod runtime_glue;
mod scheduler;
mod synch;
......@@ -174,11 +176,13 @@ extern "C" fn initd(_arg: usize) {
if environment::is_uhyve() {
// Initialize the uhyve-net interface using the IP and gateway addresses specified in hcip, hcmask, hcgateway.
info!("HermitCore is running on uhyve!");
#[cfg(feature = "network")]
let _ = drivers::net::uhyve::init();
} else if !environment::is_single_kernel() {
// Initialize the mmnif interface using static IPs in the range 192.168.28.x.
info!("HermitCore is running side-by-side to Linux!");
} else {
#[cfg(feature = "network")]
let _ = drivers::net::rtl8139::init();
}
......
......@@ -17,6 +17,7 @@ use arch::percore::*;
use arch::switch;
use core::cell::RefCell;
use core::sync::atomic::{AtomicI32, AtomicU32, AtomicUsize, Ordering};
#[cfg(feature = "network")]
use drivers::net::get_network_task_id;
use scheduler::task::*;
use synch::spinlock::*;
......@@ -288,13 +289,17 @@ impl PerCoreScheduler {
};
// If this is the Boot Processor and only the network task is left, it's time to shut down the OS.
let network_id = get_network_task_id();
if network_id != TaskId::from(0)
&& new_id == network_id
&& NO_TASKS.load(Ordering::SeqCst) == 1
#[cfg(feature = "network")]
{
debug!("Only network task is left");
sys_shutdown();
let network_id = get_network_task_id();
if network_id != TaskId::from(0)
&& new_id == network_id
&& NO_TASKS.load(Ordering::SeqCst) == 1
{
debug!("Only network task is left");
sys_shutdown();
}
}
// Tell the scheduler about the new task.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment