1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-24 02:16:19 +04:00

Use a map for environment variables in a process.

This commit is contained in:
Stephen Marz 2020-05-16 10:43:21 -04:00
parent 2d74b6e6fa
commit c2ef6130fb

View File

@ -19,7 +19,7 @@ use crate::{cpu::{build_satp,
Table, Table,
PAGE_SIZE}, PAGE_SIZE},
syscall::syscall_exit}; syscall::syscall_exit};
use alloc::collections::vec_deque::VecDeque; use alloc::{string::String, collections::{vec_deque::VecDeque, BTreeMap}};
use core::ptr::null_mut; use core::ptr::null_mut;
use crate::lock::Mutex; use crate::lock::Mutex;
@ -596,7 +596,7 @@ impl Drop for Process {
// private process data. This is essentially our resource control block (RCB). // private process data. This is essentially our resource control block (RCB).
#[allow(dead_code)] #[allow(dead_code)]
pub struct ProcessData { pub struct ProcessData {
cwd_path: [u8; 128], environ: BTreeMap<String, String>
} }
// This is private data that we can query with system calls. // This is private data that we can query with system calls.
@ -604,6 +604,8 @@ pub struct ProcessData {
// is a per-process block queuing algorithm, we can put that here. // is a per-process block queuing algorithm, we can put that here.
impl ProcessData { impl ProcessData {
pub fn zero() -> Self { pub fn zero() -> Self {
ProcessData { cwd_path: [0; 128], } ProcessData {
environ: BTreeMap::new()
}
} }
} }