mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
xous: return TID and PID from current_tid() and current_pid()
These should return the raw values, rather than the Result values. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
184a284da5
commit
071f2047f8
2 changed files with 7 additions and 7 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
pub fn id() -> u32 {
|
pub fn id() -> u32 {
|
||||||
if let Ok(crate::Result::ProcessID(pid)) = crate::syscall::current_pid() {
|
if let Ok(pid) = crate::syscall::current_pid() {
|
||||||
pid.get() as u32
|
pid.get() as u32
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
pid_from_usize, CpuID, Error, MemoryAddress, MemoryFlags, MemoryMessage, MemoryRange,
|
pid_from_usize, CpuID, Error, MemoryAddress, MemoryFlags, MemoryMessage, MemoryRange,
|
||||||
MemorySize, MemoryType, Message, MessageEnvelope, MessageSender, ProcessArgs, ProcessInit,
|
MemorySize, MemoryType, Message, MessageEnvelope, MessageSender, ProcessArgs, ProcessInit,
|
||||||
Result, ScalarMessage, SysCallResult, ThreadInit, CID, PID, SID,
|
Result, ScalarMessage, SysCallResult, ThreadInit, CID, PID, SID, TID,
|
||||||
};
|
};
|
||||||
use core::convert::TryInto;
|
use core::convert::TryInto;
|
||||||
|
|
||||||
|
|
@ -1406,10 +1406,10 @@ pub fn wait_process(joiner: crate::arch::ProcessHandle) -> SysCallResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the current process ID
|
/// Get the current process ID
|
||||||
pub fn current_pid() -> SysCallResult {
|
pub fn current_pid() -> core::result::Result<PID, Error> {
|
||||||
rsyscall(SysCall::GetProcessId).and_then(|result| {
|
rsyscall(SysCall::GetProcessId).and_then(|result| {
|
||||||
if let Result::ProcessID(pid) = result {
|
if let Result::ProcessID(pid) = result {
|
||||||
Ok(Result::ProcessID(pid))
|
Ok(pid)
|
||||||
} else {
|
} else {
|
||||||
Err(Error::InternalError)
|
Err(Error::InternalError)
|
||||||
}
|
}
|
||||||
|
|
@ -1417,10 +1417,10 @@ pub fn current_pid() -> SysCallResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the current thread ID
|
/// Get the current thread ID
|
||||||
pub fn current_tid() -> SysCallResult {
|
pub fn current_tid() -> core::result::Result<TID, Error> {
|
||||||
rsyscall(SysCall::GetProcessId).and_then(|result| {
|
rsyscall(SysCall::GetThreadId).and_then(|result| {
|
||||||
if let Result::ThreadID(tid) = result {
|
if let Result::ThreadID(tid) = result {
|
||||||
Ok(Result::ThreadID(tid))
|
Ok(tid)
|
||||||
} else {
|
} else {
|
||||||
Err(Error::InternalError)
|
Err(Error::InternalError)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue