MOS Source Code
Loading...
Searching...
No Matches
usermode.h File Reference
#include <mos/filesystem/fs_types.h>
#include <mos/io/io_types.h>
#include <mos/mos_global.h>
#include <mos/tasks/signal_types.h>
#include <mos/types.h>
#include <sys/poll.h>
#include <sys/select.h>
#include <sys/uio.h>
#include <mos/platform_syscall.h>
#include <mos/syscall/number.h>
+ Include dependency graph for usermode.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

should_inline fd_t syscall_vfs_openat (fd_t dirfd, const char *file_path, open_flags flags)
 
should_inline long syscall_vfs_fstatat (fd_t dirfd, const char *file_path, file_stat_t *stat_buf, fstatat_flags flags)
 
should_inline size_t syscall_io_read (fd_t fd, void *buffer, size_t size)
 
should_inline size_t syscall_io_write (fd_t fd, const void *buffer, size_t size)
 
should_inline bool syscall_io_close (fd_t fd)
 
should_inline __attribute__ ((__noreturn__)) void syscall_exit(u32 exit_code)
 
should_inline void syscall_yield_cpu (void)
 
should_inline pid_t syscall_fork (void)
 
should_inline pid_t syscall_get_pid (void)
 
should_inline pid_t syscall_get_parent_pid (void)
 
should_inline pid_t syscall_spawn (const char *file_path, const char *const *argv, const char *const *envp)
 
should_inline tid_t syscall_create_thread (const char *name, thread_entry_t entry, void *arg, size_t stack_size, void *stack)
 
should_inline tid_t syscall_get_tid (void)
 
should_inline bool syscall_wait_for_thread (tid_t tid)
 
should_inline bool syscall_futex_wait (futex_word_t *futex, u32 val)
 
should_inline bool syscall_futex_wake (futex_word_t *futex, size_t count)
 
should_inline fd_t syscall_ipc_create (const char *name, size_t max_pending_connections)
 
should_inline fd_t syscall_ipc_accept (fd_t fd)
 
should_inline fd_t syscall_ipc_connect (const char *name, size_t buffer_size)
 
should_inline u64 syscall_arch_syscall (u64 nr, u64 arg1, u64 arg2, u64 arg3, u64 arg4)
 
should_inline long syscall_vfs_mount (const char *device, const char *mount_point, const char *fs_type, const char *options)
 
should_inline ssize_t syscall_vfs_readlinkat (fd_t dirfd, const char *path, char *buf, size_t buf_size)
 
should_inline long syscall_vfs_unlinkat (fd_t dirfd, const char *path)
 
should_inline long syscall_vfs_symlink (const char *link_path, const char *target)
 
should_inline long syscall_vfs_mkdir (const char *path)
 
should_inline size_t syscall_vfs_list_dir (fd_t fd, char *buffer, size_t buffer_size)
 
should_inline long syscall_fd_manipulate (fd_t fd, u64 cmd, void *arg)
 
should_inline voidsyscall_mmap_anonymous (ptr_t hint_addr, size_t size, mem_perm_t perm, mmap_flags_t flags)
 
should_inline voidsyscall_mmap_file (ptr_t hint_addr, size_t size, mem_perm_t perm, mmap_flags_t flags, fd_t fd, off_t offset)
 
should_inline pid_t syscall_wait_for_process (pid_t pid, u32 *exit_code, u32 flags)
 
should_inline bool syscall_munmap (void *addr, size_t size)
 
should_inline long syscall_vfs_chdirat (fd_t dirfd, const char *path)
 
should_inline ssize_t syscall_vfs_getcwd (char *buf, size_t buf_size)
 
should_inline off_t syscall_io_seek (fd_t fd, off_t offset, io_seek_whence_t whence)
 
should_inline off_t syscall_io_tell (fd_t fd)
 
should_inline bool syscall_signal_register (signal_t signum, const sigaction_t *action)
 
should_inline long syscall_signal_process (pid_t pid, signal_t signum)
 
should_inline long syscall_signal_thread (tid_t tid, signal_t signum)
 
should_inline void syscall_poweroff (bool reboot, u32 magic)
 
should_inline bool syscall_vm_protect (void *addr, size_t size, mem_perm_t perm)
 
should_inline int syscall_io_poll (struct pollfd *fds, nfds_t nfds, int timeout)
 
should_inline int syscall_io_pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *timeout, const sigset_t *sigmask)
 
should_inline long syscall_execveat (fd_t dirfd, const char *file_path, const char *const *argv, const char *const *envp, u32 flags)
 
should_inline long syscall_clock_msleep (u64 ms)
 
should_inline fd_t syscall_io_dup (fd_t fd)
 
should_inline fd_t syscall_io_dup2 (fd_t old_fd, fd_t new_fd)
 
should_inline bool syscall_dmabuf_alloc (size_t n_pages, ptr_t *out_paddr, ptr_t *out_vaddr)
 
should_inline bool syscall_dmabuf_free (ptr_t vaddr, ptr_t paddr)
 
should_inline bool syscall_dmabuf_share (void *buf, size_t bufsize, ptr_t *out_paddr)
 
should_inline bool syscall_dmabuf_unshare (ptr_t paddr, size_t size, void *vaddr)
 
should_inline long syscall_pipe (fd_t *out_read_fd, fd_t *out_write_fd, fd_flags_t flags)
 
should_inline ssize_t syscall_io_readv (fd_t fd, const struct iovec *iov, int iov_count)
 
should_inline long syscall_vfs_unmount (const char *mount_point)
 
should_inline long syscall_clock_gettimeofday (struct timespec *tv)
 
should_inline long syscall_thread_setname (tid_t tid, const char *name)
 
should_inline ssize_t syscall_thread_getname (tid_t tid, char *buf, size_t buf_size)
 
should_inline long syscall_vfs_fchmodat (fd_t dirfd, const char *path, int mode, int flags)
 
should_inline long syscall_io_pread (fd_t fd, void *buf, size_t count, off_t offset)
 
should_inline fd_t syscall_memfd_create (const char *name, u32 flags)
 
should_inline long syscall_signal_mask_op (int how, const sigset_t *set, sigset_t *oldset)
 
should_inline long syscall_vfs_fsync (fd_t fd, bool data_only)
 

Function Documentation

◆ syscall_vfs_openat()

should_inline fd_t syscall_vfs_openat ( fd_t dirfd,
const char * file_path,
open_flags flags )

Definition at line 24 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_vfs_fstatat()

should_inline long syscall_vfs_fstatat ( fd_t dirfd,
const char * file_path,
file_stat_t * stat_buf,
fstatat_flags flags )

Definition at line 29 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_io_read()

should_inline size_t syscall_io_read ( fd_t fd,
void * buffer,
size_t size )

Definition at line 34 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_io_write()

should_inline size_t syscall_io_write ( fd_t fd,
const void * buffer,
size_t size )

Definition at line 39 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_io_close()

should_inline bool syscall_io_close ( fd_t fd)

Definition at line 44 of file usermode.h.

Referenced by rpc_client_destroy(), rpc_handle_client(), rpc_server_close(), and rpc_server_destroy().

+ Here is the call graph for this function:

◆ __attribute__()

should_inline __attribute__ ( (__noreturn__) )

Definition at line 49 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_yield_cpu()

should_inline void syscall_yield_cpu ( void )

Definition at line 55 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_fork()

should_inline pid_t syscall_fork ( void )

Definition at line 60 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_get_pid()

should_inline pid_t syscall_get_pid ( void )

Definition at line 65 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_get_parent_pid()

should_inline pid_t syscall_get_parent_pid ( void )

Definition at line 70 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_spawn()

should_inline pid_t syscall_spawn ( const char * file_path,
const char *const * argv,
const char *const * envp )

Definition at line 75 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_create_thread()

should_inline tid_t syscall_create_thread ( const char * name,
thread_entry_t entry,
void * arg,
size_t stack_size,
void * stack )

Definition at line 80 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_get_tid()

should_inline tid_t syscall_get_tid ( void )

Definition at line 85 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_wait_for_thread()

should_inline bool syscall_wait_for_thread ( tid_t tid)

Definition at line 96 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_futex_wait()

should_inline bool syscall_futex_wait ( futex_word_t * futex,
u32 val )

Definition at line 101 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_futex_wake()

should_inline bool syscall_futex_wake ( futex_word_t * futex,
size_t count )

Definition at line 106 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_ipc_create()

should_inline fd_t syscall_ipc_create ( const char * name,
size_t max_pending_connections )

Definition at line 111 of file usermode.h.

Referenced by rpc_server_create().

+ Here is the call graph for this function:

◆ syscall_ipc_accept()

should_inline fd_t syscall_ipc_accept ( fd_t fd)

Definition at line 116 of file usermode.h.

Referenced by rpc_server_exec().

+ Here is the call graph for this function:

◆ syscall_ipc_connect()

should_inline fd_t syscall_ipc_connect ( const char * name,
size_t buffer_size )

Definition at line 121 of file usermode.h.

Referenced by rpc_client_create().

+ Here is the call graph for this function:

◆ syscall_arch_syscall()

should_inline u64 syscall_arch_syscall ( u64 nr,
u64 arg1,
u64 arg2,
u64 arg3,
u64 arg4 )

arch_syscall This syscall is used to implement architecture-specific syscalls. The first argument is the syscall number, and the remaining arguments are the arguments to the syscall.

Definition at line 132 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_vfs_mount()

should_inline long syscall_vfs_mount ( const char * device,
const char * mount_point,
const char * fs_type,
const char * options )

Definition at line 137 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_vfs_readlinkat()

should_inline ssize_t syscall_vfs_readlinkat ( fd_t dirfd,
const char * path,
char * buf,
size_t buf_size )

Definition at line 142 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_vfs_unlinkat()

should_inline long syscall_vfs_unlinkat ( fd_t dirfd,
const char * path )

Definition at line 147 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_vfs_symlink()

should_inline long syscall_vfs_symlink ( const char * link_path,
const char * target )

Definition at line 152 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_vfs_mkdir()

should_inline long syscall_vfs_mkdir ( const char * path)

Definition at line 157 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_vfs_list_dir()

should_inline size_t syscall_vfs_list_dir ( fd_t fd,
char * buffer,
size_t buffer_size )

Definition at line 162 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_fd_manipulate()

should_inline long syscall_fd_manipulate ( fd_t fd,
u64 cmd,
void * arg )

Definition at line 167 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_mmap_anonymous()

should_inline void * syscall_mmap_anonymous ( ptr_t hint_addr,
size_t size,
mem_perm_t perm,
mmap_flags_t flags )

Definition at line 172 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_mmap_file()

should_inline void * syscall_mmap_file ( ptr_t hint_addr,
size_t size,
mem_perm_t perm,
mmap_flags_t flags,
fd_t fd,
off_t offset )

Definition at line 177 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_wait_for_process()

should_inline pid_t syscall_wait_for_process ( pid_t pid,
u32 * exit_code,
u32 flags )

Definition at line 182 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_munmap()

should_inline bool syscall_munmap ( void * addr,
size_t size )

Definition at line 187 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_vfs_chdirat()

should_inline long syscall_vfs_chdirat ( fd_t dirfd,
const char * path )

Definition at line 192 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_vfs_getcwd()

should_inline ssize_t syscall_vfs_getcwd ( char * buf,
size_t buf_size )

Definition at line 197 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_io_seek()

should_inline off_t syscall_io_seek ( fd_t fd,
off_t offset,
io_seek_whence_t whence )

Definition at line 202 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_io_tell()

should_inline off_t syscall_io_tell ( fd_t fd)

Definition at line 207 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_signal_register()

should_inline bool syscall_signal_register ( signal_t signum,
const sigaction_t * action )

Definition at line 212 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_signal_process()

should_inline long syscall_signal_process ( pid_t pid,
signal_t signum )

signal_process Send a signal to a process, an arbitrary thread in the target process will be selected to receive the signal.

Definition at line 222 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_signal_thread()

should_inline long syscall_signal_thread ( tid_t tid,
signal_t signum )

signal_thread Send a signal to a specific thread in a process.

Definition at line 231 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_poweroff()

should_inline void syscall_poweroff ( bool reboot,
u32 magic )

Definition at line 236 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_vm_protect()

should_inline bool syscall_vm_protect ( void * addr,
size_t size,
mem_perm_t perm )

Definition at line 247 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_io_poll()

should_inline int syscall_io_poll ( struct pollfd * fds,
nfds_t nfds,
int timeout )

Definition at line 252 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_io_pselect()

should_inline int syscall_io_pselect ( int nfds,
fd_set * readfds,
fd_set * writefds,
fd_set * exceptfds,
const struct timespec * timeout,
const sigset_t * sigmask )

Definition at line 257 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_execveat()

should_inline long syscall_execveat ( fd_t dirfd,
const char * file_path,
const char *const * argv,
const char *const * envp,
u32 flags )

Definition at line 262 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_clock_msleep()

should_inline long syscall_clock_msleep ( u64 ms)

Definition at line 267 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_io_dup()

should_inline fd_t syscall_io_dup ( fd_t fd)

Definition at line 272 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_io_dup2()

should_inline fd_t syscall_io_dup2 ( fd_t old_fd,
fd_t new_fd )

Definition at line 277 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_dmabuf_alloc()

should_inline bool syscall_dmabuf_alloc ( size_t n_pages,
ptr_t * out_paddr,
ptr_t * out_vaddr )

dmabuf_alloc Allocate a DMA buffer, the buffer will be physically contiguous and its virtual address will be mapped into user's address space.

Definition at line 287 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_dmabuf_free()

should_inline bool syscall_dmabuf_free ( ptr_t vaddr,
ptr_t paddr )

dmabuf_free Free a DMA buffer that was previously allocated with dma_alloc(). The buffer will be unmapped from user's address space, and its physical pages will be reclaimed.

Definition at line 298 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_dmabuf_share()

should_inline bool syscall_dmabuf_share ( void * buf,
size_t bufsize,
ptr_t * out_paddr )

dmabuf_share Export (copy) a userspace buffer to a DMA buffer address that can be used by devices. The physical address of the buffer will be returned in out_paddr.

Definition at line 308 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_dmabuf_unshare()

should_inline bool syscall_dmabuf_unshare ( ptr_t paddr,
size_t size,
void * vaddr )

dmabuf_unshare Unshare a DMA buffer that was previously shared with dmabuf_share(). The buffer will be freed after this call. The content of the buffer will be copied back to the userspace buffer, if vaddr is not NULL.

Definition at line 319 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_pipe()

should_inline long syscall_pipe ( fd_t * out_read_fd,
fd_t * out_write_fd,
fd_flags_t flags )

Definition at line 324 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_io_readv()

should_inline ssize_t syscall_io_readv ( fd_t fd,
const struct iovec * iov,
int iov_count )

Definition at line 329 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_vfs_unmount()

should_inline long syscall_vfs_unmount ( const char * mount_point)

Definition at line 334 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_clock_gettimeofday()

should_inline long syscall_clock_gettimeofday ( struct timespec * tv)

Definition at line 339 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_thread_setname()

should_inline long syscall_thread_setname ( tid_t tid,
const char * name )

Definition at line 344 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_thread_getname()

should_inline ssize_t syscall_thread_getname ( tid_t tid,
char * buf,
size_t buf_size )

Definition at line 349 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_vfs_fchmodat()

should_inline long syscall_vfs_fchmodat ( fd_t dirfd,
const char * path,
int mode,
int flags )

Definition at line 354 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_io_pread()

should_inline long syscall_io_pread ( fd_t fd,
void * buf,
size_t count,
off_t offset )

Definition at line 359 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_memfd_create()

should_inline fd_t syscall_memfd_create ( const char * name,
u32 flags )

Definition at line 364 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_signal_mask_op()

should_inline long syscall_signal_mask_op ( int how,
const sigset_t * set,
sigset_t * oldset )

Definition at line 369 of file usermode.h.

+ Here is the call graph for this function:

◆ syscall_vfs_fsync()

should_inline long syscall_vfs_fsync ( fd_t fd,
bool data_only )

vfs_fsync Synchronize the file to disk. If data_only is true, only the file data is synchronized, otherwise both data and metadata are synchronized.

Definition at line 379 of file usermode.h.

+ Here is the call graph for this function: