Main Page   Modules   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

LIBC interface


Files

file  close.c
file  confdefs.h
file  cubereent.c
file  cubereent.h
file  fstat.c
file  getpid.c
file  glue.h
file  isatty.c
file  kill.c
file  kio.c
file  kio.h
file  lseek.c
file  open.c
file  print.c
file  read.c
file  stat.c
file  syscall.h
file  unlink.c
file  write.c

Functions

int close (int fd)
 closes a file descriptor. More...

void _LIBC_init_reent (struct _reent *ptr)
 prepares a newlib reentrancy structure fo use. More...

int getpid ()
 returns the current process ID. More...

int isatty (int fd)
 returns 1 if connected to a terminal device, returns 0 if not. More...

int kill (int pid, int sig)
 kill - Sends a signal to a thread. More...

char _LIBC_inbyte ()
 glue function between libc and TTY. More...

void _LIBC_outbyte (char c)
 glue function between libc and TTY. More...

void LIBC_outstring (char *str)
 glue function between libc and TTY. More...

void _exit (int status)
 glue function between libc and TTY. More...

off_t lseek (int fd, off_t offset, int whence)
 Since a serial port is non-seekable, we return an error. More...

void print (char *ptr)
 do a raw print of a string. More...

void putnum (unsigned int num)
 print a 32 bit number in hex. More...

int read (int fd, char *buf, int nbytes)
 read bytes from the serial port. Ignore fd, since we only have stdin. More...

char * sbrk (int nbytes)
 changes heap size size. Get nbytes more RAM. More...

int stat (const char *path, struct stat *buf)
 Since we have no file system, we just return an error. More...

int unlink (char *path)
 unlink -- since we have no file system, we just return an error. More...

int write (int fd, char *buf, int nbytes)
 write bytes to the serial port. More...


Detailed Description

This is the interface between the newlib libc and cubeOS

Function Documentation

void _exit int    status
 

glue function between libc and TTY.

Definition at line 73 of file kio.c.

char _LIBC_inbyte   [inline]
 

glue function between libc and TTY.

Definition at line 40 of file kio.c.

References TTY_inchar.

Referenced by getpacket, putpacket, and read.

void _LIBC_init_reent struct _reent *    ptr
 

prepares a newlib reentrancy structure fo use.

Parameters:
ptr  is a pointer to a newlib reentrancy structure

Definition at line 32 of file cubereent.c.

void _LIBC_outbyte char    c [inline]
 

glue function between libc and TTY.

Definition at line 49 of file kio.c.

References TTY_outchar.

int close int    fd
 

closes a file descriptor.

Parameters:
a  file descriptor
This is an interface function for the newlib and does nothing.

Definition at line 42 of file close.c.

int getpid  
 

returns the current process ID.

Definition at line 40 of file getpid.c.

int isatty int    fd
 

returns 1 if connected to a terminal device, returns 0 if not.

Parameters:
fd  is a file descriptor
Since we're hooked up to a serial port, we'll say yes _AND return a 1.

Definition at line 42 of file isatty.c.

int kill int    pid,
int    sig
 

kill - Sends a signal to a thread.

Parameters:
pid  is the thread id
sig  is the signal to be send
Todo:
maybe this should also do a KERN_wakeup()

Definition at line 34 of file kill.c.

References MAX_PROCESSNUM, and STATE_EMPTY.

void LIBC_outstring char *    str
 

glue function between libc and TTY.

Definition at line 58 of file kio.c.

References TTY_outchar.

off_t lseek int    fd,
off_t    offset,
int    whence
 

Since a serial port is non-seekable, we return an error.

Definition at line 41 of file lseek.c.

void print char *    ptr
 

do a raw print of a string.

This is not used in the libc, but it's included here anyway.

Definition at line 43 of file print.c.

References _LIBC_outbyte.

void putnum unsigned int    num
 

print a 32 bit number in hex.

Parameters:
num  is the number to be printed out.

Definition at line 42 of file putnum.c.

int read int    fd,
char *    buf,
int    nbytes
 

read bytes from the serial port. Ignore fd, since we only have stdin.

Definition at line 40 of file read.c.

References _LIBC_inbyte.

char* sbrk int    nbytes
 

changes heap size size. Get nbytes more RAM.

We just increment a pointer in what's left of memory on the board.

Todo:
this prevents memory to be freed upon reset since the pointer is still in the pre-reset condition. Also the memory management relies on the ld file upon compile time, we should better discover the memory on our own or at least rely on the newer bootmon's memory sizer.

Definition at line 57 of file sbrk.c.

References _end, heap_ptr, and RAMSIZE.

int stat const char *    path,
struct stat *    buf
 

Since we have no file system, we just return an error.

Definition at line 41 of file stat.c.

References stat.

Referenced by fstat, and stat.

int unlink char *    path
 

unlink -- since we have no file system, we just return an error.

Definition at line 40 of file unlink.c.

int write int    fd,
char *    buf,
int    nbytes
 

write bytes to the serial port.

Ignore fd, since stdout and stderr are the same. Since we have no filesystem, open will only return an error.

Definition at line 43 of file write.c.

References _LIBC_outbyte.


Generated on Thu Feb 20 15:39:02 2003 for cubeOS by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002