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

Initialize GcManager #669

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/kernel/src/fs/dev/cdev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ bitflags! {
#[derive(Debug, Clone, Copy)]
pub struct DriverFlags: u32 {
const D_NEEDMINOR = 0x00800000;
const D_INIT = 0x80000000;
}
}

Expand Down
36 changes: 36 additions & 0 deletions src/kernel/src/gc/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
use std::sync::Arc;

use crate::{
errno::Errno,
fs::{make_dev, Cdev, CdevSw, DriverFlags, MakeDev, Mode, OpenFlags},
process::VThread,
ucred::{Gid, Uid},
};

pub struct GcManager {}

impl GcManager {
pub fn new() -> () {
let gc_devsw = Arc::new(CdevSw::new(DriverFlags::D_INIT, Some(Self::gc_open), None));

let _gc = make_dev(
&gc_devsw,
0,
"gc",
Uid::ROOT,
Gid::ROOT,
Mode::new(0o666).unwrap(),
None,
MakeDev::MAKEDEV_ETERNAL,
);
}

fn gc_open(
_gc: &Arc<Cdev>,
_flags: OpenFlags,
_mode: i32,
_td: Option<&VThread>,
) -> Result<(), Box<dyn Errno>> {
todo!()
}
}
3 changes: 3 additions & 0 deletions src/kernel/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::debug::{DebugManager, DebugManagerInitError};
use crate::dmem::DmemManager;
use crate::ee::{EntryArg, RawFn};
use crate::fs::{Fs, FsError, MountError, MountFlags, MountOpts, VPath};
use crate::gc::GcManager;
use crate::kqueue::KernelQueueManager;
use crate::llvm::Llvm;
use crate::log::{print, LOGGER};
Expand Down Expand Up @@ -42,6 +43,7 @@ mod dmem;
mod ee;
mod errno;
mod fs;
mod gc;
mod idt;
mod kqueue;
mod llvm;
Expand Down Expand Up @@ -276,6 +278,7 @@ fn run<E: crate::ee::ExecutionEngine>(
TimeManager::new(&mut syscalls);
KernelQueueManager::new(&mut syscalls);
NetManager::new(&mut syscalls);
GcManager::new();

// TODO: Get correct budget name from the PS4.
let budget_id = budget.create(Budget::new("big app", ProcType::BigApp));
Expand Down