LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
Macros | Functions | Variables
newlib.c File Reference
#include <_ansi.h>
#include <_syslist.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include <sys/iosupport.h>
#include <sys/dirent.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/unistd.h>
#include <diskio/disc_io.h>
#include <xenon_soc/xenon_power.h>
#include <debug.h>
Include dependency graph for newlib.c:

Go to the source code of this file.

Macros

#define ROOT_UID   0
 
#define ROOT_GID   0
 
#define MAX_HANDLES   1024
 
#define DIRECTORY_SEPARATOR_CHAR   '/'
 

Functions

ssize_t vfs_console_write (struct _reent *r, int fd, const char *src, size_t len)
 
int __libc_lock_init (int *lock, int recursive)
 
int __libc_lock_close (int *lock)
 
int __libc_lock_release (int *lock)
 
int __libc_lock_acquire (int *lock)
 
void __malloc_lock (struct _reent *ptr)
 
void __malloc_unlock (struct _reent *ptr)
 
void _exit (int status)
 
void * sbrk (ptrdiff_t incr)
 
void abort (void)
 
void * dlopen (const char *c, int i)
 
void * dlsym (void *p, const char *s)
 
int dlclose (void *p)
 
char * dlerror (void)
 
FILE * popen (const char *s1, const char *s2)
 
int pclose (FILE *f)
 
int execve (const char *path, char *const argv[], char *const envp[])
 
int execv (const char *path, char *const argv[])
 
int execvp (const char *file, char *const argv[])
 
int fork ()
 
int getpid ()
 
pid_t waitpid (pid_t pid, int *stat_loc, int options)
 
int mkfifo (const char *pathname, mode_t mode)
 
int lstat (const char *path, struct stat *buf)
 
int access (const char *path, int mode)
 
int getrusage (int who, struct rusage *usage)
 
int gettimeofday (struct timeval *ptimeval, void *ptimezone)
 
int isatty (int file)
 
int kill (int pid, int sig)
 
int gethostname (char *name, size_t len)
 
uid_t getuid (void)
 
uid_t geteuid (void)
 
gid_t getgid (void)
 
gid_t getegid (void)
 
int setuid (uid_t uid)
 
int setgid (gid_t gid)
 
pid_t getppid (void)
 
void * getpwuid (uid_t uid)
 
void * getpwnam (const char *name)
 
void * getgrnam (const char *name)
 
void * getgrgid (gid_t gid)
 
 __attribute__ ((unused))
 
int __alloc_handle (int size)
 
__handle__get_handle (int fd)
 
void setDefaultDevice (int device)
 
int FindDevice (const char *name)
 
int RemoveDevice (const char *name)
 
int AddDevice (const devoptab_t *device)
 
const devoptab_tGetDeviceOpTab (const char *name)
 
int open (const char *file, int flags, int mode)
 
int read (int fileDesc, void *ptr, size_t len)
 
int write (int fileDesc, const void *ptr, size_t len)
 
int fstat (int fileDesc, struct stat *st)
 
int stat (const char *file, struct stat *st)
 
int statvfs (const char *path, struct statvfs *buf)
 
int fsync (int fileDesc)
 
int ftruncate (int fileDesc, off_t len)
 
int link (const char *existing, const char *new)
 
_off_t lseek (int fileDesc, _off_t pos, int dir)
 
int rename (const char *existing, const char *newName)
 
int unlink (const char *name)
 
int close (int fileDesc)
 
int _concatenate_path (struct _reent *r, char *path, const char *extra, int maxLength)
 
int chdir (const char *path)
 
char * getcwd (char *buf, size_t size)
 
int chmod (const char *path, mode_t mode)
 
int fchmod (int fd, mode_t mode)
 
DIRopendir (const char *dirname)
 
int closedir (DIR *dirp)
 
struct direntreaddir (DIR *dirp)
 
void rewinddir (DIR *dirp)
 
