ArvernOS
|
#include <arpa/inet.h>
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
Functions | |
int | test (const char *s) |
ssize_t | write (int fd, const void *buf, size_t count) |
ssize_t | read (int fd, void *buf, size_t count) |
int | fstat (int fd, struct stat *statbuf) |
off_t | lseek (int fd, off_t offset, int whence) |
int | gettimeofday (struct timeval *p, void *z) |
int | open (const char *pathname, uint32_t flags) |
int | close (int fd) |
int | reboot (int command) |
int | socket (int domain, int type, int protocol) |
ssize_t | sendto (int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dst_addr, socklen_t addrlen) |
ssize_t | recvfrom (int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) |
int | gethostbyname2 (const char *name, struct in_addr *in) |
int | execv (const char *path, char *const argv[]) |
pid_t | getpid () |
void | exit (int code) |
int | openat (int dirfd, const char *pathname, int flags) |
int close | ( | int | fd | ) |
Implements the close syscall.
fd | a file descriptor ID |
int execv | ( | const char * | path, |
char *const | argv[] ) |
Implements the execv syscall.
path | the name of a file that is to be executed |
argv | a list of one or more pointers to null-terminated strings that represent the argument list available to the executed program |
void exit | ( | int | code | ) |
Implements the exit syscall.
code | the status code |
int fstat | ( | int | fd, |
struct stat * | statbuf ) |
Implements the fstat syscall.
fd | a file descriptor ID |
statbuf | a stat structure |
int gethostbyname2 | ( | const char * | name, |
struct in_addr * | in ) |
Implements the gethostbyname2 syscall. Most existing systems don't have such a syscall but we do and it performs a DNS lookup.
name | a hostname |
in | the receiving Internet address |
0
on success, a non-zero value otherwise pid_t getpid | ( | ) |
Implements the getpid syscall.
int gettimeofday | ( | struct timeval * | p, |
void * | z ) |
Implements the gettimeofday syscall.
off_t lseek | ( | int | fd, |
off_t | offset, | ||
int | whence ) |
Implements the lseek syscall.
fd | a file descriptor ID |
offset | the offset value |
whence | a directive to reposition the offset |
int open | ( | const char * | pathname, |
uint32_t | flags ) |
Implements the open syscall.
pathname | the name of the file to open |
flags | creation or file status flags |
int openat | ( | int | dirfd, |
const char * | pathname, | ||
int | flags ) |
Implements the openat syscall.
dirfd | a directory file descriptor |
pathname | the name of the file to open |
flags | creation or file status flags |
ssize_t read | ( | int | fd, |
void * | buf, | ||
size_t | count ) |
Implements the read syscall. read()
attempts to read up to count
bytes from file descriptor fd
into the buffer starting at buf
.
fd | a file descriptor ID |
buf | a buffer that receives the bytes read |
count | the maximum number of bytes to read |
int reboot | ( | int | command | ) |
Implements the reboot syscall.
command | a reboot command |
command
is REBOOT_CMD_RESTART
, it does not return. -1 is returned in case of an error, 0 otherwise. ssize_t recvfrom | ( | int | sockfd, |
void * | buf, | ||
size_t | len, | ||
int | flags, | ||
struct sockaddr * | src_addr, | ||
socklen_t * | addrlen ) |
Implements the recvfrom syscall.
sockfd | socket descriptor ID |
buf | the receiving buffer |
len | the size of the receiving buffer |
flags | some flags |
src_addr | the address of the sender |
addrlen | the size of the sender address structure |
ssize_t sendto | ( | int | sockfd, |
const void * | buf, | ||
size_t | len, | ||
int | flags, | ||
const struct sockaddr * | dst_addr, | ||
socklen_t | addrlen ) |
Implements the sendto syscall.
sockfd | socket descriptor ID |
buf | the data to send |
len | the length of the data to send |
flags | some flags |
dst_addr | the destination address |
addrlen | the size of the destination address structure |
int socket | ( | int | domain, |
int | type, | ||
int | protocol ) |
Implements the socket syscall.
domain | the communication domain (we only support AF_INET so far) |
type | the communication semantics (we only support SOCK_DGRAM so far) |
protocol | the particular protocol to be used with the socket |
int test | ( | const char * | s | ) |
Implements a syscall for testing purpose only. It takes a string as input and prints it to the screen.
s | a string to print on the screen |
42
ssize_t write | ( | int | fd, |
const void * | buf, | ||
size_t | count ) |
Implements the write syscall.
fd | a file descriptor ID |
buf | a buffer that contains the bytes to write |
count | the maximum number of bytes to write |