Skip to content

Commit

Permalink
Fix macOS compilation due to wrong imports
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Hrica <[email protected]>
  • Loading branch information
mtjhrc authored and slp committed Feb 6, 2024
1 parent abb4f19 commit c16ffcf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/devices/src/virtio/console/console_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::collections::VecDeque;
use std::ops::Deref;
use std::sync::{Arc, Mutex};

use libc::EFD_NONBLOCK;
use utils::eventfd::EventFd;
use utils::eventfd::EFD_NONBLOCK;
use vm_memory::{ByteValued, GuestMemoryMmap};

use crate::virtio::console::defs::control_event::{
Expand Down
5 changes: 2 additions & 3 deletions src/devices/src/virtio/console/port_io.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use std::io::{self, ErrorKind};
use std::os::fd::{AsRawFd, FromRawFd, OwnedFd, RawFd};

use libc::{
fcntl, EFD_NONBLOCK, F_GETFL, F_SETFL, O_NONBLOCK, STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO,
};
use libc::{fcntl, F_GETFL, F_SETFL, O_NONBLOCK, STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO};
use log::Level;
use nix::errno::Errno;
use nix::poll::{poll, PollFd, PollFlags};
use nix::unistd::dup;
use utils::eventfd::EventFd;
use utils::eventfd::EFD_NONBLOCK;
use vm_memory::bitmap::Bitmap;
use vm_memory::{VolatileMemoryError, VolatileSlice, WriteVolatile};

Expand Down
16 changes: 10 additions & 6 deletions src/vmm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use kbs_types::Tee;
use crate::device_manager;
#[cfg(feature = "tee")]
use crate::resources::TeeConfig;
#[cfg(target_os = "linux")]
use crate::signal_handler::register_sigint_handler;
#[cfg(target_os = "linux")]
use crate::signal_handler::register_sigwinch_handler;
Expand Down Expand Up @@ -1057,12 +1058,15 @@ fn attach_console_devices(
let console_input = if stdin_is_terminal {
Some(port_io::stdin().unwrap())
} else {
let sigint_input = port_io::PortInputSigInt::new();
let sigint_input_fd = sigint_input.sigint_evt().as_raw_fd();

register_sigint_handler(sigint_input_fd).map_err(RegisterFsSigwinch)?;

Some(Box::new(sigint_input) as _)
#[cfg(target_os = "linux")]
{
let sigint_input = port_io::PortInputSigInt::new();
let sigint_input_fd = sigint_input.sigint_evt().as_raw_fd();
register_sigint_handler(sigint_input_fd).map_err(RegisterFsSigwinch)?;
Some(Box::new(sigint_input) as _)
}
#[cfg(not(target_os = "linux"))]
None
};

let console_output = if stdout_is_terminal {
Expand Down

0 comments on commit c16ffcf

Please sign in to comment.