void seekdir (DIR *dirp, long int loc)
 
long int telldir (DIR *dirp)
 
int fcntl (int filedes, int cmd,...)
 
int mkdir (const char *path, mode_t mode)
 
int bdev_enum (int handle, const char **name)
 

Variables

void(* stdout_hook )(const char *text, int len)=0
 
void(* stdlog_hook )(const char *text, int len)=0
 
const devoptab_t console_optab
 
const devoptab_t dotab_stdnull
 
const devoptab_tdevoptab_list [STD_MAX]
 
const char DIRECTORY_SEPARATOR [] = "/"
 
const char DIRECTORY_THIS [] = "."
 
const char DIRECTORY_PARENT [] = ".."
 

Macro Definition Documentation

◆ DIRECTORY_SEPARATOR_CHAR

#define DIRECTORY_SEPARATOR_CHAR   '/'

Definition at line 859 of file newlib.c.

◆ MAX_HANDLES

#define MAX_HANDLES   1024

HANDLES

Definition at line 344 of file newlib.c.

◆ ROOT_GID

#define ROOT_GID   0

Definition at line 289 of file newlib.c.

◆ ROOT_UID

#define ROOT_UID   0

User etc ..

Definition at line 288 of file newlib.c.

Function Documentation

◆ __alloc_handle()

int __alloc_handle ( int  size)

Definition at line 362 of file newlib.c.

◆ __attribute__()

__attribute__ ( (unused)  )

Definition at line 347 of file newlib.c.

◆ __get_handle()

__handle * __get_handle ( int  fd)

Definition at line 380 of file newlib.c.

◆ __libc_lock_acquire()

int __libc_lock_acquire ( int *  lock)

Definition at line 93 of file newlib.c.

◆ __libc_lock_close()

int __libc_lock_close ( int *  lock)

Definition at line 75 of file newlib.c.

◆ __libc_lock_init()

int __libc_lock_init ( int *  lock,
int  recursive 
)

Definition at line 66 of file newlib.c.

◆ __libc_lock_release()

int __libc_lock_release ( int *  lock)

Definition at line 84 of file newlib.c.

◆ __malloc_lock()

void __malloc_lock ( struct _reent *  ptr)

Definition at line 102 of file newlib.c.

◆ __malloc_unlock()

void __malloc_unlock ( struct _reent *  ptr)

Definition at line 109 of file newlib.c.

◆ _concatenate_path()

int _concatenate_path ( struct _reent *  r,
char *  path,
const char *  extra,
int  maxLength 
)

Definition at line 864 of file newlib.c.

◆ _exit()

void _exit ( int  status)

Definition at line 116 of file newlib.c.

◆ abort()

void abort ( void  )

Definition at line 136 of file newlib.c.

◆ access()

int access ( const char *  path,
int  mode 
)

Definition at line 217 of file newlib.c.

◆ AddDevice()

int AddDevice ( const devoptab_t device)

Definition at line 482 of file newlib.c.

◆ bdev_enum()

int bdev_enum ( int  handle,
const char **  name 
)

Definition at line 1278 of file newlib.c.

◆ chdir()

int chdir ( const char *  path)

Definition at line 952 of file newlib.c.

◆ chmod()

int chmod ( const char *  path,
mode_t  mode 
)

Definition at line 1025 of file newlib.c.

◆ close()

int close ( int  fileDesc)

Definition at line 829 of file newlib.c.

◆ closedir()

int closedir ( DIR dirp)

Definition at line 1169 of file newlib.c.

◆ dlclose()

int dlclose ( void *  p)

Definition at line 150 of file newlib.c.

◆ dlerror()

char * dlerror ( void  )

Definition at line 154 of file newlib.c.

◆ dlopen()

void * dlopen ( const char *  c,
int  i 
)

Definition at line 142 of file newlib.c.

◆ dlsym()

void * dlsym ( void *  p,
const char *  s 
)

Definition at line 146 of file newlib.c.

◆ execv()

int execv ( const char *  path,
char *const  argv[] 
)

Definition at line 176 of file newlib.c.

◆ execve()

int execve ( const char *  path,
char *const  argv[],
char *const  envp[] 
)

Definition at line 170 of file newlib.c.

◆ execvp()

int execvp ( const char *  file,
char *const  argv[] 
)

Definition at line 180 of file newlib.c.

◆ fchmod()

int fchmod ( int  fd,
mode_t  mode 
)

Definition at line 1042 of file newlib.c.

◆ fcntl()

int fcntl ( int  filedes,
int  cmd,
  ... 
)

Definition at line 1259 of file newlib.c.

◆ FindDevice()

int FindDevice ( const char *  name)

Definition at line 443 of file newlib.c.

◆ fork()

int fork ( )

Definition at line 186 of file newlib.c.

◆ fstat()

int fstat ( int  fileDesc,
struct stat st 
)

Definition at line 614 of file newlib.c.

◆ fsync()

int fsync ( int  fileDesc)

Definition at line 678 of file newlib.c.

◆ ftruncate()

int ftruncate ( int  fileDesc,
off_t  len 
)

Definition at line 705 of file newlib.c.

◆ getcwd()

char * getcwd ( char *  buf,
size_t  size 
)

Definition at line 1006 of file newlib.c.

◆ GetDeviceOpTab()

const devoptab_t * GetDeviceOpTab ( const char *  name)

Definition at line 506 of file newlib.c.

◆ getegid()

gid_t getegid ( void  )

Definition at line 303 of file newlib.c.

◆ geteuid()

uid_t geteuid ( void  )

Definition at line 295 of file newlib.c.

◆ getgid()

gid_t getgid ( void  )

Definition at line 299 of file newlib.c.

◆ getgrgid()

void * getgrgid ( gid_t  gid)

Definition at line 334 of file newlib.c.

◆ getgrnam()

void * getgrnam ( const char *  name)

Definition at line 329 of file newlib.c.

◆ gethostname()

int gethostname ( char *  name,
size_t  len 
)

Definition at line 269 of file newlib.c.

◆ getpid()

int getpid ( )

Definition at line 193 of file newlib.c.

◆ getppid()

pid_t getppid ( void  )

Definition at line 315 of file newlib.c.

◆ getpwnam()

void * getpwnam ( const char *  name)

Definition at line 324 of file newlib.c.

◆ getpwuid()

void * getpwuid ( uid_t  uid)

Definition at line 319 of file newlib.c.

◆ getrusage()

int getrusage ( int  who,
struct rusage *  usage 
)

Definition at line 242 of file newlib.c.

◆ gettimeofday()

int gettimeofday ( struct timeval *  ptimeval,
void *  ptimezone 
)

Definition at line 248 of file newlib.c.

◆ getuid()

uid_t getuid ( void  )

Definition at line 291 of file newlib.c.

◆ isatty()

int isatty ( int  file)

Definition at line 259 of file newlib.c.

◆ kill()

int kill ( int  pid,
int  sig 
)

Definition at line 263 of file newlib.c.

◆ link()

int link ( const char *  existing,
const char *  new 
)

Definition at line 732 of file newlib.c.

◆ lseek()

_off_t lseek ( int  fileDesc,
_off_t  pos,
int  dir 
)

Definition at line 756 of file newlib.c.

◆ lstat()

int lstat ( const char *  path,
struct stat buf 
)

Definition at line 211 of file newlib.c.

◆ mkdir()

int mkdir ( const char *  path,
mode_t  mode 
)

Definition at line 1263 of file newlib.c.

◆ mkfifo()

int mkfifo ( const char *  pathname,
mode_t  mode 
)

Definition at line 205 of file newlib.c.

◆ open()

int open ( const char *  file,
int  flags,
int  mode 
)

