mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-23 09:23:25 +00:00
Move Tid from Thread to PosixThread
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
ceb6e2b242
commit
81b0f265b5
@ -136,7 +136,7 @@ pub fn read_clock(clockid: clockid_t, ctx: &Context) -> Result<Duration> {
|
||||
}
|
||||
}
|
||||
DynamicClockIdInfo::Tid(tid, clock_type) => {
|
||||
let thread = thread_table::get_thread(tid)
|
||||
let thread = thread_table::get_posix_thread(tid)
|
||||
.ok_or_else(|| Error::with_message(Errno::EINVAL, "invalid clock ID"))?;
|
||||
let posix_thread = thread.as_posix_thread().unwrap();
|
||||
match clock_type {
|
||||
|
@ -6,12 +6,11 @@ use crate::{
|
||||
syscall::SyscallReturn,
|
||||
};
|
||||
|
||||
pub fn sys_exit(exit_code: i32, _ctx: &Context) -> Result<SyscallReturn> {
|
||||
pub fn sys_exit(exit_code: i32, ctx: &Context) -> Result<SyscallReturn> {
|
||||
debug!("exid code = {}", exit_code);
|
||||
|
||||
let current_thread = current_thread!();
|
||||
let term_status = TermStatus::Exited(exit_code as _);
|
||||
do_exit(current_thread, term_status)?;
|
||||
do_exit(ctx.thread, ctx.posix_thread, term_status)?;
|
||||
|
||||
Ok(SyscallReturn::Return(0))
|
||||
}
|
||||
|
@ -71,6 +71,6 @@ pub fn sys_futex(
|
||||
_ => panic!("Unsupported futex operations"),
|
||||
}?;
|
||||
|
||||
debug!("futex returns, tid= {} ", ctx.thread.tid());
|
||||
debug!("futex returns, tid= {} ", ctx.posix_thread.tid());
|
||||
Ok(SyscallReturn::Return(res as _))
|
||||
}
|
||||
|
@ -4,6 +4,6 @@ use super::SyscallReturn;
|
||||
use crate::prelude::*;
|
||||
|
||||
pub fn sys_gettid(ctx: &Context) -> Result<SyscallReturn> {
|
||||
let tid = ctx.thread.tid();
|
||||
let tid = ctx.posix_thread.tid();
|
||||
Ok(SyscallReturn::Return(tid as _))
|
||||
}
|
||||
|
@ -345,7 +345,10 @@ macro_rules! log_syscall_entry {
|
||||
if log::log_enabled!(log::Level::Info) {
|
||||
let syscall_name_str = stringify!($syscall_name);
|
||||
let pid = $crate::current!().pid();
|
||||
let tid = $crate::current_thread!().tid();
|
||||
let tid = {
|
||||
use $crate::process::posix_thread::PosixThreadExt;
|
||||
$crate::current_thread!().tid()
|
||||
};
|
||||
log::info!(
|
||||
"[pid={}][tid={}][id={}][{}]",
|
||||
pid,
|
||||
|
@ -13,6 +13,6 @@ pub fn sys_set_tid_address(tidptr: Vaddr, ctx: &Context) -> Result<SyscallReturn
|
||||
} else {
|
||||
*clear_child_tid = tidptr;
|
||||
}
|
||||
let tid = ctx.thread.tid();
|
||||
let tid = ctx.posix_thread.tid();
|
||||
Ok(SyscallReturn::Return(tid as _))
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ pub fn sys_timer_create(
|
||||
// Send a signal to the specified thread when the timer is expired.
|
||||
SigNotify::SIGEV_THREAD_ID => {
|
||||
let tid = sig_event.sigev_un.read_tid() as u32;
|
||||
let thread = thread_table::get_thread(tid).ok_or_else(|| {
|
||||
let thread = thread_table::get_posix_thread(tid).ok_or_else(|| {
|
||||
Error::with_message(Errno::EINVAL, "target thread does not exist")
|
||||
})?;
|
||||
let posix_thread = thread.as_posix_thread().unwrap();
|
||||
@ -132,7 +132,7 @@ pub fn sys_timer_create(
|
||||
}
|
||||
}
|
||||
DynamicClockIdInfo::Tid(tid, clock_type) => {
|
||||
let thread = thread_table::get_thread(tid)
|
||||
let thread = thread_table::get_posix_thread(tid)
|
||||
.ok_or_else(|| Error::with_message(Errno::EINVAL, "invalid clock id"))?;
|
||||
let posix_thread = thread.as_posix_thread().unwrap();
|
||||
match clock_type {
|
||||
|
Reference in New Issue
Block a user