libdragon
Data Structures | Macros | Functions | Variables
system.c File Reference

newlib Interface Hooks More...

Data Structures

struct  fs_mapping_t
 Filesystem mapping structure. More...
 
struct  fs_handle_t
 Filesystem open handle structure. More...
 

Macros

#define STACK_SIZE   0x10000
 Stack size. More...
 
#define DEBUG_OUT(x)   ((uint32_t *)0xA4400044)[0] = ((uint32_t)(x))
 Write to the MESS debug register. More...
 
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. More...
 
void disable_interrupts ()
 Disable interrupts systemwide. More...
 
int close (int fildes)
 Close a file. More...
 
int attach_filesystem (const char *const prefix, filesystem_t *filesystem)
 Register a filesystem with newlib. More...
 
int detach_filesystem (const char *const prefix)
 Unregister a filesystem from newlib. More...
 
int chown (const char *path, uid_t owner, gid_t group)
 Change ownership on a file or directory. More...
 
int execve (char *name, char **argv, char **env)
 Load and execute an executable given a path. More...
 
void _exit (int rc)
 End execution on current thread. More...
 
int fork (void)
 Fork execution into two threads. More...
 
int fstat (int fildes, struct stat *st)
 Return stats on an open file handle. More...
 
int getpid (void)
 Return the PID of the current thread. More...
 
int gettimeofday (struct timeval *ptimeval, void *ptimezone)
 Return the current time. More...
 
int isatty (int file)
 Return whether a file is a TTY or a regular file. More...
 
int kill (int pid, int sig)
 Send a signal to a PID. More...
 
int link (char *existing, char *new)
 Link a new file to an existing file. More...
 
int lseek (int file, int ptr, int dir)
 Seek to a location in a file. More...
 
int open (const char *file, int flags,...)
 Open a file given a path. More...
 
int read (int file, char *ptr, int len)
 Read data from a file. More...
 
int readlink (const char *path, char *buf, size_t bufsize)
 Read a link. More...
 
void * sbrk (int incr)
 Return a new chunk of memory to be used as heap. More...
 
int stat (const char *file, struct stat *st)
 Return file stats based on a file name. More...
 
int symlink (const char *path1, const char *path2)
 Create a symbolic link to a file. More...
 
clock_t times (struct tms *buf)
 Return time information on the current process. More...
 
int unlink (char *name)
 Remove a file based on filename. More...
 
int wait (int *status)
 Wait for a child process. More...
 
int write (int file, char *ptr, int len)
 Write data to a file. More...
 
int dir_findfirst (const char *const path, dir_t *dir)
 Find the first file in a directory. More...
 
int dir_findnext (const char *const path, dir_t *dir)
 Find the next file in a directory. More...
 
int hook_stdio_calls (stdio_t *stdio_calls)
 Hook into stdio for STDIN, STDOUT and STDERR callbacks. More...
 
int unhook_stdio_calls (stdio_t *stdio_calls)
 Unhook from stdio. More...
 
int hook_time_call (time_t(*time_fn)(void))
 Hook into gettimeofday with a current time callback. More...
 
int unhook_time_call (time_t(*time_fn)(void))
 Unhook from gettimeofday current time callback. More...
 
void _flush_cache (uint8_t *addr, unsigned long bytes)
 Implement _flush_cache as required by GCC for nested functions. More...
 
void __assert_func (const char *file, int line, const char *func, const char *failedexpr)
 Implement underlying function for assert() More...
 

Variables

char * __env [1] = { 0 }
 Environment variables.
 
void(* __assert_func_ptr )(const char *file, int line, const char *func, const char *failedexpr)=0
 Assert function pointer (initialized at startup)
 
int __bootcic
 Boot CIC. More...
 
time_t(* time_hook )(void) = NULL
 Function to provide the current time.
 

Detailed Description

newlib Interface Hooks