Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
viperML committed Jul 9, 2023
1 parent 4ef67a1 commit 82881e2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 37 deletions.
21 changes: 5 additions & 16 deletions src/build_package.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
use std::convert::Infallible;
use std::ffi::{CString, OsString};
use std::fmt::Debug;
use std::fs::create_dir_all;
use std::io::Write;
use std::num::NonZeroUsize;
use std::ops::Deref;
use std::os::fd::{AsRawFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
use std::os::fd::AsRawFd;
use std::path::Path;
use std::process::{ExitStatus, Stdio};
use std::ptr::addr_of;
use std::process::Stdio;
use std::sync::Mutex;

use async_trait::async_trait;
Expand All @@ -17,18 +11,13 @@ use futures::StreamExt;
use nix::libc::uid_t;
use nix::mount::{mount, MsFlags};
use nix::sched::CloneFlags;
use nix::sys::memfd::MemFdCreateFlag;
use nix::sys::mman::{MapFlags, ProtFlags};
use nix::unistd::{ftruncate, Gid, Pid, Uid};
use once_cell::sync::Lazy;
use nix::unistd::{Gid, Pid, Uid};
use tokio_process_stream::ProcessLineStream;
use tracing::{debug, error, instrument, span, warn, Level};
use tracing::{debug, span, warn, Level};

use crate::build::check_path;
use crate::db::DbConnection;
use crate::mem_app::{MemApp, BUSYBOX};
use crate::mem_app::MemApp;
use crate::schema_eval::{Build, Package};
use crate::semaphore::SemaphoreHandle;
use crate::*;

const STACK_SIZE: usize = 1024 * 1024;
Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ mod semaphore;

use std::io;
use std::path::PathBuf;
use std::time::Duration;

use ambassador::{delegatable_trait, Delegate};
use clap::Parser;
Expand Down
16 changes: 1 addition & 15 deletions src/mem_app.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
use std::convert::Infallible;
use std::ffi::CString;
use std::fmt::Debug;
use std::io::Write;
use std::num::NonZeroUsize;
use std::os::fd::{AsRawFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
use std::path::Path;
use std::ptr::addr_of;
use std::sync::Mutex;

use async_trait::async_trait;
use color_eyre::eyre::{bail, Context};
use nix::libc::uid_t;
use nix::mount::{mount, MsFlags};
use nix::sched::CloneFlags;
use nix::sys::memfd::MemFdCreateFlag;
use nix::sys::mman::{MapFlags, ProtFlags};
use nix::unistd::{ftruncate, Gid, Pid, Uid};
use nix::unistd::ftruncate;
use once_cell::sync::Lazy;
use tracing::{error, warn, Level};

use crate::db::DbConnection;
use crate::schema_eval::{Build, Package};
use crate::semaphore::SemaphoreHandle;
use crate::*;

#[derive(Debug)]
Expand Down Expand Up @@ -63,7 +50,6 @@ pub static BASH: Lazy<nix::Result<MemApp>> = Lazy::new(|| {
Ok(result)
});


pub static BUSYBOX: Lazy<nix::Result<MemApp>> = Lazy::new(|| {
let bytes = include_bytes!("../vendor/busybox");
let result = MemApp::new("busybox", bytes)?;
Expand Down
7 changes: 2 additions & 5 deletions src/semaphore.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
use core::mem::MaybeUninit;
use std::ffi::{CStr, CString, OsStr};
use std::ffi::OsStr;
use std::mem::size_of;
use std::num::NonZeroUsize;
use std::os::fd::{AsRawFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
use std::os::unix::prelude::OsStrExt;
use std::ptr::addr_of;
use std::os::fd::{AsRawFd, FromRawFd, IntoRawFd, OwnedFd};

use nix::errno::Errno;
use nix::fcntl::OFlag;
use nix::libc::{self};
use nix::sys::memfd::MemFdCreateFlag;
use nix::sys::mman::{shm_open, MapFlags, ProtFlags};
use nix::sys::stat::Mode;
use nix::unistd::ftruncate;
Expand Down

0 comments on commit 82881e2

Please sign in to comment.