File IO

Definition at line 522 of file newlib.c.

◆ opendir()

DIR * opendir ( const char *  dirname)

Definition at line 1149 of file newlib.c.

◆ pclose()

int pclose ( FILE *  f)

Definition at line 164 of file newlib.c.

◆ popen()

FILE * popen ( const char *  s1,
const char *  s2 
)

Definition at line 160 of file newlib.c.

◆ read()

int read ( int  fileDesc,
void *  ptr,
size_t  len 
)

Definition at line 559 of file newlib.c.

◆ readdir()

struct dirent * readdir ( DIR dirp)

Definition at line 1182 of file newlib.c.

◆ RemoveDevice()

int RemoveDevice ( const char *  name)

Definition at line 467 of file newlib.c.

◆ rename()

int rename ( const char *  existing,
const char *  newName 
)

Definition at line 787 of file newlib.c.

◆ rewinddir()

void rewinddir ( DIR dirp)

Definition at line 1221 of file newlib.c.

◆ sbrk()

void * sbrk ( ptrdiff_t  incr)

Definition at line 124 of file newlib.c.

◆ seekdir()

void seekdir ( DIR dirp,
long int  loc 
)

Definition at line 1230 of file newlib.c.

◆ setDefaultDevice()

void setDefaultDevice ( int  device)

Definition at line 396 of file newlib.c.

◆ setgid()

int setgid ( gid_t  gid)

Definition at line 311 of file newlib.c.

◆ setuid()

int setuid ( uid_t  uid)

Definition at line 307 of file newlib.c.

◆ stat()

int stat ( const char *  file,
struct stat *  st 
)

Definition at line 643 of file newlib.c.

◆ statvfs()

int statvfs ( const char *  path,
struct statvfs buf 
)

Definition at line 659 of file newlib.c.

◆ telldir()

long int telldir ( DIR dirp)

Definition at line 1251 of file newlib.c.

◆ unlink()

int unlink ( const char *  name)

Definition at line 811 of file newlib.c.

◆ vfs_console_write()

ssize_t vfs_console_write ( struct _reent *  r,
int  fd,
const char *  src,
size_t  len 
)

Fake vfs

Definition at line 25 of file newlib.c.

◆ waitpid()

pid_t waitpid ( pid_t  pid,
int *  stat_loc,
int  options 
)

Definition at line 199 of file newlib.c.

◆ write()

int write ( int  fileDesc,
const void *  ptr,
size_t  len 
)

Definition at line 584 of file newlib.c.

Variable Documentation

◆ console_optab

const devoptab_t console_optab
Initial value:
= {
"stdout",
0,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
}
#define NULL
Definition: def.h:47
ssize_t vfs_console_write(struct _reent *r, int fd, const char *src, size_t len)
Definition: newlib.c:25

Definition at line 36 of file newlib.c.

◆ devoptab_list

const devoptab_t* devoptab_list[STD_MAX]
Initial value:

Definition at line 432 of file newlib.c.

◆ DIRECTORY_PARENT

const char DIRECTORY_PARENT[] = ".."

Definition at line 862 of file newlib.c.

◆ DIRECTORY_SEPARATOR

const char DIRECTORY_SEPARATOR[] = "/"

Definition at line 860 of file newlib.c.

◆ DIRECTORY_THIS

const char DIRECTORY_THIS[] = "."

Definition at line 861 of file newlib.c.

◆ dotab_stdnull

const devoptab_t dotab_stdnull
Initial value:
= {
"stdnull",
0,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
}

Definition at line 404 of file newlib.c.

◆ stdlog_hook

void(* stdlog_hook) (const char *text, int len)=0 ( const char *  text,
int  len 
)

Definition at line 20 of file newlib.c.

◆ stdout_hook

void(* stdout_hook) (const char *text, int len)=0 ( const char *  text,
int  len 
)

Definition at line 19 of file newlib.c.