Data Structures | Defines | Functions | Variables

system.c File Reference

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...


#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.


void enable_interrupts ()
 Enable interrupts systemwide.
void disable_interrupts ()
 Disable interrupts systemwide.
int close (int fildes)
 Close a file.
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.
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.


char * __env [1] = { 0 }
 Environment variables.
char ** environ = __env
 Environment variables.
int errno
 Master definition of errno.
int __bootcic
 Boot CIC.

Detailed Description

newlib Interface Hooks

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines