data_type large_stringclasses 3
values | source large_stringclasses 29
values | code large_stringlengths 98 49.4M | filepath large_stringlengths 5 161 ⌀ | message large_stringclasses 234
values | commit large_stringclasses 234
values | subject large_stringclasses 418
values | critique large_stringlengths 101 1.26M ⌀ | metadata dict |
|---|---|---|---|---|---|---|---|---|
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
fs::file_table::{FileDesc, get_file_fast},
prelude::*,
util::net::{CSocketOptionLevel, new_raw_socket_option},
};
pub fn sys_getsockopt(
sockfd: FileDesc,
level: i32,
optname: i32,
optval: Vaddr... | kernel/src/syscall/getsockopt.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::prelude::*;
pub fn sys_gettid(ctx: &Context) -> Result<SyscallReturn> {
let tid = ctx.posix_thread.tid();
Ok(SyscallReturn::Return(tid as _))
} | kernel/src/syscall/gettid.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
prelude::*,
time::{SystemTime, timeval_t},
};
// The use of the timezone structure is obsolete.
// Glibc sets the timezone_addr argument to NULL, so just ignore it.
pub fn sys_gettimeofday(
timeval_addr: Vaddr,... | kernel/src/syscall/gettimeofday.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{prelude::*, process::Uid};
pub fn sys_getuid(ctx: &Context) -> Result<SyscallReturn> {
let uid = ctx.posix_thread.credentials().ruid();
Ok(SyscallReturn::Return(<Uid as Into<u32>>::into(uid) as _))
} | kernel/src/syscall/getuid.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::{
SyscallReturn,
setxattr::{
XattrFileCtx, check_xattr_namespace, lookup_path_for_xattr, parse_xattr_name,
read_xattr_name_cstr_from_user,
},
};
use crate::{
fs::{
file_table::{FileDesc, get_file_fast},
utils::XATTR_VALUE_MA... | kernel/src/syscall/getxattr.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::{
file_table::{FdFlags, FileDesc, get_file_fast},
notify::inotify::{InotifyControls, InotifyEvents, InotifyFile},
path::FsPath,
utils::{InodeType, Permission},
},
prelude::*,
syscall::constant... | kernel/src/syscall/inotify.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::{
file_handle::FileLike,
file_table::{FdFlags, FileDesc, WithFileTable, get_file_fast},
utils::StatusFlags,
},
prelude::*,
process::posix_thread::FileTableRefMut,
util::ioctl::{RawIoctl, dispatch_... | kernel/src/syscall/ioctl.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
prelude::*,
process::{
ProcessFilter, kill, kill_all, kill_group,
signal::{
sig_num::SigNum,
signals::{Signal, user::UserSignal},
},
},
};
pub fn sys_kill(process_filter: u64, sig_num... | kernel/src/syscall/kill.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::{
file_table::FileDesc,
path::{AT_FDCWD, FsPath},
utils::InodeType,
},
prelude::*,
syscall::constants::MAX_FILENAME_LEN,
};
pub fn sys_linkat(
old_dirfd: FileDesc,
old_path_addr: Vaddr,
n... | kernel/src/syscall/link.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::file_table::{FileDesc, get_file_fast},
prelude::*,
};
pub fn sys_listen(sockfd: FileDesc, backlog: i32, ctx: &Context) -> Result<SyscallReturn> {
debug!("sockfd = {sockfd}, backlog = {backlog}");
let mut file_table = ctx.t... | kernel/src/syscall/listen.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::{
SyscallReturn,
setxattr::{XattrFileCtx, lookup_path_for_xattr},
};
use crate::{
fs::{
file_table::{FileDesc, get_file_fast},
utils::{XATTR_LIST_MAX_LEN, XattrNamespace},
},
prelude::*,
process::credentials::capabilities::CapSet,
... | kernel/src/syscall/listxattr.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::{
file_table::{FileDesc, get_file_fast},
utils::SeekFrom,
},
prelude::*,
};
pub fn sys_lseek(fd: FileDesc, offset: isize, whence: u32, ctx: &Context) -> Result<SyscallReturn> {
debug!("fd = {}, offset = {}, ... | kernel/src/syscall/lseek.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use align_ext::AlignExt;
use super::SyscallReturn;
use crate::{prelude::*, vm::vmar::VMAR_CAP_ADDR};
pub fn sys_madvise(addr: Vaddr, len: usize, behavior: i32, ctx: &Context) -> Result<SyscallReturn> {
let behavior = MadviseBehavior::try_from(behavior)?;
debug!(
"a... | kernel/src/syscall/madvise.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::{
file_table::FdFlags,
inode_handle::InodeHandle,
ramfs::memfd::{MAX_MEMFD_NAME_LEN, MemfdFlags, MemfdInodeHandle},
},
prelude::*,
};
pub fn sys_memfd_create(name_addr: Vaddr, flags: u32, ctx: &Context) ... | kernel/src/syscall/memfd_create.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs,
fs::{
file_table::FileDesc,
path::{AT_FDCWD, FsPath},
utils::{InodeMode, InodeType},
},
prelude::*,
syscall::constants::MAX_FILENAME_LEN,
};
pub fn sys_mkdirat(
dirfd: FileDesc,
path_addr... | kernel/src/syscall/mkdir.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::{
self,
file_table::FileDesc,
path::{AT_FDCWD, FsPath},
utils::{InodeMode, InodeType, MknodType},
},
prelude::*,
syscall::constants::MAX_FILENAME_LEN,
};
pub fn sys_mknodat(
dirfd: FileDe... | kernel/src/syscall/mknod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use align_ext::AlignExt;
use super::SyscallReturn;
use crate::{
fs::file_table::{FileDesc, get_file_fast},
prelude::*,
vm::{
perms::VmPerms,
vmar::{VMAR_CAP_ADDR, VMAR_LOWEST_ADDR},
vmo::VmoOptions,
},
};
pub fn sys_mmap(
addr: u64,
... | kernel/src/syscall/mmap.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! System call handlers.
#![cfg_attr(
any(target_arch = "riscv64", target_arch = "loongarch64"),
expect(dead_code)
)]
pub use clock_gettime::ClockId;
use ostd::arch::cpu::context::UserContext;
pub use timer_create::create_timer;
use crate::{context::Context, cpu::LinuxAb... | kernel/src/syscall/mod.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use device_id::DeviceId;
use super::SyscallReturn;
use crate::{
fs::{
path::{AT_FDCWD, FsPath, MountPropType, Path, PerMountFlags},
registry::{FsProperties, FsType},
utils::{FileSystem, FsFlags, InodeType},
},
prelude::*,
syscall::constants::... | kernel/src/syscall/mount.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use align_ext::AlignExt;
use super::SyscallReturn;
use crate::{
prelude::*,
vm::{perms::VmPerms, vmar::VMAR_CAP_ADDR},
};
pub fn sys_mprotect(addr: Vaddr, len: usize, perms: u64, ctx: &Context) -> Result<SyscallReturn> {
let vm_perms = VmPerms::from_user_bits(perms as ... | kernel/src/syscall/mprotect.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use align_ext::AlignExt;
use super::SyscallReturn;
use crate::prelude::*;
pub fn sys_mremap(
old_addr: Vaddr,
old_size: usize,
new_size: usize,
flags: i32,
new_addr: Vaddr,
ctx: &Context,
) -> Result<SyscallReturn> {
let flags = MremapFlags::from_bits(f... | kernel/src/syscall/mremap.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use align_ext::AlignExt;
use super::SyscallReturn;
use crate::{prelude::*, thread::kernel_thread::ThreadOptions, vm::vmar::VMAR_CAP_ADDR};
pub fn sys_msync(addr: Vaddr, len: usize, flag: i32, ctx: &Context) -> Result<SyscallReturn> {
let flags = MsyncFlags::from_bits(flag)
... | kernel/src/syscall/msync.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use align_ext::AlignExt;
use super::SyscallReturn;
use crate::{prelude::*, vm::vmar::VMAR_CAP_ADDR};
pub fn sys_munmap(addr: Vaddr, len: usize, ctx: &Context) -> Result<SyscallReturn> {
debug!("addr = 0x{:x}, len = {}", addr, len);
if !addr.is_multiple_of(PAGE_SIZE) {
... | kernel/src/syscall/munmap.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::time::Duration;
use ostd::{mm::VmIo, sync::Waiter};
use super::{ClockId, SyscallReturn, clock_gettime::read_clock};
use crate::{
prelude::*,
time::{
TIMER_ABSTIME, clockid_t,
clocks::{BootTimeClock, MonotonicClock, RealTimeClock},
timer::T... | kernel/src/syscall/nanosleep.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs,
fs::{
file_handle::FileLike,
file_table::{FdFlags, FileDesc},
inode_handle::InodeHandle,
path::{AT_FDCWD, FsPath, LookupResult, PathResolver},
utils::{AccessMode, CreationFlags, InodeMode, Ino... | kernel/src/syscall/open.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::sync::Waiter;
use super::SyscallReturn;
use crate::prelude::*;
pub fn sys_pause(_ctx: &Context) -> Result<SyscallReturn> {
// FIXME: like sleep, paused thread can only be interrupted by signals that will call signal
// handler or terminate current process
let... | kernel/src/syscall/pause.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::{
fs::file_table::{FdFlags, FileDesc, get_file_fast},
prelude::*,
process::{PidFile, credentials::capabilities::CapSet, posix_thread::AsPosixThread},
syscall::SyscallReturn,
};
pub fn sys_pidfd_getfd(
pidfd: FileDesc,
targetfd: FileDesc,
flags... | kernel/src/syscall/pidfd_getfd.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::{
fs::{file_table::FdFlags, utils::StatusFlags},
prelude::*,
process::{Pid, PidFile, process_table},
syscall::SyscallReturn,
};
pub fn sys_pidfd_open(pid: Pid, flags: u32, ctx: &Context) -> Result<SyscallReturn> {
let is_nonblocking = {
let fl... | kernel/src/syscall/pidfd_open.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use crate::{
fs::file_table::{FileDesc, get_file_fast},
prelude::*,
process::{
Pgid, Pid, PidFile, kill, kill_group,
posix_thread::AsPosixThread,
signal::{
c_types::siginfo_t,
constants::SI_TKILL,
... | kernel/src/syscall/pidfd_send_signal.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
fs::{
file_table::{FdFlags, FileDesc},
pipe,
utils::CreationFlags,
},
prelude::*,
};
pub fn sys_pipe2(fds: Vaddr, flags: u32, ctx: &Context) -> Result<SyscallReturn> {
debug!("flags:... | kernel/src/syscall/pipe.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::{cell::Cell, time::Duration};
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
events::IoEvents,
fs::{
file_handle::FileLike,
file_table::{FileDesc, FileTable},
},
prelude::*,
process::{ResourceType, signal::Poller},
};
pub ... | kernel/src/syscall/poll.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::time::Duration;
use ostd::mm::VmIo;
use super::{SyscallReturn, poll::do_sys_poll};
use crate::{
prelude::*,
process::signal::{sig_mask::SigMask, with_sigmask_changed},
time::timespec_t,
};
pub fn sys_ppoll(
fds: Vaddr,
nfds: u32,
timespec_addr: V... | kernel/src/syscall/ppoll.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
prelude::*,
process::{
credentials::SecureBits, posix_thread::MAX_THREAD_NAME_LEN, signal::sig_num::SigNum,
},
};
pub fn sys_prctl(
option: i32,
arg2: u64,
arg3: u64,
arg4: u64,
arg5... | kernel/src/syscall/prctl.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs,
fs::file_table::{FileDesc, get_file_fast},
prelude::*,
};
pub fn sys_pread64(
fd: FileDesc,
user_buf_ptr: Vaddr,
user_buf_len: usize,
offset: i64,
ctx: &Context,
) -> Result<SyscallReturn> {
debug!(
... | kernel/src/syscall/pread64.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs,
fs::file_table::{FileDesc, get_file_fast},
prelude::*,
util::VmWriterArray,
};
pub fn sys_readv(
fd: FileDesc,
io_vec_ptr: Vaddr,
io_vec_count: usize,
ctx: &Context,
) -> Result<SyscallReturn> {
let res ... | kernel/src/syscall/preadv.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
prelude::*,
process::{
Pid, Process, ResourceType,
credentials::capabilities::CapSet,
posix_thread::AsPosixThread,
process_table,
rlimit::{RawRLimit64, SYSCTL_NR_OPEN},
},... | kernel/src/syscall/prlimit64.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::time::Duration;
use ostd::mm::VmIo;
use super::{SyscallReturn, select::do_sys_select};
use crate::{
fs::file_table::FileDesc,
prelude::*,
process::signal::{sig_mask::SigMask, with_sigmask_changed},
time::timespec_t,
};
pub fn sys_pselect6(
nfds: File... | kernel/src/syscall/pselect6.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs,
fs::file_table::{FileDesc, get_file_fast},
prelude::*,
};
pub fn sys_pwrite64(
fd: FileDesc,
user_buf_ptr: Vaddr,
user_buf_len: usize,
offset: i64,
ctx: &Context,
) -> Result<SyscallReturn> {
debug!(
... | kernel/src/syscall/pwrite64.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs,
fs::file_table::{FileDesc, get_file_fast},
prelude::*,
util::VmReaderArray,
};
pub fn sys_writev(
fd: FileDesc,
io_vec_ptr: Vaddr,
io_vec_count: usize,
ctx: &Context,
) -> Result<SyscallReturn> {
let res... | kernel/src/syscall/pwritev.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs,
fs::file_table::{FileDesc, get_file_fast},
prelude::*,
};
pub fn sys_read(
fd: FileDesc,
user_buf_addr: Vaddr,
buf_len: usize,
ctx: &Context,
) -> Result<SyscallReturn> {
debug!(
"fd = {}, user_buf_p... | kernel/src/syscall/read.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
fs::{
file_table::FileDesc,
path::{AT_FDCWD, FsPath},
utils::SymbolicLink,
},
prelude::*,
syscall::constants::MAX_FILENAME_LEN,
};
pub fn sys_readlinkat(
dirfd: FileDesc,
pat... | kernel/src/syscall/readlink.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::power::{ExitCode, poweroff, restart};
use super::SyscallReturn;
use crate::{prelude::*, process::credentials::capabilities::CapSet};
// Linux reboot magic constants.
const LINUX_REBOOT_MAGIC1: u32 = 0xfee1dead;
const LINUX_REBOOT_MAGIC2: u32 = 0x28121969;
const LINUX_REB... | kernel/src/syscall/reboot.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::file_table::{FileDesc, get_file_fast},
net::socket::util::SendRecvFlags,
prelude::*,
util::net::write_socket_addr_to_user,
};
pub fn sys_recvfrom(
sockfd: FileDesc,
buf: Vaddr,
len: usize,
flags: i32,
sr... | kernel/src/syscall/recvfrom.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
fs::file_table::{FileDesc, get_file_fast},
net::socket::util::SendRecvFlags,
prelude::*,
util::net::CUserMsgHdr,
};
pub fn sys_recvmsg(
sockfd: FileDesc,
user_msghdr_ptr: Vaddr,
flags: i32,
... | kernel/src/syscall/recvmsg.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::{
SyscallReturn,
setxattr::{
XattrFileCtx, check_xattr_namespace, lookup_path_for_xattr, parse_xattr_name,
read_xattr_name_cstr_from_user,
},
};
use crate::{
fs,
fs::file_table::{FileDesc, get_file_fast},
prelude::*,
syscall::co... | kernel/src/syscall/removexattr.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::{
file_table::FileDesc,
path::{AT_FDCWD, FsPath, SplitPath},
utils::InodeType,
},
prelude::*,
syscall::constants::MAX_FILENAME_LEN,
};
pub fn sys_renameat2(
old_dirfd: FileDesc,
old_path_addr... | kernel/src/syscall/rename.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::{
file_table::FileDesc,
path::{AT_FDCWD, FsPath, SplitPath},
},
prelude::*,
syscall::constants::MAX_FILENAME_LEN,
};
pub fn sys_rmdir(path_addr: Vaddr, ctx: &Context) -> Result<SyscallReturn> {
self::sys... | kernel/src/syscall/rmdir.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
prelude::*,
process::{
posix_thread::AsPosixThread,
signal::{
HandlePendingSignal,
c_types::sigaction_t,
constants::{SIGKILL, SIGSTOP},
sig_action::Sig... | kernel/src/syscall/rt_sigaction.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::Ordering;
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{prelude::*, process::signal::HandlePendingSignal};
pub fn sys_rt_sigpending(
u_set_ptr: Vaddr,
sigset_size: usize,
ctx: &Context,
) -> Result<SyscallReturn> {
debug!(
... | kernel/src/syscall/rt_sigpending.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::Ordering;
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
prelude::*,
process::signal::{
constants::{SIGKILL, SIGSTOP},
sig_mask::SigMask,
},
};
pub fn sys_rt_sigprocmask(
how: u32,
set_ptr: Vaddr,
oldset_... | kernel/src/syscall/rt_sigprocmask.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::Ordering;
use ostd::{
arch::cpu::context::{FpuContext, UserContext},
mm::VmIo,
user::UserContextApi,
};
use super::SyscallReturn;
use crate::{
prelude::*, process::signal::c_types::ucontext_t, syscall::sigaltstack::set_new_stack,
};
pub fn ... | kernel/src/syscall/rt_sigreturn.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::{mm::VmIo, sync::Waiter};
use super::SyscallReturn;
use crate::{
prelude::*,
process::signal::{
constants::{SIGKILL, SIGSTOP},
sig_mask::SigMask,
with_sigmask_changed,
},
};
pub fn sys_rt_sigsuspend(
sigmask_addr: Vaddr,
sigmas... | kernel/src/syscall/rt_sigsuspend.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::{sync::atomic::Ordering, time::Duration};
use ostd::{mm::VmIo, sync::Waiter};
use super::SyscallReturn;
use crate::{
prelude::*,
process::signal::{
HandlePendingSignal,
constants::{SIGKILL, SIGSTOP},
sig_mask::{SigMask, SigSet},
si... | kernel/src/syscall/rt_sigtimedwait.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::{cmp, sync::atomic::Ordering};
use ostd::{
cpu::{CpuId, CpuSet, num_cpus},
mm::VmIo,
util::id_set::Id,
};
use super::SyscallReturn;
use crate::{prelude::*, process::posix_thread::thread_table, thread::Tid};
pub fn sys_sched_getaffinity(
tid: Tid,
cpu... | kernel/src/syscall/sched_affinity.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::ops::RangeInclusive;
use super::SyscallReturn;
use crate::{prelude::*, sched::RealTimePriority};
pub(super) const fn rt_to_static(prio: RealTimePriority) -> u32 {
(100 - prio.get()) as u32
}
pub(super) const fn static_to_rt(prio: u32) -> Result<RealTimePriority> {
... | kernel/src/syscall/sched_get_priority_max.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::{SyscallReturn, sched_get_priority_max::SCHED_PRIORITY_RANGE};
use crate::prelude::*;
pub fn sys_sched_get_priority_min(policy: u32, _: &Context) -> Result<SyscallReturn> {
let range = SCHED_PRIORITY_RANGE
.get(policy as usize)
.ok_or_else(|| Error::w... | kernel/src/syscall/sched_get_priority_min.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::{const_assert, mm::VmIo};
use super::{
SyscallReturn,
sched_get_priority_max::{SCHED_PRIORITY_RANGE, rt_to_static, static_to_rt},
};
use crate::{
prelude::*,
process::posix_thread::thread_table,
sched::{Nice, RealTimePolicy, SchedAttr, SchedPolicy},
... | kernel/src/syscall/sched_getattr.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::{SyscallReturn, sched_getattr::access_sched_attr_with};
use crate::{prelude::*, sched::SchedPolicy, thread::Tid};
pub fn sys_sched_getparam(tid: Tid, addr: Vaddr, ctx: &Context) -> Result<SyscallReturn> {
if addr == 0 {
return_errno_with_... | kernel/src/syscall/sched_getparam.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::{
SyscallReturn,
sched_getattr::{LinuxSchedAttr, access_sched_attr_with},
};
use crate::{prelude::*, thread::Tid};
pub fn sys_sched_getscheduler(tid: Tid, ctx: &Context) -> Result<SyscallReturn> {
let policy = access_sched_attr_with(tid, ctx, |attr| Ok(attr.p... | kernel/src/syscall/sched_getscheduler.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::{
SyscallReturn,
sched_getattr::{access_sched_attr_with, read_linux_sched_attr_from_user},
};
use crate::{prelude::*, sched::SchedPolicy, thread::Tid};
pub fn sys_sched_setattr(
tid: Tid,
addr: Vaddr,
flags: u32,
ctx: &Context,
) -> Result<Syscall... | kernel/src/syscall/sched_setattr.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::{SyscallReturn, sched_getattr::access_sched_attr_with};
use crate::{prelude::*, sched::SchedPolicy, thread::Tid};
pub fn sys_sched_setparam(tid: Tid, addr: Vaddr, ctx: &Context) -> Result<SyscallReturn> {
if addr == 0 {
return_errno_with_... | kernel/src/syscall/sched_setparam.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::{
SyscallReturn,
sched_getattr::{LinuxSchedAttr, access_sched_attr_with},
};
use crate::{prelude::*, thread::Tid};
pub fn sys_sched_setscheduler(
tid: Tid,
policy: i32,
addr: Vaddr,
ctx: &Context,
) -> Result<SyscallReturn> {
... | kernel/src/syscall/sched_setscheduler.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{prelude::*, thread::Thread};
pub fn sys_sched_yield(_ctx: &Context) -> Result<SyscallReturn> {
Thread::yield_now();
Ok(SyscallReturn::Return(0))
} | kernel/src/syscall/sched_yield.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::time::Duration;
use ostd::mm::VmIo;
use super::{
SyscallReturn,
poll::{PollFd, do_poll},
};
use crate::{events::IoEvents, fs::file_table::FileDesc, prelude::*, time::timeval_t};
pub fn sys_select(
nfds: FileDesc,
readfds_addr: Vaddr,
writefds_addr: V... | kernel/src/syscall/select.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
ipc::{
IpcControlCmd,
semaphore::system_v::{
PermissionMode,
sem::Semaphore,
sem_set::{SemaphoreSet, check_sem, sem_sets, sem_sets_mut},
},
},
prelude:... | kernel/src/syscall/semctl.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
ipc::{
IpcFlags,
semaphore::system_v::{
PermissionMode,
sem_set::{SEMMNI, SEMMSL, check_sem, create_sem_set, create_sem_set_with_id},
},
},
prelude::*,
};
pub fn sys_semget(key: i32, ... | kernel/src/syscall/semget.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::time::Duration;
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
ipc::semaphore::system_v::{
sem::{SemBuf, sem_op},
sem_set::SEMOPM,
},
prelude::*,
time::timespec_t,
};
pub fn sys_semop(sem_id: i32, tsops: Vaddr, nsops: usize, c... | kernel/src/syscall/semop.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
fs,
fs::file_table::{FileDesc, WithFileTable},
prelude::*,
};
pub fn sys_sendfile(
out_fd: FileDesc,
in_fd: FileDesc,
offset_ptr: Vaddr,
count: isize,
ctx: &Context,
) -> Result<SyscallRetur... | kernel/src/syscall/sendfile.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use crate::{
fs::file_table::FileDesc,
net::socket::{Socket, util::SendRecvFlags},
prelude::*,
syscall::{SyscallReturn, sendmsg::send_one_message},
util::net::CUserMsgHdr,
};
pub fn sys_sendmmsg(
sockfd: FileDesc,
mmsghdrs_addr: Vadd... | kernel/src/syscall/sendmmsg.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
fs::file_table::FileDesc,
net::socket::{
Socket,
util::{MessageHeader, SendRecvFlags},
},
prelude::*,
util::net::CUserMsgHdr,
};
pub fn sys_sendmsg(
sockfd: FileDesc,
user_msghdr... | kernel/src/syscall/sendmsg.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::file_table::{FileDesc, get_file_fast},
net::socket::util::{MessageHeader, SendRecvFlags},
prelude::*,
util::net::read_socket_addr_from_user,
};
pub fn sys_sendto(
sockfd: FileDesc,
buf: Vaddr,
len: usize,
fl... | kernel/src/syscall/sendto.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::Ordering;
use super::{SyscallReturn, get_ioprio::IoPrioWho};
use crate::{prelude::*, process::posix_thread::AsPosixThread};
pub fn sys_ioprio_set(which: u32, who: u32, ioprio: u32, ctx: &Context) -> Result<SyscallReturn> {
debug!("which = {}, who = {}, ... | kernel/src/syscall/set_ioprio.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::sync::atomic::Ordering;
use super::SyscallReturn;
use crate::{
prelude::*,
process::ResourceType::RLIMIT_NICE,
sched::Nice,
syscall::get_priority::{PriorityTarget, get_processes},
};
pub fn sys_set_priority(which: i32, who: u32, prio: i32, ctx: &Context) ... | kernel/src/syscall/set_priority.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{prelude::*, process::posix_thread::RobustListHead};
pub fn sys_set_robust_list(
robust_list_head_ptr: Vaddr,
len: usize,
ctx: &Context,
) -> Result<SyscallReturn> {
debug!(
"robust list head ptr: 0x{... | kernel/src/syscall/set_robust_list.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::prelude::*;
pub fn sys_set_tid_address(tidptr: Vaddr, ctx: &Context) -> Result<SyscallReturn> {
debug!("tidptr = 0x{:x}", tidptr);
let clear_child_tid = ctx.thread_local.clear_child_tid().get();
if clear_child_tid != 0 {
// ... | kernel/src/syscall/set_tid_address.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::{prelude::*, syscall::SyscallReturn};
pub fn sys_setdomainname(addr: Vaddr, len: usize, ctx: &Context) -> Result<SyscallReturn> {
let ns_proxy_ref = ctx.thread_local.borrow_ns_proxy();
let ns_proxy = ns_proxy_ref.unwrap();
ns_proxy.uts_ns().set_domainname(add... | kernel/src/syscall/setdomainname.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{prelude::*, process::Gid};
pub fn sys_setfsgid(gid: i32, ctx: &Context) -> Result<SyscallReturn> {
let fsgid = if gid >= 0 {
Some(Gid::new(gid.cast_unsigned()))
} else {
None
};
debug!("fsgid = {:?}", fsgid);
... | kernel/src/syscall/setfsgid.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{prelude::*, process::Uid};
pub fn sys_setfsuid(uid: i32, ctx: &Context) -> Result<SyscallReturn> {
let fsuid = if uid >= 0 {
Some(Uid::new(uid.cast_unsigned()))
} else {
None
};
debug!("fsuid = {:?}", fsuid);
... | kernel/src/syscall/setfsuid.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{prelude::*, process::Gid};
pub fn sys_setgid(gid: i32, ctx: &Context) -> Result<SyscallReturn> {
if gid < 0 {
return_errno_with_message!(Errno::EINVAL, "GIDs cannot be negative");
}
let gid = Gid::new(gid.cast_unsigned());
... | kernel/src/syscall/setgid.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{prelude::*, process::Gid};
pub fn sys_setgroups(size: usize, group_list_addr: Vaddr, ctx: &Context) -> Result<SyscallReturn> {
debug!("size = {}, group_list_addr = 0x{:x}", size, group_list_addr);
// TODO: check pe... | kernel/src/syscall/setgroups.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use crate::{prelude::*, syscall::SyscallReturn};
pub fn sys_sethostname(addr: Vaddr, len: usize, ctx: &Context) -> Result<SyscallReturn> {
let ns_proxy_ref = ctx.thread_local.borrow_ns_proxy();
let ns_proxy = ns_proxy_ref.unwrap();
ns_proxy.uts_ns().set_hostname(addr, l... | kernel/src/syscall/sethostname.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::time::Duration;
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
prelude::*,
time::{itimerval_t, timer::Timeout, timeval_t},
};
/// `ItimerType` is used to differ the target timer for some timer-related syscalls.
#[derive(Debug, Copy, Clone, TryFromInt... | kernel/src/syscall/setitimer.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! This module implements the `setns` syscall.
//!
//! This syscall reassociates the calling thread with a namespace specified by a
//! file descriptor. The `flags` argument determines which type of namespace can be
//! joined.
//!
//! The file descriptor `fd` can refer to:
//! 1. ... | kernel/src/syscall/setns.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
prelude::*,
process::{Pgid, Pid},
};
pub fn sys_setpgid(pid: Pid, pgid: Pgid, ctx: &Context) -> Result<SyscallReturn> {
let current = ctx.process.as_ref();
// The documentation quoted below is from
// <https://www.man7.org... | kernel/src/syscall/setpgid.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{prelude::*, process::Gid};
pub fn sys_setregid(rgid: i32, egid: i32, ctx: &Context) -> Result<SyscallReturn> {
let rgid = if rgid >= 0 {
Some(Gid::new(rgid.cast_unsigned()))
} else {
None
};
let egid = if egid >... | kernel/src/syscall/setregid.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{prelude::*, process::Gid};
pub fn sys_setresgid(rgid: i32, egid: i32, sgid: i32, ctx: &Context) -> Result<SyscallReturn> {
let rgid = if rgid >= 0 {
Some(Gid::new(rgid.cast_unsigned()))
} else {
None
};
let egid... | kernel/src/syscall/setresgid.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{prelude::*, process::Uid};
pub fn sys_setresuid(ruid: i32, euid: i32, suid: i32, ctx: &Context) -> Result<SyscallReturn> {
let ruid = if ruid >= 0 {
Some(Uid::new(ruid.cast_unsigned()))
} else {
None
};
let euid... | kernel/src/syscall/setresuid.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{prelude::*, process::Uid};
pub fn sys_setreuid(ruid: i32, euid: i32, ctx: &Context) -> Result<SyscallReturn> {
let ruid = if ruid >= 0 {
Some(Uid::new(ruid.cast_unsigned()))
} else {
None
};
let euid = if euid >... | kernel/src/syscall/setreuid.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::prelude::*;
pub fn sys_setsid(_ctx: &Context) -> Result<SyscallReturn> {
let sid = current!().to_new_session()?;
Ok(SyscallReturn::Return(sid as _))
} | kernel/src/syscall/setsid.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::file_table::{FileDesc, get_file_fast},
prelude::*,
util::net::{CSocketOptionLevel, new_raw_socket_option},
};
pub fn sys_setsockopt(
sockfd: FileDesc,
level: i32,
optname: i32,
optval: Vaddr,
optlen: u32,
... | kernel/src/syscall/setsockopt.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{prelude::*, process::Uid};
pub fn sys_setuid(uid: i32, ctx: &Context) -> Result<SyscallReturn> {
if uid < 0 {
return_errno_with_message!(Errno::EINVAL, "UIDs cannot be negative");
}
let uid = Uid::new(uid.cast_unsigned());
... | kernel/src/syscall/setuid.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use alloc::borrow::Cow;
use super::SyscallReturn;
use crate::{
fs,
fs::{
file_handle::FileLike,
file_table::{FileDesc, get_file_fast},
path::{AT_FDCWD, FsPath, Path},
utils::{
XATTR_NAME_MAX_LEN, XATTR_VALUE_MAX_LEN, XattrName, Xa... | kernel/src/syscall/setxattr.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::file_table::{FileDesc, get_file_fast},
net::socket::util::SockShutdownCmd,
prelude::*,
};
pub fn sys_shutdown(sockfd: FileDesc, how: i32, ctx: &Context) -> Result<SyscallReturn> {
let shutdown_cmd = SockShutdownCmd::try_fro... | kernel/src/syscall/shutdown.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::{arch::cpu::context::UserContext, mm::VmIo, user::UserContextApi};
use super::SyscallReturn;
use crate::{
prelude::*,
process::signal::{SigStack, SigStackFlags, SigStackStatus, c_types::stack_t},
};
pub fn sys_sigaltstack(
sig_stack_addr: Vaddr,
old_sig_s... | kernel/src/syscall/sigaltstack.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
//! signalfd implementation for Linux compatibility
//!
//! The signalfd mechanism allows receiving signals via file descriptor,
//! enabling better integration with event loops.
//! See <https://man7.org/linux/man-pages/man2/signalfd.2.html>.
use core::{
fmt::Display,
sync... | kernel/src/syscall/signalfd.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use super::SyscallReturn;
use crate::{
fs::{file_handle::FileLike, file_table::FdFlags},
net::socket::{
ip::{DatagramSocket, StreamSocket},
netlink::{
NetlinkRouteSocket, NetlinkUeventSocket, StandardNetlinkProtocol, is_valid_protocol,
},
... | kernel/src/syscall/socket.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
fs::{
file_handle::FileLike,
file_table::{FdFlags, FileDesc},
},
net::socket::unix::{UnixDatagramSocket, UnixStreamSocket},
prelude::*,
util::net::{CSocketAddrFamily, Protocol, SOCK_TYPE_... | kernel/src/syscall/socketpair.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
fs::{
file_table::{FileDesc, get_file_fast},
path::{AT_FDCWD, FsPath},
utils::Metadata,
},
prelude::*,
syscall::constants::MAX_FILENAME_LEN,
time::timespec_t,
};
pub fn sys_fstat... | kernel/src/syscall/stat.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
fs::{
file_table::{FileDesc, get_file_fast},
path::FsPath,
utils::{PATH_MAX, SuperBlock},
},
prelude::*,
};
pub fn sys_statfs(path_ptr: Vaddr, statfs_buf_ptr: Vaddr, ctx: &Context) -> Re... | kernel/src/syscall/statfs.rs | null | null | null | null | null |
source | asterinas | // SPDX-License-Identifier: MPL-2.0
use core::time::Duration;
use ostd::mm::VmIo;
use super::SyscallReturn;
use crate::{
fs::{
file_table::FileDesc,
path::{FsPath, Path},
},
prelude::*,
syscall::constants::MAX_FILENAME_LEN,
};
const STATX_ATTR_MOUNT_ROOT: u64 = 0x0000_2000;
pub fn s... | kernel/src/syscall/statx.rs | null | null | null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.