Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
coolyjg committed Aug 31, 2023
1 parent 926bde9 commit 50207f8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion api/arceos_posix_api/src/imp/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use axerrno::{LinuxError, LinuxResult};
use axfs::fops::OpenOptions;
use axio::{PollState, SeekFrom};

use super::{ctypes, fd_ops::FileLike, sync::Mutex};
use crate::utils::char_ptr_to_str;
use crate::{ctypes, imp::fd_ops::FileLike, imp::sync::Mutex};

pub struct File {
inner: Mutex<axfs::fops::File>,
Expand Down
7 changes: 2 additions & 5 deletions api/arceos_posix_api/src/imp/pthread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,15 @@ pub unsafe extern "C" fn sys_pthread_self() -> ctypes::pthread_t {
pub unsafe extern "C" fn sys_pthread_create(
res: *mut ctypes::pthread_t,
attr: *const ctypes::pthread_attr_t,
start_routine: *mut c_void,
start_routine: extern "C" fn(arg: *mut c_void) -> *mut c_void,
arg: *mut c_void,
) -> c_int {
debug!(
"sys_pthread_create <= {:#x}, {:#x}",
start_routine as usize, arg as usize
);
let entry = core::mem::transmute::<*mut c_void, extern "C" fn(arg: *mut c_void) -> *mut c_void>(
start_routine,
);
syscall_body!(sys_pthread_create, {
let ptr = Pthread::create(attr, entry, arg)?;
let ptr = Pthread::create(attr, start_routine, arg)?;
unsafe { core::ptr::write(res, ptr) };
Ok(0)
})
Expand Down
8 changes: 4 additions & 4 deletions api/arceos_posix_api/src/imp/stdio_imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ impl super::fd_ops::FileLike for Stdin {
Err(LinuxError::EPERM)
}

fn stat(&self) -> LinuxResult<super::ctypes::stat> {
fn stat(&self) -> LinuxResult<crate::ctypes::stat> {
let st_mode = 0o20000 | 0o440u32; // S_IFCHR | r--r-----
Ok(super::ctypes::stat {
Ok(crate::ctypes::stat {
st_ino: 1,
st_nlink: 1,
st_mode,
Expand Down Expand Up @@ -224,9 +224,9 @@ impl super::fd_ops::FileLike for Stdout {
Ok(self.lock().write(buf)?)
}

fn stat(&self) -> LinuxResult<super::ctypes::stat> {
fn stat(&self) -> LinuxResult<crate::ctypes::stat> {
let st_mode = 0o20000 | 0o220u32; // S_IFCHR | -w--w----
Ok(super::ctypes::stat {
Ok(crate::ctypes::stat {
st_ino: 1,
st_nlink: 1,
st_mode,
Expand Down
3 changes: 1 addition & 2 deletions ulib/axlibc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ pub unsafe extern "C" fn getpid() -> core::ffi::c_int {
#[cfg(feature = "multitask")]
{
use crate::utils::e;
use arceos_posix_api::{syscall0, SyscallId};
e(syscall0(SyscallId::GETPID))
e(arceos_posix_api::sys_getpid())
}
}

Expand Down
13 changes: 6 additions & 7 deletions ulib/axlibc/src/pthread/mutex.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::utils::e;
use arceos_posix_api::{ctypes, syscall1, syscall2, SyscallId};
use arceos_posix_api::{
ctypes, sys_pthread_mutex_init, sys_pthread_mutex_lock, sys_pthread_mutex_unlock,
};
use core::ffi::c_int;

/// Initialize a mutex.
Expand All @@ -8,20 +10,17 @@ pub unsafe extern "C" fn pthread_mutex_init(
mutex: *mut ctypes::pthread_mutex_t,
attr: *const ctypes::pthread_mutexattr_t,
) -> c_int {
e(syscall2(
SyscallId::PTHREAD_MUTEX_INIT,
[mutex as usize, attr as usize],
))
e(sys_pthread_mutex_init(mutex, attr))
}

/// Lock the given mutex.
#[no_mangle]
pub unsafe extern "C" fn pthread_mutex_lock(mutex: *mut ctypes::pthread_mutex_t) -> c_int {
e(syscall1(SyscallId::PTHREAD_MUTEX_LOCK, mutex as usize))
e(sys_pthread_mutex_lock(mutex))
}

/// Unlock the given mutex.
#[no_mangle]
pub unsafe extern "C" fn pthread_mutex_unlock(mutex: *mut ctypes::pthread_mutex_t) -> c_int {
e(syscall1(SyscallId::PTHREAD_MUTEX_UNLOCK, mutex as usize))
e(sys_pthread_mutex_unlock(mutex))
}

0 comments on commit 50207f8

Please sign in to comment.