mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-08 04:56:43 +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 {
|
||||
if let Ok(crate::Result::ProcessID(pid)) = crate::syscall::current_pid() {
|
||||
if let Ok(pid) = crate::syscall::current_pid() {
|
||||
pid.get() as u32
|
||||
} else {
|
||||
0
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
pid_from_usize, CpuID, Error, MemoryAddress, MemoryFlags, MemoryMessage, MemoryRange,
|
||||
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;
|
||||
|
||||
|
|
@ -1406,10 +1406,10 @@ pub fn wait_process(joiner: crate::arch::ProcessHandle) -> SysCallResult {
|
|||
}
|
||||
|
||||
/// 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| {
|
||||
if let Result::ProcessID(pid) = result {
|
||||
Ok(Result::ProcessID(pid))
|
||||
Ok(pid)
|
||||
} else {
|
||||
Err(Error::InternalError)
|
||||
}
|
||||
|
|
@ -1417,10 +1417,10 @@ pub fn current_pid() -> SysCallResult {
|
|||
}
|
||||
|
||||
/// Get the current thread ID
|
||||
pub fn current_tid() -> SysCallResult {
|
||||
rsyscall(SysCall::GetProcessId).and_then(|result| {
|
||||
pub fn current_tid() -> core::result::Result<TID, Error> {
|
||||
rsyscall(SysCall::GetThreadId).and_then(|result| {
|
||||
if let Result::ThreadID(tid) = result {
|
||||
Ok(Result::ThreadID(tid))
|
||||
Ok(tid)
|
||||
} else {
|
||||
Err(Error::InternalError)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue