Fennix
1.0.0
Full Documentation
|
Go to the source code of this file.
Data Structures | |
struct | FramebufferScreenInfo |
struct | kutsname |
Macros | |
#define | scarg __UINTPTR_TYPE__ |
#define | __SYS_NULL ((void *)0) |
NULL pointer. | |
#define | FBIOGET_SCREEN_INFO 0xf0 |
Get framebuffer screen info. | |
#define | call_api_version(version) syscall1(SYS_API_VERSION, (scarg)version) |
Set syscall version. | |
#define | call_read(fd, buf, count) syscall3(SYS_READ, (scarg)fd, (scarg)buf, (scarg)count) |
Read from a file descriptor. | |
#define | call_pread(fd, buf, count, offset) syscall4(SYS_PREAD, (scarg)fd, (scarg)buf, (scarg)count, (scarg)offset) |
Read from a file descriptor. | |
#define | call_write(fd, buf, count) syscall3(SYS_WRITE, (scarg)fd, (scarg)buf, (scarg)count) |
Write to a file descriptor. | |
#define | call_pwrite(fd, buf, count, offset) syscall4(SYS_PWRITE, (scarg)fd, (scarg)buf, (scarg)count, (scarg)offset) |
Write to a file descriptor. | |
#define | call_open(pathname, flags, mode) syscall3(SYS_OPEN, (scarg)pathname, (scarg)flags, (scarg)mode) |
Open a file. | |
#define | call_close(fd) syscall1(SYS_CLOSE, fd) |
Close a file descriptor. | |
#define | call_ioctl(fd, request, argp) syscall3(SYS_IOCTL, (scarg)fd, (scarg)request, (scarg)argp) |
Control a device. | |
#define | call_fcntl(fd, cmd, arg) syscall3(SYS_FCNTL, (scarg)fd, (scarg)cmd, (scarg)arg) |
Function control. | |
#define | call_stat(pathname, statbuf) syscall2(SYS_STAT, (scarg)pathname, (scarg)statbuf) |
Retrieve file status. | |
#define | call_fstat(fd, statbuf) syscall2(SYS_FSTAT, (scarg)fd, (scarg)statbuf) |
Retrieve file status for an open file descriptor. | |
#define | call_lstat(pathname, statbuf) syscall2(SYS_LSTAT, (scarg)pathname, (scarg)statbuf) |
Retrieve file status with symbolic link resolution. | |
#define | call_access(pathname, mode) syscall2(SYS_ACCESS, (scarg)pathname, (scarg)mode) |
Check a file's accessibility. | |
#define | call_truncate(pathname, length) syscall2(SYS_TRUNCATE, (scarg)pathname, (scarg)length) |
Change the size of a file. | |
#define | call_ftruncate(fd, length) syscall2(SYS_FTRUNCATE, (scarg)fd, (scarg)length) |
Change the size of a file referred by a file descriptor. | |
#define | call_tell(fd) syscall1(SYS_TELL, (scarg)fd) |
Get the current file offset. | |
#define | call_seek(fd, offset, whence) syscall3(SYS_SEEK, (scarg)fd, (scarg)offset, (scarg)whence) |
Set the file offset. | |
#define | call_exit(status) syscall1(SYS_EXIT, (scarg)status) |
Terminate the calling process. | |
#define | call_fork() syscall0(SYS_FORK) |
Create a child process. | |
#define | call_execve(pathname, argv, envp) syscall3(SYS_EXECVE, (scarg)pathname, (scarg)argv, (scarg)envp) |
Execute a program. | |
#define | call_getpid() syscall0(SYS_GETPID) |
Get the process ID of the calling process. | |
#define | call_getppid() syscall0(SYS_GETPPID) |
Get the parent process ID. | |
#define | call_waitpid(pid, wstatus, options) syscall3(SYS_WAITPID, (scarg)pid, (scarg)wstatus, (scarg)options) |
Wait for a child process to change state. | |
#define | call_kill(pid, sig) syscall2(SYS_KILL, (scarg)pid, (scarg)sig) |
Send a signal to a process. | |
#define | call_prctl(option, arg1, arg2, arg3, arg4) syscall5(SYS_PRCTL, (scarg)option, (scarg)arg1, (scarg)arg2, (scarg)arg3, (scarg)arg4) |
Process/Thread Control. | |
#define | call_brk(end_data) syscall1(SYS_BRK, (scarg)end_data) |
Set the program break. | |
#define | call_mmap(addr, length, prot, flags, fd, offset) syscall6(SYS_MMAP, (scarg)addr, (scarg)length, (scarg)prot, (scarg)flags, (scarg)fd, (scarg)offset) |
Map files or devices into memory. | |
#define | call_munmap(addr, length) syscall2(SYS_MUNMAP, (scarg)addr, (scarg)length) |
Unmap a mapped memory region. | |
#define | call_mprotect(addr, length, prot) syscall3(SYS_MPROTECT, (scarg)addr, (scarg)length, (scarg)prot) |
Change memory protection. | |
#define | call_madvise(addr, length, advice) syscall3(SYS_MADVISE, (scarg)addr, (scarg)length, (scarg)advice) |
Provide advice about memory usage. | |
#define | call_pipe(pipefd) syscall1(SYS_PIPE, (scarg)pipefd) |
Create a pipe. | |
#define | call_dup(oldfd) syscall1(SYS_DUP, (scarg)oldfd) |
Duplicate a file descriptor. | |
#define | call_dup2(oldfd, newfd) syscall2(SYS_DUP2, (scarg)oldfd, (scarg)newfd) |
Duplicate a file descriptor to a specific value. | |
#define | call_socket(domain, type, protocol) syscall3(SYS_SOCKET, (scarg)domain, (scarg)type, (scarg)protocol) |
Create an endpoint for communication. | |
#define | call_bind(sockfd, addr, addrlen) syscall3(SYS_BIND, (scarg)sockfd, (scarg)addr, (scarg)addrlen) |
Bind a socket to a local address. | |
#define | call_connect(sockfd, addr, addrlen) syscall3(SYS_CONNECT, (scarg)sockfd, (scarg)addr, (scarg)addrlen) |
Connect to a remote address. | |
#define | call_listen(sockfd, backlog) syscall2(SYS_LISTEN, (scarg)sockfd, (scarg)backlog) |
Listen for incoming connections on a socket. | |
#define | call_accept(sockfd, addr, addrlen) syscall3(SYS_ACCEPT, (scarg)sockfd, (scarg)addr, (scarg)addrlen) |
Accept an incoming connection on a socket. | |
#define | call_send(sockfd, buf, len, flags) syscall4(SYS_SEND, (scarg)sockfd, (scarg)buf, (scarg)len, (scarg)flags) |
Send data on a socket. | |
#define | call_recv(sockfd, buf, len, flags) syscall4(SYS_RECV, (scarg)sockfd, (scarg)buf, (scarg)len, (scarg)flags) |
Receive data on a socket. | |
#define | call_shutdown(sockfd, how) syscall2(SYS_SHUTDOWN, (scarg)sockfd, (scarg)how) |
Shut down part of a full-duplex connection. | |
#define | call_time(t) syscall1(SYS_TIME, (scarg)t) |
Get the current time. | |
#define | call_clock_gettime(clockid, tp) syscall2(SYS_CLOCK_GETTIME, (scarg)clockid, (scarg)tp) |
Get the current time of a specific clock. | |
#define | call_clock_settime(clockid, tp) syscall2(SYS_CLOCK_SETTIME, (scarg)clockid, (scarg)tp) |
Set the current time of a specific clock. | |
#define | call_nanosleep(req, rem) syscall2(SYS_NANOSLEEP, (scarg)req, (scarg)rem) |
Sleep for a specified time. | |
#define | call_getcwd(buf, size) syscall2(SYS_GETCWD, (scarg)buf, (scarg)size) |
Get the current working directory. | |
#define | call_chdir(path) syscall1(SYS_CHDIR, (scarg)path) |
Change the current working directory. | |
#define | call_mkdir(path, mode) syscall2(SYS_MKDIR, (scarg)path, (scarg)mode) |
Create a new directory. | |
#define | call_rmdir(path) syscall1(SYS_RMDIR, (scarg)path) |
Remove an empty directory. | |
#define | call_unlink(pathname) syscall1(SYS_UNLINK, (scarg)pathname) |
Remove a file. | |
#define | call_rename(oldpath, newpath) syscall2(SYS_RENAME, (scarg)oldpath, (scarg)newpath) |
Rename a file or directory. | |
#define | call_uname(buf) syscall1(SYS_UNAME, (scarg)buf) |
Get unix name information. | |
Typedefs | |
typedef int | __SYS_clockid_t |
typedef unsigned int | __SYS_socklen_t |
typedef struct FramebufferScreenInfo | FramebufferScreenInfo |
Functions | |
static scarg | syscall0 (scarg syscall) |
Syscall wrapper with 0 arguments. | |
static scarg | syscall1 (scarg syscall, scarg arg1) |
Syscall wrapper with 1 argument. | |
static scarg | syscall2 (scarg syscall, scarg arg1, scarg arg2) |
Syscall wrapper with 2 arguments. | |
static scarg | syscall3 (scarg syscall, scarg arg1, scarg arg2, scarg arg3) |
Syscall wrapper with 3 arguments. | |
static scarg | syscall4 (scarg syscall, scarg arg1, scarg arg2, scarg arg3, scarg arg4) |
Syscall wrapper with 4 arguments. | |
static scarg | syscall5 (scarg syscall, scarg arg1, scarg arg2, scarg arg3, scarg arg4, scarg arg5) |
Syscall wrapper with 5 arguments. | |
static scarg | syscall6 (scarg syscall, scarg arg1, scarg arg2, scarg arg3, scarg arg4, scarg arg5, scarg arg6) |
Syscall wrapper with 6 arguments. | |
struct FramebufferScreenInfo |
Definition at line 615 of file syscalls.h.
Data Fields | ||
---|---|---|
__UINT32_TYPE__ | Bpp | |
__UINT32_TYPE__ | Height | |
__UINT32_TYPE__ | Pitch | |
__UINT32_TYPE__ | Size | |
__UINT32_TYPE__ | Width |
struct kutsname |
Definition at line 637 of file syscalls.h.
Data Fields | ||
---|---|---|
char | machine[65] | |
char | release[65] | |
char | sysname[65] | |
char | version[65] |
#define __SYS_NULL ((void *)0) |
NULL pointer.
This is a pointer to address 0, which is reserved and cannot be dereferenced.
Definition at line 388 of file syscalls.h.
#define call_accept | ( | sockfd, | |
addr, | |||
addrlen | |||
) | syscall3(SYS_ACCEPT, (scarg)sockfd, (scarg)addr, (scarg)addrlen) |
Accept an incoming connection on a socket.
Accepts an incoming connection on a listening socket, creating a new socket for communication.
sockfd | Socket file descriptor |
addr | Client address |
addrlen | Length of the address |
Definition at line 1798 of file syscalls.h.
#define call_access | ( | pathname, | |
mode | |||
) | syscall2(SYS_ACCESS, (scarg)pathname, (scarg)mode) |
Check a file's accessibility.
Checks if the calling process can access the file specified by pathname
according to the specified mode
.
pathname | Path to the file |
mode | Accessibility check mode Supported values:
|
Definition at line 1717 of file syscalls.h.
#define call_api_version | ( | version | ) | syscall1(SYS_API_VERSION, (scarg)version) |
Set syscall version.
This syscall is used to set the version of the list. To prevent applications from breaking on major changes, this should be called at the very beginning of the program.
version | The version of the syscall list of which the program was compiled with |
Definition at line 1677 of file syscalls.h.
#define call_bind | ( | sockfd, | |
addr, | |||
addrlen | |||
) | syscall3(SYS_BIND, (scarg)sockfd, (scarg)addr, (scarg)addrlen) |
Bind a socket to a local address.
Binds a socket to a local address so it can listen for incoming connections.
sockfd | Socket file descriptor |
addr | Address to bind to |
addrlen | Length of the address |
Definition at line 1789 of file syscalls.h.
Set the program break.
Increases or decreases the program’s data space, ending at end_data
.
end_data | New program break location |
Definition at line 1760 of file syscalls.h.
Change the current working directory.
Changes the current working directory to the specified path
.
path | New directory path |
Definition at line 1829 of file syscalls.h.
#define call_clock_gettime | ( | clockid, | |
tp | |||
) | syscall2(SYS_CLOCK_GETTIME, (scarg)clockid, (scarg)tp) |
Get the current time of a specific clock.
Retrieves the current time for the specified clock (CLOCK_REALTIME
, CLOCK_MONOTONIC
, etc.).
clockid | Clock ID to query |
tp | Pointer to store the time |
Definition at line 1815 of file syscalls.h.
#define call_clock_settime | ( | clockid, | |
tp | |||
) | syscall2(SYS_CLOCK_SETTIME, (scarg)clockid, (scarg)tp) |
Set the current time of a specific clock.
Sets the time for the specified clock (CLOCK_REALTIME
, CLOCK_MONOTONIC
, etc.).
clockid | Clock ID to set |
tp | Pointer to the time value |
Definition at line 1818 of file syscalls.h.
Close a file descriptor.
Closes the file descriptor fd
, releasing its resources.
fd | File descriptor to close |
Definition at line 1697 of file syscalls.h.
#define call_connect | ( | sockfd, | |
addr, | |||
addrlen | |||
) | syscall3(SYS_CONNECT, (scarg)sockfd, (scarg)addr, (scarg)addrlen) |
Connect to a remote address.
Connects a socket to a remote address.
sockfd | Socket file descriptor |
addr | Remote address to connect to |
addrlen | Length of the address |
Definition at line 1792 of file syscalls.h.
Duplicate a file descriptor.
Duplicates the file descriptor oldfd
, returning the new file descriptor.
oldfd | File descriptor to duplicate |
oldfd
is invalid Definition at line 1780 of file syscalls.h.
Duplicate a file descriptor to a specific value.
Duplicates oldfd
to newfd
. If newfd
is already open, it will be closed first.
oldfd | File descriptor to duplicate |
newfd | File descriptor to duplicate oldfd to |
Definition at line 1783 of file syscalls.h.
#define call_execve | ( | pathname, | |
argv, | |||
envp | |||
) | syscall3(SYS_EXECVE, (scarg)pathname, (scarg)argv, (scarg)envp) |
Execute a program.
Replaces the current process image with a new process image specified by pathname
.
pathname | Path to the executable file |
argv | Argument vector |
envp | Environment variables |
Definition at line 1740 of file syscalls.h.
Terminate the calling process.
Terminates the calling process with the specified status
. The status code is made available to the parent process.
status | Exit status code |
Definition at line 1734 of file syscalls.h.
Function control.
Manipulates the underlying parameters of a device.
fd | File descriptor referring to the device |
cmd | Device-specific request code |
arg | Argument for the request |
Definition at line 1703 of file syscalls.h.
Create a child process.
Creates a new process by duplicating the calling process. The child process has its own copy of the parent's address space.
Definition at line 1737 of file syscalls.h.
Retrieve file status for an open file descriptor.
Gets the status of the file referred to by fd
.
fd | File descriptor |
statbuf | Buffer to store file status |
Definition at line 1711 of file syscalls.h.
#define call_ftruncate | ( | fd, | |
length | |||
) | syscall2(SYS_FTRUNCATE, (scarg)fd, (scarg)length) |
Change the size of a file referred by a file descriptor.
Sets the size of the file referred to by fd
to length
.
fd | File descriptor |
length | Desired file length |
Definition at line 1723 of file syscalls.h.
#define call_getcwd | ( | buf, | |
size | |||
) | syscall2(SYS_GETCWD, (scarg)buf, (scarg)size) |
Get the current working directory.
Retrieves the current working directory.
buf | Buffer to store the directory path |
size | Size of the buffer |
buf
on successDefinition at line 1826 of file syscalls.h.
#define call_getpid | ( | ) | syscall0(SYS_GETPID) |
Get the process ID of the calling process.
Returns the process ID of the calling process.
Definition at line 1743 of file syscalls.h.
#define call_getppid | ( | ) | syscall0(SYS_GETPPID) |
Get the parent process ID.
Returns the parent process ID of the calling process.
Definition at line 1746 of file syscalls.h.
#define call_ioctl | ( | fd, | |
request, | |||
argp | |||
) | syscall3(SYS_IOCTL, (scarg)fd, (scarg)request, (scarg)argp) |
Control a device.
Manipulates the underlying parameters of a device.
fd | File descriptor referring to the device |
request | Device-specific request code |
argp | Argument for the request |
Definition at line 1700 of file syscalls.h.
Send a signal to a process.
Sends the signal sig
to the process specified by pid
.
pid | Process ID |
sig | Signal to send |
Definition at line 1752 of file syscalls.h.
#define call_listen | ( | sockfd, | |
backlog | |||
) | syscall2(SYS_LISTEN, (scarg)sockfd, (scarg)backlog) |
Listen for incoming connections on a socket.
Sets a socket to listen for incoming connections, specifying the backlog queue size.
sockfd | Socket file descriptor |
backlog | Number of pending connections to allow |
Definition at line 1795 of file syscalls.h.
Retrieve file status with symbolic link resolution.
Gets the status of the file specified by pathname
, but does not follow symbolic links.
pathname | Path to the file |
statbuf | Buffer to store file status |
Definition at line 1714 of file syscalls.h.
#define call_madvise | ( | addr, | |
length, | |||
advice | |||
) | syscall3(SYS_MADVISE, (scarg)addr, (scarg)length, (scarg)advice) |
Provide advice about memory usage.
Provides advice to the kernel about the expected behavior of the memory region starting at addr
for length
, such as whether it will be accessed randomly or sequentially.
addr | Start address of the memory region |
length | Length of the memory region |
advice | Desired advice (e.g., MADV_DONTNEED, MADV_SEQUENTIAL) |
Definition at line 1772 of file syscalls.h.
Create a new directory.
Creates a new directory at path
with the specified permissions.
path | Path to the new directory |
mode | Directory permissions |
Definition at line 1832 of file syscalls.h.
#define call_mmap | ( | addr, | |
length, | |||
prot, | |||
flags, | |||
fd, | |||
offset | |||
) | syscall6(SYS_MMAP, (scarg)addr, (scarg)length, (scarg)prot, (scarg)flags, (scarg)fd, (scarg)offset) |
Map files or devices into memory.
Maps a file or device into memory. This can be used for memory-mapped I/O or for sharing memory between processes.
addr | Desired starting address of the mapping (NULL for automatic allocation) |
length | Length of the mapping |
prot | Desired memory protection Supported values:
|
flags | Mapping options Supported values:
|
fd | File descriptor for the file to map |
offset | Offset in the file to start the mapping |
Definition at line 1763 of file syscalls.h.
#define call_mprotect | ( | addr, | |
length, | |||
prot | |||
) | syscall3(SYS_MPROTECT, (scarg)addr, (scarg)length, (scarg)prot) |
Change memory protection.
Sets the protection on the memory region starting at addr
for length
.
addr | Start address of the memory region |
length | Length of the memory region |
prot | Desired memory protection (e.g., PROT_READ, PROT_WRITE) |
Definition at line 1769 of file syscalls.h.
#define call_munmap | ( | addr, | |
length | |||
) | syscall2(SYS_MUNMAP, (scarg)addr, (scarg)length) |
Unmap a mapped memory region.
Unmaps a previously mapped memory region, making the memory available for reuse.
addr | Start address of the memory region |
length | Length of the memory region to unmap |
Definition at line 1766 of file syscalls.h.
#define call_nanosleep | ( | req, | |
rem | |||
) | syscall2(SYS_NANOSLEEP, (scarg)req, (scarg)rem) |
Sleep for a specified time.
Suspends the execution of the calling thread for the specified time duration.
req | Pointer to timespec specifying the time to sleep |
rem | Pointer to store remaining time if interrupted |
Definition at line 1821 of file syscalls.h.
#define call_open | ( | pathname, | |
flags, | |||
mode | |||
) | syscall3(SYS_OPEN, (scarg)pathname, (scarg)flags, (scarg)mode) |
Open a file.
Opens the file specified by pathname
.
pathname | Path to the file |
flags | Flags for file access mode Supported values:
|
mode | Permissions for newly created file (if applicable) |
Definition at line 1694 of file syscalls.h.
Create a pipe.
Creates a pipe, returning two file descriptors in pipefd
. One is for reading, and the other is for writing.
pipefd | Array to store the two file descriptors |
Definition at line 1777 of file syscalls.h.
#define call_prctl | ( | option, | |
arg1, | |||
arg2, | |||
arg3, | |||
arg4 | |||
) | syscall5(SYS_PRCTL, (scarg)option, (scarg)arg1, (scarg)arg2, (scarg)arg3, (scarg)arg4) |
Process/Thread Control.
Perform various operations on a process or thread.
option | Operation to perform |
arg1 | Argument 1 |
arg2 | Argument 2 |
arg3 | Argument 3 |
arg4 | Argument 4 |
Definition at line 1755 of file syscalls.h.
#define call_pread | ( | fd, | |
buf, | |||
count, | |||
offset | |||
) | syscall4(SYS_PREAD, (scarg)fd, (scarg)buf, (scarg)count, (scarg)offset) |
Read from a file descriptor.
Reads up to count
bytes from the file descriptor fd
into the buffer starting at buf
.
fd | File descriptor to read from |
buf | Buffer where data will be stored |
count | Maximum number of bytes to read |
offset | Offset in the file |
Definition at line 1685 of file syscalls.h.
#define call_pwrite | ( | fd, | |
buf, | |||
count, | |||
offset | |||
) | syscall4(SYS_PWRITE, (scarg)fd, (scarg)buf, (scarg)count, (scarg)offset) |
Write to a file descriptor.
Writes up to count
bytes from the buffer starting at buf
to the file descriptor fd
.
fd | File descriptor to write to |
buf | Buffer containing data to write |
count | Number of bytes to write |
offset | Offset in the file |
Definition at line 1691 of file syscalls.h.
Read from a file descriptor.
Reads up to count
bytes from the file descriptor fd
into the buffer starting at buf
.
fd | File descriptor to read from |
buf | Buffer where data will be stored |
count | Maximum number of bytes to read |
Definition at line 1682 of file syscalls.h.
#define call_recv | ( | sockfd, | |
buf, | |||
len, | |||
flags | |||
) | syscall4(SYS_RECV, (scarg)sockfd, (scarg)buf, (scarg)len, (scarg)flags) |
Receive data on a socket.
Receives data from a socket.
sockfd | Socket file descriptor |
buf | Buffer to store received data |
len | Maximum number of bytes to receive |
flags | Flags for the receive operation |
Definition at line 1804 of file syscalls.h.
#define call_rename | ( | oldpath, | |
newpath | |||
) | syscall2(SYS_RENAME, (scarg)oldpath, (scarg)newpath) |
Rename a file or directory.
Renames a file or directory from oldpath
to newpath
.
oldpath | Current name of the file or directory |
newpath | New name of the file or directory |
Definition at line 1841 of file syscalls.h.
Remove an empty directory.
Removes the empty directory specified by path
.
path | Path to the directory |
Definition at line 1835 of file syscalls.h.
#define call_seek | ( | fd, | |
offset, | |||
whence | |||
) | syscall3(SYS_SEEK, (scarg)fd, (scarg)offset, (scarg)whence) |
Set the file offset.
Sets the file offset for the file referred to by fd
to the specified offset
according to the directive whence
.
fd | File descriptor |
offset | Offset to set |
whence | Directive for setting the offset Supported values:
|
Definition at line 1729 of file syscalls.h.
#define call_send | ( | sockfd, | |
buf, | |||
len, | |||
flags | |||
) | syscall4(SYS_SEND, (scarg)sockfd, (scarg)buf, (scarg)len, (scarg)flags) |
Send data on a socket.
Sends data through a socket.
sockfd | Socket file descriptor |
buf | Data to send |
len | Length of the data |
flags | Flags for the send operation |
Definition at line 1801 of file syscalls.h.
#define call_shutdown | ( | sockfd, | |
how | |||
) | syscall2(SYS_SHUTDOWN, (scarg)sockfd, (scarg)how) |
Shut down part of a full-duplex connection.
Shuts down part of a full-duplex connection on a socket.
sockfd | Socket file descriptor |
how | Determines which operations to shut down (e.g., SHUT_RD, SHUT_WR) |
Definition at line 1807 of file syscalls.h.
#define call_socket | ( | domain, | |
type, | |||
protocol | |||
) | syscall3(SYS_SOCKET, (scarg)domain, (scarg)type, (scarg)protocol) |
Create an endpoint for communication.
Creates an endpoint for communication, returning a socket file descriptor.
domain | Communication domain (e.g., AF_INET for IPv4) |
type | Type of socket (e.g., SOCK_STREAM for TCP) |
protocol | Protocol to use (e.g., IPPROTO_TCP) |
Definition at line 1786 of file syscalls.h.
Retrieve file status.
Gets the status of the file specified by pathname
.
pathname | Path to the file |
statbuf | Buffer to store file status |
Definition at line 1708 of file syscalls.h.
Get the current file offset.
Returns the current file offset for the file referred to by fd
.
fd | File descriptor |
fd
is not a valid file descriptor Definition at line 1726 of file syscalls.h.
Get the current time.
Retrieves the current calendar time as the number of seconds since the epoch.
t | Pointer to store the time (optional) |
t
is NULL Definition at line 1812 of file syscalls.h.
#define call_truncate | ( | pathname, | |
length | |||
) | syscall2(SYS_TRUNCATE, (scarg)pathname, (scarg)length) |
Change the size of a file.
Sets the size of the file specified by pathname
to length
. If the file is shorter, it is extended and the extended part is zero-filled.
pathname | Path to the file |
length | Desired file length |
Definition at line 1720 of file syscalls.h.
Get unix name information.
Retrieves information about the operating system.
buf | Pointer to kutsname structure to store information |
Definition at line 1844 of file syscalls.h.
#define call_unlink | ( | pathname | ) | syscall1(SYS_UNLINK, (scarg)pathname) |
Remove a file.
Removes the file specified by pathname
.
pathname | Path to the file |
Definition at line 1838 of file syscalls.h.
#define call_waitpid | ( | pid, | |
wstatus, | |||
options | |||
) | syscall3(SYS_WAITPID, (scarg)pid, (scarg)wstatus, (scarg)options) |
Wait for a child process to change state.
Waits for the child process specified by pid
to change state.
pid | Process ID to wait for |
wstatus | Pointer to store the status information |
options | Options for waiting behavior |
Definition at line 1749 of file syscalls.h.
Write to a file descriptor.
Writes up to count
bytes from the buffer starting at buf
to the file descriptor fd
.
fd | File descriptor to write to |
buf | Buffer containing data to write |
count | Number of bytes to write |
Definition at line 1688 of file syscalls.h.
#define FBIOGET_SCREEN_INFO 0xf0 |
Get framebuffer screen info.
fd | File descriptor of the framebuffer device |
info | Pointer to the framebuffer screen info structure |
Definition at line 635 of file syscalls.h.
#define scarg __UINTPTR_TYPE__ |
Definition at line 33 of file syscalls.h.
typedef int __SYS_clockid_t |
Definition at line 612 of file syscalls.h.
typedef unsigned int __SYS_socklen_t |
Definition at line 613 of file syscalls.h.
typedef struct FramebufferScreenInfo FramebufferScreenInfo |
Enumerator | |
---|---|
__SYS_F_OK | |
__SYS_R_OK | |
__SYS_W_OK | |
__SYS_X_OK |
Definition at line 420 of file syscalls.h.
enum syscall_clockid_t |
Enumerator | |
---|---|
__SYS_CLOCK_MONOTONIC | |
__SYS_CLOCK_PROCESS_CPUTIME_ID | |
__SYS_CLOCK_REALTIME | |
__SYS_CLOCK_THREAD_CPUTIME_ID |
Definition at line 598 of file syscalls.h.
enum syscall_mmap_flags_t |
Enumerator | |
---|---|
__SYS_PROT_READ | |
__SYS_PROT_WRITE | |
__SYS_PROT_EXEC | |
__SYS_PROT_NONE | |
__SYS_MAP_SHARED | |
__SYS_MAP_PRIVATE | |
__SYS_MAP_FIXED | |
__SYS_MAP_ANONYMOUS | |
__SYS_MAP_ANON |
Definition at line 390 of file syscalls.h.
enum syscall_open_flags_t |
Enumerator | |
---|---|
__SYS_O_RDONLY | |
__SYS_O_WRONLY | |
__SYS_O_RDWR | |
__SYS_O_APPEND | |
__SYS_O_CREAT | |
__SYS_O_DSYNC | |
__SYS_O_EXCL | |
__SYS_O_NOCTTY | |
__SYS_O_NONBLOCK | |
__SYS_O_RSYNC | |
__SYS_O_SYNC | |
__SYS_O_TRUNC |
Definition at line 404 of file syscalls.h.
Enumerator | |
---|---|
__SYS_GET_GS | |
__SYS_SET_GS | |
__SYS_GET_FS | |
__SYS_SET_FS |
Definition at line 428 of file syscalls.h.
Enumerator | |
---|---|
__SYS_SEEK_SET | |
__SYS_SEEK_CUR | |
__SYS_SEEK_END |
Definition at line 439 of file syscalls.h.
Enumerator | |
---|---|
__SYS_SIG_ERR | |
__SYS_SIG_DFL | |
___SYS_SIG_IGN |
Definition at line 591 of file syscalls.h.
Enumerator | |
---|---|
__SYS_SA_NOCLDSTOP | |
__SYS_SA_ONSTACK | |
__SYS_SA_RESETHAND | |
__SYS_SA_RESTART | |
__SYS_SA_SIGINFO | |
__SYS_SA_NOCLDWAIT | |
__SYS_SA_NODEFER |
Definition at line 580 of file syscalls.h.
Enumerator | |
---|---|
__SYS_SIG_BLOCK | |
__SYS_SIG_UNBLOCK | |
__SYS_SIG_SETMASK |
Definition at line 573 of file syscalls.h.
Enumerator | |
---|---|
__SYS_SIG_TERM | Terminate the process. |
__SYS_SIG_IGN | Ignore the signal. |
__SYS_SIG_CONT | Continue the process. |
__SYS_SIG_STOP | Stop the process. |
__SYS_SIG_CORE | Dump core. |
Definition at line 556 of file syscalls.h.
enum syscall_signal_t |
Definition at line 446 of file syscalls.h.
enum syscalls_t |
List of syscalls.
This list contains all the syscalls of the Fennix Kernel API.
Enumerator | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SYS_API_VERSION | Set syscall version. int api_version(int version);
This syscall is used to set the version of the list. To prevent applications from breaking on major changes, this should be called at the very beginning of the program.
| ||||||||||||
SYS_DEBUG_REPORT | |||||||||||||
SYS_READ | Read from a file descriptor. ssize_t sys_read(int fildes, void *buf, size_t nbyte);
Reads up to
| ||||||||||||
SYS_PREAD | Read from a file descriptor. ssize_t sys_pread(int fildes, void *buf, size_t nbyte, off_t offset);
Reads up to
| ||||||||||||
SYS_WRITE | Write to a file descriptor. ssize_t sys_write(int fildes, const void *buf, size_t nbyte);
Writes up to
| ||||||||||||
SYS_PWRITE | Write to a file descriptor. ssize_t sys_pwrite(int fildes, const void *buf, size_t nbyte, off_t offset);
Writes up to
| ||||||||||||
SYS_OPEN | Open a file. int open(const char *pathname, int flags, mode_t mode);
Opens the file specified by
| ||||||||||||
SYS_CLOSE | Close a file descriptor. int close(int fd);
Closes the file descriptor
| ||||||||||||
SYS_IOCTL | Control a device. int ioctl(int fd, unsigned long request, void *argp);
Manipulates the underlying parameters of a device.
| ||||||||||||
SYS_FCNTL | Function control. int fcntl(int fd, int cmd, void *arg);
Manipulates the underlying parameters of a device.
| ||||||||||||
SYS_STAT | Retrieve file status. int stat(const char *pathname, struct stat *statbuf);
Gets the status of the file specified by
| ||||||||||||
SYS_FSTAT | Retrieve file status for an open file descriptor. int fstat(int fd, struct stat *statbuf);
Gets the status of the file referred to by
| ||||||||||||
SYS_LSTAT | Retrieve file status with symbolic link resolution. int lstat(const char *pathname, struct stat *statbuf);
Gets the status of the file specified by
| ||||||||||||
SYS_ACCESS | Check a file's accessibility. int access(const char *pathname, int mode);
Checks if the calling process can access the file specified by
| ||||||||||||
SYS_TRUNCATE | Change the size of a file. int truncate(const char *pathname, off_t length);
Sets the size of the file specified by
| ||||||||||||
SYS_FTRUNCATE | Change the size of a file referred by a file descriptor. int ftruncate(int fd, off_t length);
Sets the size of the file referred to by
| ||||||||||||
SYS_TELL | Get the current file offset. off_t tell(int fd);
Returns the current file offset for the file referred to by
| ||||||||||||
SYS_SEEK | Set the file offset. off_t seek(int fd, off_t offset, int whence);
Sets the file offset for the file referred to by
| ||||||||||||
SYS_EXIT | Terminate the calling process. void exit(int status);
Terminates the calling process with the specified
| ||||||||||||
SYS_FORK | Create a child process. pid_t fork(void);
Creates a new process by duplicating the calling process. The child process has its own copy of the parent's address space.
| ||||||||||||
SYS_EXECVE | Execute a program. int execve(const char *pathname, char *const argv[], char *const envp[]);
Replaces the current process image with a new process image specified by
| ||||||||||||
SYS_GETPID | Get the process ID of the calling process. pid_t getpid(void);
Returns the process ID of the calling process.
| ||||||||||||
SYS_GETPPID | Get the parent process ID. pid_t getppid(void);
Returns the parent process ID of the calling process.
| ||||||||||||
SYS_WAITPID | Wait for a child process to change state. pid_t waitpid(pid_t pid, int *wstatus, int options);
Waits for the child process specified by
| ||||||||||||
SYS_KILL | Send a signal to a process. int kill(pid_t pid, int sig);
Sends the signal
| ||||||||||||
SYS_PRCTL | Process/Thread Control. int prctl(syscall_prctl_options_t option, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4);
Perform various operations on a process or thread.
| ||||||||||||
SYS_BRK | Set the program break. int brk(void *end_data);
Increases or decreases the program’s data space, ending at
| ||||||||||||
SYS_MMAP | Map files or devices into memory. void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
Maps a file or device into memory. This can be used for memory-mapped I/O or for sharing memory between processes.
| ||||||||||||
SYS_MUNMAP | Unmap a mapped memory region. int munmap(void *addr, size_t length);
Unmaps a previously mapped memory region, making the memory available for reuse.
| ||||||||||||
SYS_MPROTECT | Change memory protection. int mprotect(void *addr, size_t length, int prot);
Sets the protection on the memory region starting at
| ||||||||||||
SYS_MADVISE | Provide advice about memory usage. int madvise(void *addr, size_t length, int advice);
Provides advice to the kernel about the expected behavior of the memory region starting at
| ||||||||||||
SYS_PIPE | Create a pipe. int pipe(int pipefd[2]);
Creates a pipe, returning two file descriptors in
| ||||||||||||
SYS_DUP | Duplicate a file descriptor. int dup(int oldfd);
Duplicates the file descriptor
| ||||||||||||
SYS_DUP2 | Duplicate a file descriptor to a specific value. int dup2(int oldfd, int newfd);
Duplicates
| ||||||||||||
SYS_SOCKET | Create an endpoint for communication. int socket(int domain, int type, int protocol);
Creates an endpoint for communication, returning a socket file descriptor.
| ||||||||||||
SYS_BIND | Bind a socket to a local address. int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
Binds a socket to a local address so it can listen for incoming connections.
| ||||||||||||
SYS_CONNECT | Connect to a remote address. int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
Connects a socket to a remote address.
| ||||||||||||
SYS_LISTEN | Listen for incoming connections on a socket. int listen(int sockfd, int backlog);
Sets a socket to listen for incoming connections, specifying the backlog queue size.
| ||||||||||||
SYS_ACCEPT | Accept an incoming connection on a socket. int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
Accepts an incoming connection on a listening socket, creating a new socket for communication.
| ||||||||||||
SYS_SEND | Send data on a socket. ssize_t send(int sockfd, const void *buf, size_t len, int flags);
Sends data through a socket.
| ||||||||||||
SYS_RECV | Receive data on a socket. ssize_t recv(int sockfd, void *buf, size_t len, int flags);
Receives data from a socket.
| ||||||||||||
SYS_SHUTDOWN | Shut down part of a full-duplex connection. int shutdown(int sockfd, int how);
Shuts down part of a full-duplex connection on a socket.
| ||||||||||||
SYS_TIME | Get the current time. time_t time(time_t *t);
Retrieves the current calendar time as the number of seconds since the epoch.
| ||||||||||||
SYS_CLOCK_GETTIME | Get the current time of a specific clock. int clock_gettime(clockid_t clockid, struct timespec *tp);
Retrieves the current time for the specified clock (
| ||||||||||||
SYS_CLOCK_SETTIME | Set the current time of a specific clock. int clock_settime(clockid_t clockid, const struct timespec *tp);
Sets the time for the specified clock (
| ||||||||||||
SYS_NANOSLEEP | Sleep for a specified time. int nanosleep(const struct timespec *req, struct timespec *rem);
Suspends the execution of the calling thread for the specified time duration.
| ||||||||||||
SYS_GETCWD | Get the current working directory. char *getcwd(char *buf, size_t size);
Retrieves the current working directory.
| ||||||||||||
SYS_CHDIR | Change the current working directory. int chdir(const char *path);
Changes the current working directory to the specified
| ||||||||||||
SYS_MKDIR | Create a new directory. int mkdir(const char *path, mode_t mode);
Creates a new directory at
| ||||||||||||
SYS_RMDIR | Remove an empty directory. int rmdir(const char *path);
Removes the empty directory specified by
| ||||||||||||
SYS_UNLINK | Remove a file. int unlink(const char *pathname);
Removes the file specified by
| ||||||||||||
SYS_RENAME | Rename a file or directory. int rename(const char *oldpath, const char *newpath);
Renames a file or directory from
| ||||||||||||
SYS_UNAME | Get unix name information. int uname(struct kutsname *buf);
Retrieves information about the operating system.
| ||||||||||||
SYS_MAX | Max number of syscalls. This is used to determine the size of the syscalls_t syscalls[SYS_MAX];
|
Definition at line 651 of file syscalls.h.
Syscall wrapper with 0 arguments.
This wrapper is used to call syscalls with 0 arguments
syscall | syscalls_t |
Definition at line 64 of file syscalls.h.
References scarg.
Syscall wrapper with 1 argument.
This wrapper is used to call syscalls with 1 argument
syscall | syscalls_t |
arg1 | Argument 1 |
Definition at line 103 of file syscalls.h.
References scarg.
Syscall wrapper with 2 arguments.
This wrapper is used to call syscalls with 2 arguments
syscall | syscalls_t |
arg1 | Argument 1 |
arg2 | Argument 2 |
Definition at line 143 of file syscalls.h.
References scarg.
Syscall wrapper with 3 arguments.
This wrapper is used to call syscalls with 3 arguments
syscall | syscalls_t |
arg1 | Argument 1 |
arg2 | Argument 2 |
arg3 | Argument 3 |
Definition at line 186 of file syscalls.h.
References scarg.
|
inlinestatic |
Syscall wrapper with 4 arguments.
This wrapper is used to call syscalls with 4 arguments
syscall | syscalls_t |
arg1 | Argument 1 |
arg2 | Argument 2 |
arg3 | Argument 3 |
arg4 | Argument 4 |
Definition at line 232 of file syscalls.h.
References scarg.
|
inlinestatic |
Syscall wrapper with 5 arguments.
This wrapper is used to call syscalls with 5 arguments
syscall | syscalls_t |
arg1 | Argument 1 |
arg2 | Argument 2 |
arg3 | Argument 3 |
arg4 | Argument 4 |
arg5 | Argument 5 |
Definition at line 282 of file syscalls.h.
References scarg.
|
inlinestatic |
Syscall wrapper with 6 arguments.
This wrapper is used to call syscalls with 6 arguments
syscall | syscalls_t |
arg1 | Argument 1 |
arg2 | Argument 2 |
arg3 | Argument 3 |
arg4 | Argument 4 |
arg5 | Argument 5 |
arg6 | Argument 6 |
Definition at line 336 of file syscalls.h.
References scarg.