syscalls, libgloss, errno

Vincent Rivière vincent.riviere@freesbee.fr
Tue Jan 1 20:20:00 GMT 2008


Happy New Year 2008 !

I have spent some time studying the Newlib sources, especially the way 
how reentrant syscalls are implemented.

I still can't understand some things.

 From a user program linked against newlib and libgloss, is it possible 
to call the syscalls (open, close, etc.) and to get the errors in the 
standard way, by including <errno.h> and using errno ?

Is it possible with the current implementation of libnosys ?

I imagine that it would be possible to define 
REENTRANT_SYSCALLS_PROVIDED, implement the _syscalls_r in libgloss, 
implement the _syscalls too (by calling the _r versions). Then the 
syscalls (without _) will be automatically implemented by libc/syscalls/*
Thus the global variable errno will never be used, and everything will 
be OK.

In other words: is there a simple way to implement the syscalls (in 
whatever form) in order to be able to call open() and fopen() and to get 
the error values from errno, by simply including <errno.h> ?

And another question: when porting Newlib to a new target (in 2008 !), 
is it best to put everything (syscalls needed by Newlib, and all the 
others) into libgloss, or in libc/sys ?

Regards,

-- 
Vincent Rivière



More information about the Newlib mailing list