libdragon
|
newlib Interface Hooks More...
#include <_ansi.h>
#include <_syslist.h>
#include <limits.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/times.h>
#include <stdint.h>
#include <malloc.h>
#include "system.h"
Data Structures | |
struct | fs_mapping_t |
Filesystem mapping structure. More... | |
struct | fs_handle_t |
Filesystem open handle structure. More... | |
Defines | |
#define | STACK_SIZE 0x10000 |
Stack size. | |
#define | DEBUG_OUT(x) ((uint32_t *)0xA4400044)[0] = ((uint32_t)(x)) |
Write to the MESS debug register. | |
STDIN/STDOUT/STDERR definitions from unistd.h | |
We can't just include unistd.h as it redefines several of the functions here that we are attempting to replace. | |
#define | STDIN_FILENO 0 |
Standard input file descriptor. | |
#define | STDOUT_FILENO 1 |
Standard output file descriptor. | |
#define | STDERR_FILENO 2 |
Standard error file descriptor. | |
Functions | |
void | enable_interrupts () |
Enable interrupts systemwide. | |
void | disable_interrupts () |
Disable interrupts systemwide. | |
int | close (int fildes) |
Close a file. | |
static int | __strlen (const char *const str) |
Simple implementation of strlen. | |
static void | __memcpy (char *const a, const char *const b, int len) |
Simple implementation of memcpy. | |
static char * | __strdup (const char *const in) |
Simple implementation of strdup. | |
static int | __strncmp (const char *const a, const char *const b, int len) |
Simple iplementation of strncmp. | |
static int | __strcmp (const char *const a, const char *const b) |
Simple implementation of strcmp. | |
static int | __get_new_handle () |
Return a unique filesystem handle. | |
int | attach_filesystem (const char *const prefix, filesystem_t *filesystem) |
Register a filesystem with newlib. | |
int | detach_filesystem (const char *const prefix) |
Unregister a filesystem from newlib. | |
static filesystem_t * | __get_fs_pointer_by_handle (int fileno) |
Get a filesystem pointer by handle. | |
static int | __get_fs_link_by_name (const char *const name) |
Get the index of the registered filesystem based on fully qualified filename. | |
static filesystem_t * | __get_fs_pointer_by_name (const char *const name) |
Get the filesystem callback structure based on a fully qualified filename. | |
static void * | __get_fs_handle (int fileno) |
Look up the internal handle of a file given a file handle. | |
int | chown (const char *path, uid_t owner, gid_t group) |
Change ownership on a file or directory. | |
int | execve (char *name, char **argv, char **env) |
Load and execute an executable given a path. | |
void | exit (int rc) |
End execution on current thread. | |
int | fork (void) |
Fork execution into two threads. | |
int | fstat (int fildes, struct stat *st) |
Return stats on an open file handle. | |
int | getpid (void) |
Return the PID of the current thread. | |
int | gettimeofday (struct timeval *ptimeval, void *ptimezone) |
Return the current time. | |
int | isatty (int file) |
Return whether a file is a TTY or a regular file. | |
int | kill (int pid, int sig) |
Send a signal to a PID. | |
int | link (char *existing, char *new) |
Link a new file to an existing file. | |
int | lseek (int file, int ptr, int dir) |
Seek to a location in a file. | |
int | open (char *file, int flags, int mode) |
Open a file given a path. | |
int | read (int file, char *ptr, int len) |
Read data from a file. | |
int | readlink (const char *path, char *buf, size_t bufsize) |
Read a link. | |
void * | sbrk (int incr) |
Return a new chunk of memory to be used as heap. | |
int | stat (const char *file, struct stat *st) |
Return file stats based on a file name. | |
int | symlink (const char *path1, const char *path2) |
Create a symbolic link to a file. | |
clock_t | times (struct tms *buf) |
Return time information on the current process. | |
int | unlink (char *name) |
Remove a file based on filename. | |
int | wait (int *status) |
Wait for a child process. | |
int | write (int file, char *ptr, int len) |
Write data to a file. | |
int | dir_findfirst (const char *const path, dir_t *dir) |
Find the first file in a directory. | |
int | dir_findnext (const char *const path, dir_t *dir) |
Find the next file in a directory. | |
int | hook_stdio_calls (stdio_t *stdio_calls) |
Hook into stdio for STDIN, STDOUT and STDERR callbacks. | |
int | unhook_stdio_calls () |
Unhook from stdio. | |
Variables | |
char * | __env [1] = { 0 } |
Environment variables. | |
char ** | environ = __env |
Environment variables. | |
int | errno |
Master definition of errno. | |
int | __bootcic |
Boot CIC. | |
static fs_mapping_t | filesystems [MAX_FILESYSTEMS] = { { 0 } } |
Array of filesystems registered. | |
static fs_handle_t | handles [MAX_OPEN_HANDLES] = { { 0 } } |
Array of open handles tracked. | |
static stdio_t | stdio_hooks = { 0 } |
Current stdio hook structure. |
newlib Interface Hooks