Hi All
I got an issue using newlib. here is the __sfp function, when i can fopen, it jump to here :
FILE *
_DEFUN(__sfp, (d),
struct _reent *d){
FILE *fp;
int n;
struct _glue *g;
_newlib_sfp_lock_start ();
if (!_GLOBAL_REENT->__sdidinit)
__sinit (_GLOBAL_REENT);
for (g = &_GLOBAL_REENT->__sglue;; g = g->_next)
{
for (fp = g->_iobs, n = g->_niobs; --n >= 0; fp++) {
printf("fp->_flags=%d\n",fp->_flags);
if (fp->_flags == 0) {
goto found;
}
}
if (g->_next == NULL &&
(g->_next = __sfmoreglue (d, NDYNAMIC)) == NULL)
break;
}
__asm __volatile__("XCHG %BX, %BX");
_newlib_sfp_lock_exit ();
d->_errno = ENOMEM;
return NULL;
I can't open a file, unless i change "s->__sglue._niobs = 3;" to "s->__sglue._niobs = 999;" manually in __sinit function.
Am i doing it correctly?
thanks
from Peter ([email protected])
newlib question
Re: newlib question
My first guess is that malloc is not working correctly. You will need to supply a working sbrk or similar for that.
If a trainstation is where trains stop, what is a workstation ?
Re: newlib question
you are an expert, i finally find out my malloc is not working as expected. thanks