mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[kernel] Start process handles at 1
The 0 index was still sometimes not handled properly in the hash table. Also 0 is sometimes indicative of an error. Let's just start handles from 1 to avoid those issues.
This commit is contained in:
@@ -17,13 +17,13 @@ kutil::vector<process*> process::s_processes;
|
|||||||
|
|
||||||
process::process() :
|
process::process() :
|
||||||
kobject {kobject::type::process},
|
kobject {kobject::type::process},
|
||||||
m_next_handle {0},
|
m_next_handle {1},
|
||||||
m_state {state::running}
|
m_state {state::running}
|
||||||
{
|
{
|
||||||
s_processes.append(this);
|
s_processes.append(this);
|
||||||
|
|
||||||
j6_handle_t self = add_handle(this);
|
j6_handle_t self = add_handle(this);
|
||||||
kassert(self == self_handle(), "Process self-handle is not 0");
|
kassert(self == self_handle(), "Process self-handle is not 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// The "kernel process"-only constructor
|
// The "kernel process"-only constructor
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public:
|
|||||||
bool thread_exited(thread *th);
|
bool thread_exited(thread *th);
|
||||||
|
|
||||||
/// Get the handle for this process to refer to itself
|
/// Get the handle for this process to refer to itself
|
||||||
inline j6_handle_t self_handle() const { return 0; }
|
inline j6_handle_t self_handle() const { return 1; }
|
||||||
|
|
||||||
/// Get the process object that owns kernel threads and the
|
/// Get the process object that owns kernel threads and the
|
||||||
/// kernel address space
|
/// kernel address space
|
||||||
|
|||||||
Reference in New Issue
Block a user