This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: False syscall dependencies [PATCH]
- From: Shaun Jackman <sjackman at gmail dot com>
- To: newlib at sources dot redhat dot com
- Date: Fri, 17 Feb 2006 11:36:48 -0700
- Subject: Re: False syscall dependencies [PATCH]
- References: <7f45d9390512150911p70c20e6fu@mail.gmail.com>
- Reply-to: Shaun Jackman <sjackman at gmail dot com>
Ping! Can this patch be checked in?
Cheers,
Shaun
On 2005-12-15, Shaun Jackman <sjackman@gmail.com> wrote:
> This patch factors out the portion of __sinit that depends on syscalls
> into its own source file, sinit.c. The portion of __sinit that does
> not depend on syscalls is left in findfp.c in the function
> __sinitnostd. This factorization allows the developer compiling newlib
> to modify CHECK_INIT to call __sinitnostd instead of __sinit. The next
> step would be to create a new macro, CHECK_INIT_NOSTD, and modify the
> functions that do not require the standard streams to be initialized
> to call CHECK_INIT_NOSTD instead of CHECK_INIT.
>
> makebuf uses stat to set the buffering to line mode if the stream is a
> teletype. In the existing __sinit, this code is armoured in an #ifdef
> HAVE_FCNTL. I did the same thing in makebuf to prevent makebuf
> depending on stat if HAVE_FCNTL is not defined. Presumably HAVE_STAT
> would be a better name, but there's currently no such define used in
> newlib.
>
> Is this patch suitable for application? I grant that this
> functionality is somewhat of a special need; however, giving newlib
> the ability to produce binaries that do not depend on system calls is
> a nice feature for embedded systems.
>
> Cheers,
> Shaun
>
> 2005-12-15 Shaun Jackman <sjackman@gmail.com>
>
> * libc/stdio/Makefile.am (GENERAL_SOURCES): Add sinit.c.
> * libc/stdio/findfp.c (std, __sinit): Move this function to sinit.c.
> (__sinitnostd): New function.
> (__sfp): Call CHECK_INIT instead of __sinit.
> * libc/stdio/local.h (__sinitnostd): New function declaration.
> * libc/stdio/makebuf.c: Armour the calls to stat in HAVE_FCNTL.
> * libc/stdio/sinit.c: New file.