Stdio redirection?

J. Johnston jjohnstn@cygnus.com
Tue Oct 3 09:54:00 GMT 2000


"Russ.Shaw" wrote:
> 
> Hi,
> 
> Thanks, that's the same as in the manual i've got.
> 
> Those instructions list a bunch of functions such
> as read(), write(), sbrk() etc, but doesn't say
> where to put these functions, how they overide
> the existing ones, whether they should be
> included in a rebuild of newlib etc.
> 
> Aklilu Noah wrote:
> >
> > See
> > http://www.objsw.com/docs/libc_131.html#SEC131
> 
> --
> *******************************************
> *   Russell Shaw, B.Eng, M.Eng(Research)  *
> *      email: russell@webaxs.net          *
> *      Victoria, Australia                *
> *******************************************

Russ,

  The following is taken from libc/include/reent.h.  Where it refers to
changes in configure.in, change that to be configure.host.
Whether you want to place all your routines in an archive or not
is your choice.  Either way, you must specify additional arguments on the link to let the
linker know where these additional routines are located.

/* The reentrant system calls here serve two purposes:

   1) Provide reentrant versions of the system calls the ANSI C library
      requires.
   2) Provide these system calls in a namespace clean way.

   It is intended that *all* system calls that the ANSI C library needs
   be declared here.  It documents them all in one place.  All library access
   to the system is via some form of these functions.

   There are three ways a target may provide the needed syscalls.

   1) Define the reentrant versions of the syscalls directly.
      (eg: _open_r, _close_r, etc.).  Please keep the namespace clean.
      When you do this, set "syscall_dir" to "syscalls" in configure.in,
      and add -DREENTRANT_SYSCALLS_PROVIDED to target_cflags in configure.in.

   2) Define namespace clean versions of the system calls by prefixing
      them with '_' (eg: _open, _close, etc.).  Technically, there won't be
      true reentrancy at the syscall level, but the library will be namespace
      clean.
      When you do this, set "syscall_dir" to "syscalls" in configure.in.

   3) Define or otherwise provide the regular versions of the syscalls
      (eg: open, close, etc.).  The library won't be reentrant nor namespace
      clean, but at least it will work.
      When you do this, add -DMISSING_SYSCALL_NAMES to target_cflags in
      configure.in.

   Stubs of the reentrant versions of the syscalls exist in the libc/reent
   source directory and are used if REENTRANT_SYSCALLS_PROVIDED isn't defined.
   They use the native system calls: _open, _close, etc. if they're available
   (MISSING_SYSCALL_NAMES is *not* defined), otherwise open, close, etc.
   (MISSING_SYSCALL_NAMES *is* defined).  */

 
-- Jeff Johnston (Red Hat Inc.)

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com



More information about the crossgcc mailing list