This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: False syscall dependencies [PATCH]


This came in just when "Elvis was leaving the building" i.e. me getting the 1.14.0 release out and going on holidays :) It got dropped on the floor.

Did you examine my original suggestion of simply pushing the CHECK_INIT calls back up to the calling functions so the sscanf family doesn't make the call? This eliminates the need for a large portion of the changes.

-- Jeff J.

Shaun Jackman wrote:
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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]