The SAFEIO subsystem
Safeio is a library of low level system-level cover functions which
should be used instead of the standard ones.
Functions:
- void s_sleep(int timeout)
- Sleep for a number of seconds.
- void *s_malloc(size_t size)
- Allocate and clear (zero-fill) a block of memory.
Aborts the process in case of failures.
- void *s_realloc(void *ptr, size_t size)
- Reallocate a previously allocated block of memory. If the block
is extended, the extra data is cleared (zerofilled).
Aborts the process in case of failures.
- void s_free(void *ptr)
- Free a previously allocated block of memory.
Aborts the process in case of failures.
- void s_abort(void)
- Abort the current process in such a way that a debugger will stay inside
the thread that called it.
- char *s_strdup(const char *str)
- Duplicate a string.
- int s_open(const char *path, int oflag, mode_t mode)
- Open a file system object.
- int s_close(int fd)
- Close a descriptor.
- int s_shutdown(int fd, int how)
- Shutdown a descriptor.
- int s_connect(int fd, struct sockaddr *sin, int len)
- Connect a socket to a remote endpoint.
- int s_accept(int fd, struct sockaddr *sin, int *lenp)
- Accept an incoming TCP/IP connection on a socket.
- int s_ioctl(int fd, int what, void *ptr)
- Perform an ioctl call.
- int s_select(int nfd, fd_set *rs, fd_set *ws, fd_set *es, struct timeval *tv)
- Wait for I/O events.
- int s_read(int fd, char *buf, int len)
- Read bytes from a descriptor.
- int s_write(int fd, const char *buf, int len)
- Write bytes to a descriptor.
- int s_chdir(const char *path)
- Change current directory.
- int s_dup2(int fd1, int fd2)
- Duplicate a file descriptor.
- pid_t s_waitpid(pid_t pid, int *status, int options)
- Wait for a process status to change.
- int s_execve(const char *path, char *const argv[], char *const envp[])
- Execute a new process.
- DIR *s_opendir(const char *path)
- Open a directory for reading.
- int s_closedir(DIR *dirp)
- Close a directory.
- struct dirent *s_readdir_r(DIR *dirp, struct dirent *res)
- Read the directory contents.
- struct hostent *s_gethostbyaddr_r(const char *addr,
int length,
int type,
struct hostent *result,
char *buffer,
int buflen,
int *h_errnop)
-
- struct hostent *s_gethostbyname_r(const char *name,
struct hostent *result,
char *buffer,
int buflen,
int *h_errnop)
-
- struct passwd *s_getpwnam_r(const char *name,
struct passwd *res,
char *buf,
int buflen)
-
- struct passwd *s_getpwuid_r(int uid,
struct passwd *res,
char *buf,
int buflen)
-
- struct group *s_getgrnam_r(const char *name,
struct group *res,
char *buf,
int buflen)
-
- int s_readlink(const char *path, char *buf, int buflen)
- Read a symbolic link pointer.
- int s_stat(const char *path, struct stat *buf)
- Get file system object status.
- int s_lstat(const char *path, struct stat *buf)
- Get file system object status (don't follow links).
-
-