newlib and the use of fcntl by java

Richard Earnshaw rearnsha@arm.com
Tue Sep 17 10:28:00 GMT 2002


> On Tue, 2002-09-17 at 06:38, Richard Earnshaw wrote:
> > Hmm, it appears that java is making use of the fcntl function in newlib 
> > (or at least, it is trying to).  This is a problem, since most embedded 
> > targets don't provide this function.  The function fcntl always exists in 
> > newlib's libc.a, but on most targets it will call a non-existent function 
> > _fcntl which causes a link error.
> 
> I have a patch which adds _fcntl for the ARM newlib port.  It was even
> approved, but, being the bad hacker-citizen that I am, it was never
> committed.
> 
> http://sources.redhat.com/ml/newlib/2002/msg00105.html
> 
> However, I'll note that adding a dummy _fcntl (like in my patch) wasn't
> one of your suggested fixes.  I believe syscalls contains other dummy
> implementations - so it seemed like the thing to do.  What do you think?
> 
> Thanks,
> 
> AG
> 
> 

The problem I see with providing a default that doesn't do the right thing 
(TM) is that an application can then get confused, since it made the call 
but the effects didn't happen as expected.  If we can't do what's 
required, I'm not sure we should quietly ignore things.  (Even setting 
errno and returning -1 might not be enough.)

R.



More information about the Newlib mailing list