This is the mail archive of the newlib@sources.redhat.com 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]

Re: vfscanf in newlib


"Charles S. Wilson" wrote:
> 
> crossposted to cygwin-developers@sources.redhat.com (cygwin people: see
> the rest of this thread in the newlib mailing list archives beginning
> here: http://sources.redhat.com/ml/newlib/2001/msg00219.html )
> 
> Charles Wilson wrote:
> > How's this? (see attached patch to libc/include/stdio.h,
> > libc/stdio/Makefile.am, libc/stdio/Makefile.in, libc/stdio/vfscanf.c,
> > plus new files libc/stdio/vscanf.c and libc/stdio/vsscanf.c)
> >
> > Note: these modifications compile -- but I have not (can not) test
> > them.  I'm using a cygwin system, which incorporates newlib.  So, to
> > test changes to newlib, I have to build a new cygwin kernel -- but
> > something seems to have broken *in cygwin* recently and I'm having
> > trouble building cygwin, but libc.a(newlib) builds okay.  Thus, I can't
> > test these additions to newlib since my runtime (cygwin) already
> > includes (the old) newlib.  Perhaps someone on a different platform can
> > test these additions to newlib?
> 
> Okay, it turns out the cygwin problem was actually a problem with the
> latest cygwin release of gcc (specs bug).  After fixing that, I was able
> to build a working cygwin kernel incorporating these newlib changes.  I
> will attempt some tests of the new functions today. However...
> 
> > I followed the pattern I saw in the scanf family, including the
> > _function_r reentrant versions -- however, I am not sure that the
> > functions _vfscanf_r, vscanf_r, and _vsscanf_r are truly reentrant --
> > again, perhaps someone more knowledgable give the code a look.
> 
> I'm still not sure about reentrancy.

The new code doesn't fit the newlib reentrancy model.  This is not your fault.  The problem lies in
that __svfscanf does not have a reentrant version that takes the newlib reentrancy structure and it
should.

I have modified your patch slightly (removing unnecessary macros) and have also done some clean up
of the reentrancy mess.  I will be posting a new patch later today.

> 
> > I'm providing the patches and new files in the hopes that they will save
> > somebody (Jeff?) some time, when it comes to adding these six functions
> > to newlib.
>

It has, thanks.
 
> Since the cygwin folks are about to release a new official kernel (1.3.0
> this weekend) I'd like to get these changes into newlib quickly.  Other
> than the tests promised above, what else do I need to do to facilitate
> that?
>

You should try out the new patch.  The new patch adds a few new _r routines that should also be
added to Cygwin which alters the Cygwin portion of your patch.

-- Jeff J.


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